-
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
Rodolphe_Lassalle
committed
Jul 8, 2024
1 parent
986880b
commit cdc4d0b
Showing
48 changed files
with
1,352 additions
and
220 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{ | ||
"java.configuration.updateBuildConfiguration": "interactive" | ||
"java.configuration.updateBuildConfiguration": "interactive", | ||
"java.compile.nullAnalysis.mode": "automatic" | ||
} |
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 |
---|---|---|
@@ -1,47 +1,21 @@ | ||
# You can override the included template(s) by including variable overrides | ||
# SAST customization: https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings | ||
# Secret Detection customization: https://docs.gitlab.com/ee/user/application_security/secret_detection/#customizing-settings | ||
# Dependency Scanning customization: https://docs.gitlab.com/ee/user/application_security/dependency_scanning/#customizing-the-dependency-scanning-settings | ||
# Container Scanning customization: https://docs.gitlab.com/ee/user/application_security/container_scanning/#customizing-the-container-scanning-settings | ||
# Note that environment variables can be set in several places | ||
# See https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence | ||
stages: | ||
- build | ||
- test | ||
- deploy | ||
image: maven:3.8.5-openjdk-17 | ||
|
||
# Inclure le template Auto-DevOps pour des configurations automatiques | ||
include: | ||
- template: Auto-DevOps.gitlab-ci.yml | ||
stages: | ||
- build | ||
- test | ||
- quality | ||
|
||
# Configuration des jobs | ||
build: | ||
stage: build | ||
image: maven:3.8.5-jdk-17 # Utilisez l'image Docker Maven avec Java 17 | ||
script: | ||
- mvn clean package # Commande Maven pour compiler et empaqueter l'application | ||
artifacts: | ||
paths: | ||
- target/*.jar # Spécifie les artefacts à archiver (fichier JAR de l'application) | ||
script: | ||
- ./mvnw package | ||
|
||
test: | ||
stage: test | ||
image: maven:3.8.5-jdk-17 | ||
script: | ||
- mvn test # Exécute les tests Maven | ||
artifacts: | ||
reports: | ||
junit: target/surefire-reports/*.xml # Spécifie les rapports de tests à archiver | ||
|
||
deploy: | ||
stage: deploy | ||
image: openjdk:17-jdk # Utilisez l'image Docker OpenJDK 17 pour le déploiement | ||
script: | ||
- java -jar target/*.jar # Commande pour démarrer l'application Spring Boot | ||
environment: | ||
name: production # Nom de l'environnement de déploiement | ||
only: | ||
- main # Déployer uniquement à partir de la branche main | ||
script: | ||
- ./mvnw test | ||
|
||
include: | ||
- template: Auto-DevOps.gitlab-ci.yml | ||
quality: | ||
stage: quality | ||
script: | ||
- ./mvnw site |
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
27 changes: 27 additions & 0 deletions
27
backend/src/main/java/com/epsyl/eps/config/JacksonConfig.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.epsyl.eps.config; | ||
|
||
import org.bson.types.ObjectId; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; | ||
|
||
import com.epsyl.eps.serialization.ObjectIdDeserrializer; | ||
import com.epsyl.eps.serialization.ObjectIdSerializer; | ||
import com.fasterxml.jackson.databind.module.SimpleModule; | ||
|
||
@Configuration | ||
public class JacksonConfig { | ||
|
||
@Bean | ||
public Jackson2ObjectMapperBuilder jacksonBuilder() { | ||
Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder(); | ||
SimpleModule module = new SimpleModule(); | ||
|
||
module.addSerializer(ObjectId.class, new ObjectIdSerializer()); | ||
module.addDeserializer(ObjectId.class, new ObjectIdDeserrializer()); | ||
|
||
builder.modules(module); | ||
|
||
return builder; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
backend/src/main/java/com/epsyl/eps/config/ObjectMapperConfig.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,24 @@ | ||
package com.epsyl.eps.config; | ||
|
||
import org.bson.types.ObjectId; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import com.epsyl.eps.serialization.ObjectIdDeserrializer; | ||
import com.epsyl.eps.serialization.ObjectIdSerializer; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.databind.module.SimpleModule; | ||
|
||
@Configuration | ||
public class ObjectMapperConfig { | ||
@Bean | ||
public ObjectMapper objectMapper() { | ||
ObjectMapper mapper = new ObjectMapper(); | ||
SimpleModule module = new SimpleModule(); | ||
|
||
module.addSerializer(ObjectId.class, new ObjectIdSerializer()); | ||
module.addDeserializer(ObjectId.class, new ObjectIdDeserrializer()); | ||
mapper.registerModule(module); | ||
return mapper; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...l/eps/configuration_global/WebConfig.java → .../java/com/epsyl/eps/config/WebConfig.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
17 changes: 0 additions & 17 deletions
17
backend/src/main/java/com/epsyl/eps/configuration_global/ObjectIdDeserrializer.java
This file was deleted.
Oops, something went wrong.
54 changes: 54 additions & 0 deletions
54
backend/src/main/java/com/epsyl/eps/controllers/ArchiveProspectController.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,54 @@ | ||
package com.epsyl.eps.controllers; | ||
|
||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import com.epsyl.eps.entities.ArchiveProspect; | ||
import com.epsyl.eps.services.ArchiveProspectService; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
|
||
@RestController | ||
@RequestMapping("/api/v1/archive") | ||
public class ArchiveProspectController { | ||
|
||
@Autowired | ||
private ArchiveProspectService archiveProspectService; | ||
|
||
// GET api/v1/archive/all | ||
@GetMapping("/all") | ||
public Iterable<ArchiveProspect> getAllArchive() { | ||
return archiveProspectService.listAll(); | ||
} | ||
|
||
// GET api/v1/archive/id | ||
@GetMapping("/{id}") | ||
public ArchiveProspect getArchive(@PathVariable String id) { | ||
return archiveProspectService.getArchiveProspectByID(id).get(); | ||
} | ||
|
||
// POST api/v1/archive/save | ||
@RequestMapping("/save") | ||
public ArchiveProspect saveArchive(@RequestBody ArchiveProspect archive) { | ||
return archiveProspectService.save(archive); | ||
} | ||
|
||
// PUT api/v1/archive/id | ||
// @PutMapping("/{id}") | ||
// public ArchiveProspect updateArchive(@RequestBody ArchiveProspect archive, @PathVariable String id) { | ||
// archive.set_id(id); | ||
// archiveProspectService.save(archive); | ||
// return archive; | ||
// } | ||
|
||
// DELETE api/v1/archive/delete/id | ||
@RequestMapping("/delete/{id}") | ||
public ResponseEntity<Void> deleteArchive(@PathVariable String _id) { | ||
archiveProspectService.deleteArchive(_id); | ||
return ResponseEntity.noContent().build(); | ||
} | ||
} |
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
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
28 changes: 28 additions & 0 deletions
28
backend/src/main/java/com/epsyl/eps/controllers/RolesController.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.epsyl.eps.controllers; | ||
|
||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import com.epsyl.eps.entities.Role; | ||
import com.epsyl.eps.services.RoleService; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
|
||
|
||
@RestController | ||
@RequestMapping("/api/v1/roles") | ||
@RequiredArgsConstructor | ||
public class RolesController { | ||
|
||
@Autowired | ||
private RoleService roleService; | ||
|
||
@GetMapping("/all") | ||
public Iterable<Role> getRoles() { | ||
return roleService.getAllRoles(); | ||
} | ||
|
||
} |
Oops, something went wrong.