Skip to content

Commit

Permalink
refactor: contct controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
BettyB979 committed Dec 6, 2023
1 parent 2747030 commit 03e49f2
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ public ResponseEntity<AddressDto> getContactAddress(@PathVariable("id") String i
+ "|| @AuthorizeMethodDecider.isWebClient() "
+ "|| (@AuthorizeMethodDecider.isRespondent() && (#id == @AuthorizeMethodDecider.getUsername()))"
+ "|| @AuthorizeMethodDecider.isAdmin() ")

public ResponseEntity<AddressDto> putAddress(@PathVariable("id") String id, @RequestBody AddressDto addressDto, Authentication auth) {
Contact contact = contactService.findByIdentifier(id);
HttpStatus httpStatus;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
import fr.insee.survey.datacollectionmanagement.contact.service.ContactEventService;
import fr.insee.survey.datacollectionmanagement.contact.service.ContactService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.ArraySchema;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -47,11 +42,6 @@ public class ContactEventController {

@Operation(summary = "Search for contactEvents by the contact id")
@GetMapping(value = Constants.API_CONTACTS_ID_CONTACTEVENTS, produces = "application/json")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = ContactEventDto.class)))),
@ApiResponse(responseCode = "404", description = "Not found"),
@ApiResponse(responseCode = "400", description = "Internal servor error")
})
public ResponseEntity<?> getContactContactEvents(@PathVariable("id") String identifier) {
Contact contact = contactService.findByIdentifier(identifier);
return ResponseEntity.status(HttpStatus.OK)
Expand All @@ -63,11 +53,6 @@ public ResponseEntity<?> getContactContactEvents(@PathVariable("id") String iden

@Operation(summary = "Create a contactEvent")
@PostMapping(value = Constants.API_CONTACTEVENTS, produces = "application/json", consumes = "application/json")
@ApiResponses(value = {
@ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(implementation = ContactEventDto.class))),
@ApiResponse(responseCode = "400", description = "Bad request"),
@ApiResponse(responseCode = "404", description = "Not found")
})
public ResponseEntity<?> postContactEvent(@RequestBody @Valid ContactEventDto contactEventDto) {

Contact contact = contactService.findByIdentifier(contactEventDto.getIdentifier());
Expand All @@ -88,11 +73,6 @@ public ResponseEntity<?> postContactEvent(@RequestBody @Valid ContactEventDto co

@Operation(summary = "Delete a contact event")
@DeleteMapping(value = Constants.API_CONTACTEVENTS_ID, produces = "application/json")
@ApiResponses(value = {
@ApiResponse(responseCode = "204", description = "No Content"),
@ApiResponse(responseCode = "404", description = "Not found"),
@ApiResponse(responseCode = "400", description = "Bad Request")
})
public ResponseEntity<?> deleteContactEvent(@PathVariable("id") Long id) {
ContactEvent contactEvent = contactEventService.findById(id);
Contact contact = contactEvent.getContact();
Expand Down

0 comments on commit 03e49f2

Please sign in to comment.