-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1f10afd
commit 7b45f20
Showing
42 changed files
with
1,158 additions
and
674 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"cSpell.words": [ | ||
"Archivage" | ||
] | ||
} |
27 changes: 27 additions & 0 deletions
27
backend/src/main/java/com/sp/gestion/archivage/controller/ArchiveController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.sp.gestion.archivage.controller; | ||
|
||
|
||
import com.sp.gestion.archivage.schema.ArchiveResponse; | ||
import com.sp.gestion.archivage.service.ArchiveService; | ||
import lombok.RequiredArgsConstructor; | ||
import org.apache.coyote.Response; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.util.List; | ||
|
||
@RestController | ||
@RequestMapping("/archive") | ||
@RequiredArgsConstructor | ||
public class ArchiveController { | ||
|
||
private final ArchiveService archiveService; | ||
|
||
@GetMapping("/all") | ||
public ResponseEntity<List<ArchiveResponse>> getAllArchives() { | ||
return ResponseEntity.ok(this.archiveService.getAllArchives()); | ||
} | ||
|
||
} |
61 changes: 61 additions & 0 deletions
61
backend/src/main/java/com/sp/gestion/archivage/model/Archive.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package com.sp.gestion.archivage.model; | ||
|
||
|
||
import com.sp.gestion.suivie_physique.model.Valeur; | ||
import com.sp.users.model.User; | ||
import jakarta.persistence.*; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import org.hibernate.annotations.GenericGenerator; | ||
import org.springframework.data.annotation.CreatedBy; | ||
import org.springframework.data.annotation.CreatedDate; | ||
import org.springframework.data.annotation.LastModifiedBy; | ||
import org.springframework.data.annotation.LastModifiedDate; | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
||
@Data | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Entity | ||
@Table(name = "_archive") | ||
@EntityListeners(AuditingEntityListener.class) | ||
public class Archive { | ||
@Id | ||
@GeneratedValue(strategy= GenerationType.AUTO,generator="native") | ||
@GenericGenerator(name = "native",strategy = "native") | ||
private Long id; | ||
|
||
private LocalDateTime dateArchive; | ||
|
||
@OneToMany(mappedBy = "archive", cascade = CascadeType.ALL, fetch = FetchType.LAZY) | ||
private List<Valeur> valeurs; | ||
|
||
|
||
@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER) | ||
private ArchiveType type; | ||
|
||
@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER) | ||
private User archivist; | ||
|
||
@CreatedBy | ||
@Column(name = "created_by", updatable = false) | ||
private String createdBy; | ||
|
||
@CreatedDate | ||
@Column(name = "created_date", updatable = false) | ||
private LocalDateTime createdDate; | ||
|
||
@LastModifiedDate | ||
@Column(name = "last_modified_date") | ||
private LocalDateTime lastModifiedDate; | ||
|
||
@LastModifiedBy | ||
@Column(name = "last_modified_by") | ||
private String lastModifiedBy; | ||
} |
6 changes: 6 additions & 0 deletions
6
backend/src/main/java/com/sp/gestion/archivage/model/ArchiveRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.sp.gestion.archivage.model; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface ArchiveRepository extends JpaRepository<Archive, Long> { | ||
} |
55 changes: 55 additions & 0 deletions
55
backend/src/main/java/com/sp/gestion/archivage/model/ArchiveType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.sp.gestion.archivage.model; | ||
|
||
|
||
import jakarta.persistence.*; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import org.hibernate.annotations.GenericGenerator; | ||
import org.springframework.data.annotation.CreatedBy; | ||
import org.springframework.data.annotation.CreatedDate; | ||
import org.springframework.data.annotation.LastModifiedBy; | ||
import org.springframework.data.annotation.LastModifiedDate; | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
||
import java.util.List; | ||
|
||
@Data | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Entity | ||
@Table(name = "_archive_type") | ||
@EntityListeners(AuditingEntityListener.class) | ||
public class ArchiveType { | ||
@Id | ||
@GeneratedValue(strategy= GenerationType.AUTO,generator="native") | ||
@GenericGenerator(name = "native",strategy = "native") | ||
private Long id; | ||
|
||
private String libelle; | ||
|
||
private String description; | ||
|
||
@OneToMany(mappedBy = "type", cascade = CascadeType.ALL, fetch = FetchType.LAZY) | ||
private List<Archive> archives; | ||
|
||
@CreatedBy | ||
@Column(name = "created_by", updatable = false) | ||
private String createdBy; | ||
|
||
@CreatedDate | ||
@Column(name = "created_date", updatable = false) | ||
private String createdDate; | ||
|
||
@LastModifiedBy | ||
@Column(name = "last_modified_by") | ||
private String lastModifiedBy; | ||
|
||
@LastModifiedDate | ||
@Column(name = "last_modified_date") | ||
private String lastModifiedDate; | ||
|
||
|
||
} |
16 changes: 16 additions & 0 deletions
16
backend/src/main/java/com/sp/gestion/archivage/schema/ArchiveResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.sp.gestion.archivage.schema; | ||
|
||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Data | ||
@Builder | ||
public class ArchiveResponse { | ||
private LocalDateTime dateArchive; | ||
private String type; | ||
private int totalValeurs; | ||
private String archivist; | ||
} |
14 changes: 14 additions & 0 deletions
14
backend/src/main/java/com/sp/gestion/archivage/schema/ArchiveValeurResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.sp.gestion.archivage.schema; | ||
|
||
|
||
import com.sp.gestion.suivie_physique.model.Valeur; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
import java.util.List; | ||
|
||
@Data | ||
@Builder | ||
public class ArchiveValeurResponse { | ||
private List<Valeur> valeurs; | ||
} |
28 changes: 28 additions & 0 deletions
28
backend/src/main/java/com/sp/gestion/archivage/service/ArchiveService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.sp.gestion.archivage.service; | ||
|
||
|
||
import com.sp.gestion.archivage.model.ArchiveRepository; | ||
import com.sp.gestion.archivage.schema.ArchiveResponse; | ||
import com.sp.gestion.archivage.schema.ArchiveValeurResponse; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.List; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class ArchiveService { | ||
private final ArchiveRepository archiveRepository; | ||
|
||
public List<ArchiveResponse> getAllArchives() { | ||
return this.archiveRepository.findAll() | ||
.stream() | ||
.map(archive -> ArchiveResponse.builder() | ||
.dateArchive(archive.getDateArchive()) | ||
.type(archive.getType().getLibelle()) | ||
.totalValeurs((archive.getValeurs().size())) | ||
.archivist(archive.getArchivist().getUsername()) | ||
.build()) | ||
.toList(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
backend/src/main/java/com/sp/gestion/point_capture/schema/PointCaptureStatsResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.sp.gestion.point_capture.schema; | ||
|
||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
@Data | ||
@Builder | ||
public class PointCaptureStatsResponse { | ||
|
||
private int totalPointsCapture; | ||
private int totalCircuit; | ||
private int totalTypePointCapture; | ||
private int totalLecteur; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 0 additions & 71 deletions
71
backend/src/main/java/com/sp/gestion/suivie_physique/model/Effet.java
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
backend/src/main/java/com/sp/gestion/suivie_physique/model/EtatEffet.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.