Skip to content

Commit

Permalink
renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
thoomasbro committed Oct 24, 2023
1 parent e961456 commit 885438a
Show file tree
Hide file tree
Showing 35 changed files with 73 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

Convention de nommage des routes pour une API RESTful

- nom du chemin en minuscule
- nom du chemin (request path) en snake_case
- nom du chemin au pluriel si possible, correspondant au nom de l'entité principale métier
- nom du chemin au singulier si la ressource est unique (`/preview`, `/search`, `/missions/:id/archive`)
- pas d'écriture en base à partir des requêtes GET (archiver se fait sur une requête PUT)

## Définition des ressources

Expand All @@ -12,9 +14,9 @@ Donc 5 définitions de méthode par fichier de ressource au maximum

Verbe HTTP| Request Path | Controller Name | Usage

GET | /missions/:id | get | display a specific mission
GET | /missions | getAll | list all missions
POST | /missions | create | create a new mission
GET | /missions/:id | get | display a specific mission
PATCH/PUT | /missions/:id | update | update a specific mission
DELETE | /missions/:id | delete | delete a specific mission

Expand All @@ -24,8 +26,10 @@ Possibilité de définir un scope pour les ressources

## Autres propositions

L'arborescence reprend le chemin des urls

Arborescence:

```
- endpoints
- bff
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.RestController
@RestController
@RequestMapping("/bff/v1/amps")
@Tag(name = "AMP", description = "API des Aires Marines Protégées (AMP)")
class AMPsController(
class Amps(
private val getAllAMPs: GetAllAMPs,
private val objectMapper: ObjectMapper,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RestController
@RestController
@RequestMapping("/bff/v1/controlthemes")
@Tag(name = "Control Themes", description = "API control themes")
class ControlThemesController(
class ControlThemes(
private val getAllControlThemes: GetAllControlThemes,
private val getControlThemeById: GetControlThemeById,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RestController
@RestController
@RequestMapping("/bff/v1/department_areas")
@Tag(name = "DepartmentAreas")
class DepartmentAreasController(
class DepartmentAreas(
private val getDepartmentAreas: GetDepartmentAreas,
private val getDepartmentAreaById: GetDepartmentAreaByInseeCode,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.RestController
@RestController
@RequestMapping("/bff/v1/healthcheck")
@Tag(description = "API for Healthcheck", name = "Healthcheck")
class HealthcheckController(
class Healthcheck(
private val getHealthcheck: GetHealthcheck,
) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import java.time.ZonedDateTime
@RestController
@RequestMapping("/bff/v1/missions")
@Tag(description = "API Missions", name = "Missions")
class MissionsController(
class Missions(
private val createOrUpdateMissionWithAttachedReporting: CreateOrUpdateMissionWithAttachedReporting,
private val getFullMissions: GetFullMissions,
private val getFullMissionById: GetFullMissionById,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.RestController
@RestController
@RequestMapping("/bff/v1/natinfs")
@Tag(description = "API Natinf", name = "Natinf")
class NatinfsController(
class Natinfs(
private val getAllNatinfs: GetAllNatinfs,
) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RestController
@RestController
@RequestMapping("/bff/v1/regulatory")
@Tag(name = "Regulatory", description = "API regulatory layers")
class RegulatoryAreasController(
class RegulatoryAreas(
private val getAllRegulatoryAreas: GetAllRegulatoryAreas,
private val getRegulatoryAreaById: GetRegulatoryAreaById,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import java.time.ZonedDateTime
@RestController
@RequestMapping("/bff/v1/reportings")
@Tag(description = "API des Signalements", name = "Reportings")
class ReportingsController(
class Reportings(
private val createOrUpdateReporting: CreateOrUpdateReporting,
private val getReportingById: GetReportingById,
private val getReportings: GetReportings,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RestController
@RestController
@RequestMapping("/bff/v1/semaphores")
@Tag(description = "API Semaphores", name = "Semaphores")
class SemaphoresController(
class Semaphores(
private val getAllSemaphores: GetAllSemaphores,
private val getSemaphoreById: GetSemaphoreById,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.*
@RestController
@RequestMapping("/api/v1/administrations")
@Tag(name = "Administrations")
class ApiAdministrationsController(
class Administrations(
private val archiveAdministration: ArchiveAdministration,
private val canArchiveAdministration: CanArchiveAdministration,
private val canDeleteAdministration: CanDeleteAdministration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.*
@RestController
@RequestMapping("/api/v1/bases")
@Tag(name = "Bases", description = "API bases")
class ApiBasesController(
class Bases(
private val canDeleteBase: CanDeleteBase,
private val createOrUpdateBase: CreateOrUpdateBase,
private val deleteBase: DeleteBase,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.*
@RestController
@RequestMapping("/api/v1/control_unit_contacts")
@Tag(name = "Control Unit Contacts")
class ApiControlUnitContactsController(
class ControlUnitContacts(
private val createOrUpdateControlUnitContact: CreateOrUpdateControlUnitContact,
private val deleteControlUnitContact: DeleteControlUnitContact,
private val getControlUnitContacts: GetControlUnitContacts,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.*
@RestController
@RequestMapping("/api/v1/control_unit_resources")
@Tag(name = "Control Unit Resources")
class ApiControlUnitResourcesController(
class ControlUnitResources(
private val createOrUpdateControlUnitResource: CreateOrUpdateControlUnitResource,
private val deleteControlUnitResource: DeleteControlUnitResource,
private val getControlUnitResources: GetControlUnitResources,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.RestController
@RestController
@RequestMapping("/api/v1/healthcheck")
@Tag(description = "API for Healthcheck", name = "Healthcheck")
class ApiHealthcheckController(
class Healthcheck(
private val getHealthcheck: GetHealthcheck,
) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.RestController
@RestController
@RequestMapping("/api/v1/control_units")
@Tag(name = "Legacy Control Units")
class ApiLegacyControlUnitsController(
class LegacyControlUnits(
private val getLegacyControlUnits: GetLegacyControlUnits,
) {
@GetMapping("")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import java.time.ZonedDateTime
@RestController
@RequestMapping("/api/v1/missions")
@Tag(description = "API Missions", name = "Missions")
class ApiMissionsController(
class Missions(
private val createOrUpdateMission: CreateOrUpdateMission,
private val getMissions: GetMissions,
private val getMissionById: GetMissionById,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.*
@RestController
@RequestMapping("/api/v2/control_units")
@Tag(name = "Control Units")
class ApiControlUnitsController(
class ControlUnits(
private val archiveControlUnit: ArchiveControlUnit,
private val createOrUpdateControlUnit: CreateOrUpdateControlUnit,
private val canDeleteControlUnit: CanDeleteControlUnit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import fr.gouv.cacem.monitorenv.config.MapperConfiguration
import fr.gouv.cacem.monitorenv.config.WebSecurityConfig
import fr.gouv.cacem.monitorenv.domain.entities.amp.AMPEntity
import fr.gouv.cacem.monitorenv.domain.use_cases.amps.GetAllAMPs
import fr.gouv.cacem.monitorenv.infrastructure.api.endpoints.bff.v1.AMPsController
import fr.gouv.cacem.monitorenv.infrastructure.api.endpoints.bff.v1.Amps
import org.hamcrest.Matchers.equalTo
import org.junit.jupiter.api.Test
import org.locationtech.jts.geom.MultiPolygon
Expand All @@ -20,8 +20,8 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPat
import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status

@Import(WebSecurityConfig::class, MapperConfiguration::class)
@WebMvcTest(value = [(AMPsController::class)])
class AMPsControllerITests {
@WebMvcTest(value = [(Amps::class)])
class AmpsITests {
@Autowired
private lateinit var mockMvc: MockMvc

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import fr.gouv.cacem.monitorenv.config.WebSecurityConfig
import fr.gouv.cacem.monitorenv.domain.entities.controlTheme.ControlThemeEntity
import fr.gouv.cacem.monitorenv.domain.use_cases.controlThemes.GetAllControlThemes
import fr.gouv.cacem.monitorenv.domain.use_cases.controlThemes.GetControlThemeById
import fr.gouv.cacem.monitorenv.infrastructure.api.endpoints.bff.v1.ControlThemesController
import fr.gouv.cacem.monitorenv.infrastructure.api.endpoints.bff.v1.ControlThemes
import org.hamcrest.Matchers.equalTo
import org.junit.jupiter.api.Test
import org.mockito.BDDMockito.given
Expand All @@ -18,8 +18,8 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPat
import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status

@Import(WebSecurityConfig::class)
@WebMvcTest(value = [(ControlThemesController::class)])
class ControlThemesControllerITests {
@WebMvcTest(value = [(ControlThemes::class)])
class ControlThemesITests {

@Autowired
private lateinit var mockMvc: MockMvc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import fr.gouv.cacem.monitorenv.config.WebSecurityConfig
import fr.gouv.cacem.monitorenv.domain.entities.departmentArea.DepartmentAreaEntity
import fr.gouv.cacem.monitorenv.domain.use_cases.departmentArea.GetDepartmentAreaByInseeCode
import fr.gouv.cacem.monitorenv.domain.use_cases.departmentArea.GetDepartmentAreas
import fr.gouv.cacem.monitorenv.infrastructure.api.endpoints.bff.v1.DepartmentAreasController
import fr.gouv.cacem.monitorenv.infrastructure.api.endpoints.bff.v1.DepartmentAreas
import org.hamcrest.Matchers
import org.junit.jupiter.api.Test
import org.mockito.BDDMockito
Expand All @@ -20,7 +20,7 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers
import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status

@Import(WebSecurityConfig::class, MapperConfiguration::class)
@WebMvcTest(value = [(DepartmentAreasController::class)])
@WebMvcTest(value = [(DepartmentAreas::class)])
class DepartmentAreaControllerITests {
@Autowired
private lateinit var mockMvc: MockMvc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package fr.gouv.cacem.monitorenv.infrastructure.api.endpoints.bff
import fr.gouv.cacem.monitorenv.config.WebSecurityConfig
import fr.gouv.cacem.monitorenv.domain.entities.health.Health
import fr.gouv.cacem.monitorenv.domain.use_cases.healthcheck.GetHealthcheck
import fr.gouv.cacem.monitorenv.infrastructure.api.endpoints.bff.v1.HealthcheckController
import fr.gouv.cacem.monitorenv.infrastructure.api.endpoints.bff.v1.Healthcheck
import org.hamcrest.Matchers.equalTo
import org.junit.jupiter.api.Test
import org.mockito.BDDMockito.given
Expand All @@ -17,8 +17,8 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPat
import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status

@Import(WebSecurityConfig::class)
@WebMvcTest(value = [(HealthcheckController::class)])
class HealthcheckControllerITests {
@WebMvcTest(value = [(Healthcheck::class)])
class HealthcheckITests {

@Autowired
private lateinit var mockMvc: MockMvc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import fr.gouv.cacem.monitorenv.domain.use_cases.reportings.dtos.ReportingDTO
import fr.gouv.cacem.monitorenv.infrastructure.api.adapters.bff.inputs.missions.CreateOrUpdateMissionDataInput
import fr.gouv.cacem.monitorenv.infrastructure.api.adapters.bff.inputs.missions.EnvActionAttachedToReportingIds
import fr.gouv.cacem.monitorenv.infrastructure.api.adapters.bff.inputs.missions.MissionEnvActionDataInput
import fr.gouv.cacem.monitorenv.infrastructure.api.endpoints.bff.v1.MissionsController
import fr.gouv.cacem.monitorenv.infrastructure.api.endpoints.bff.v1.Missions
import org.hamcrest.Matchers.equalTo
import org.junit.jupiter.api.Test
import org.locationtech.jts.geom.MultiPolygon
Expand All @@ -59,8 +59,8 @@ import java.time.ZonedDateTime
import java.util.UUID

@Import(WebSecurityConfig::class, MapperConfiguration::class)
@WebMvcTest(value = [(MissionsController::class)])
class MissionsControllerITests {
@WebMvcTest(value = [(Missions::class)])
class MissionsITests {

@Autowired
private lateinit var mockMvc: MockMvc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package fr.gouv.cacem.monitorenv.infrastructure.api.endpoints.bff
import fr.gouv.cacem.monitorenv.config.WebSecurityConfig
import fr.gouv.cacem.monitorenv.domain.entities.natinf.NatinfEntity
import fr.gouv.cacem.monitorenv.domain.use_cases.natinfs.GetAllNatinfs
import fr.gouv.cacem.monitorenv.infrastructure.api.endpoints.bff.v1.NatinfsController
import fr.gouv.cacem.monitorenv.infrastructure.api.endpoints.bff.v1.Natinfs
import org.hamcrest.Matchers.equalTo
import org.junit.jupiter.api.Test
import org.mockito.BDDMockito.given
Expand All @@ -17,8 +17,8 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPat
import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status

@Import(WebSecurityConfig::class)
@WebMvcTest(value = [(NatinfsController::class)])
class NatinfsControllerITests {
@WebMvcTest(value = [(Natinfs::class)])
class NatinfsITests {

@Autowired
private lateinit var mockMvc: MockMvc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import fr.gouv.cacem.monitorenv.config.WebSecurityConfig
import fr.gouv.cacem.monitorenv.domain.entities.regulatoryArea.RegulatoryAreaEntity
import fr.gouv.cacem.monitorenv.domain.use_cases.regulatoryAreas.GetAllRegulatoryAreas
import fr.gouv.cacem.monitorenv.domain.use_cases.regulatoryAreas.GetRegulatoryAreaById
import fr.gouv.cacem.monitorenv.infrastructure.api.endpoints.bff.v1.RegulatoryAreasController
import fr.gouv.cacem.monitorenv.infrastructure.api.endpoints.bff.v1.RegulatoryAreas
import org.hamcrest.Matchers.equalTo
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith
Expand All @@ -25,7 +25,7 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status

@Import(WebSecurityConfig::class, MapperConfiguration::class)
@ExtendWith(SpringExtension::class)
@WebMvcTest(value = [(RegulatoryAreasController::class)])
@WebMvcTest(value = [(RegulatoryAreas::class)])
class RegulatoryAreasControllerITests {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import fr.gouv.cacem.monitorenv.domain.use_cases.reportings.GetReportingById
import fr.gouv.cacem.monitorenv.domain.use_cases.reportings.GetReportings
import fr.gouv.cacem.monitorenv.domain.use_cases.reportings.dtos.ReportingDTO
import fr.gouv.cacem.monitorenv.infrastructure.api.adapters.bff.inputs.CreateOrUpdateReportingDataInput
import fr.gouv.cacem.monitorenv.infrastructure.api.endpoints.bff.v1.ReportingsController
import fr.gouv.cacem.monitorenv.infrastructure.api.endpoints.bff.v1.Reportings
import org.junit.jupiter.api.Test
import org.locationtech.jts.geom.Point
import org.locationtech.jts.io.WKTReader
Expand All @@ -39,8 +39,8 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status
import java.time.ZonedDateTime

@Import(WebSecurityConfig::class, MapperConfiguration::class)
@WebMvcTest(value = [(ReportingsController::class)])
class ReportingsControllerITests {
@WebMvcTest(value = [(Reportings::class)])
class ReportingsITests {
@Autowired
private lateinit var mockedApi: MockMvc

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import fr.gouv.cacem.monitorenv.config.WebSecurityConfig
import fr.gouv.cacem.monitorenv.domain.entities.semaphore.SemaphoreEntity
import fr.gouv.cacem.monitorenv.domain.use_cases.semaphores.GetAllSemaphores
import fr.gouv.cacem.monitorenv.domain.use_cases.semaphores.GetSemaphoreById
import fr.gouv.cacem.monitorenv.infrastructure.api.endpoints.bff.v1.SemaphoresController
import fr.gouv.cacem.monitorenv.infrastructure.api.endpoints.bff.v1.Semaphores
import org.hamcrest.Matchers.equalTo
import org.junit.jupiter.api.Test
import org.locationtech.jts.geom.Point
Expand All @@ -21,8 +21,8 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPat
import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status

@Import(WebSecurityConfig::class, MapperConfiguration::class)
@WebMvcTest(value = [(SemaphoresController::class)])
class SemaphoresControllerITests {
@WebMvcTest(value = [(Semaphores::class)])
class SemaphoresITests {
@Autowired
private lateinit var mockMvc: MockMvc

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import fr.gouv.cacem.monitorenv.domain.entities.administration.AdministrationEnt
import fr.gouv.cacem.monitorenv.domain.use_cases.administration.*
import fr.gouv.cacem.monitorenv.domain.use_cases.administration.dtos.FullAdministrationDTO
import fr.gouv.cacem.monitorenv.infrastructure.api.adapters.publicapi.inputs.CreateOrUpdateAdministrationDataInput
import fr.gouv.cacem.monitorenv.infrastructure.api.endpoints.publicapi.v1.ApiAdministrationsController
import fr.gouv.cacem.monitorenv.infrastructure.api.endpoints.publicapi.v1.Administrations
import org.hamcrest.Matchers
import org.junit.jupiter.api.Test
import org.mockito.BDDMockito
Expand All @@ -25,8 +25,8 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers
import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status

@Import(WebSecurityConfig::class, MapperConfiguration::class)
@WebMvcTest(value = [(ApiAdministrationsController::class)])
class ApiAdministrationsControllerITests {
@WebMvcTest(value = [(Administrations::class)])
class AdministrationsITests {
@Autowired
private lateinit var mockMvc: MockMvc

Expand Down
Loading

0 comments on commit 885438a

Please sign in to comment.