Skip to content

Commit

Permalink
fix: allow no date when updating visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
davdarras committed Oct 7, 2024
1 parent dd797be commit 540b847
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 73 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<groupId>fr.insee.pearljam</groupId>
<artifactId>pearljam-back-office</artifactId>
<version>5.1.7</version>
<version>5.1.8</version>
<name>Pearl-Jam-Back-Office</name>
<description>Back-office services for PearlJam</description>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package fr.insee.pearljam.api.campaign.dto.input;

import com.fasterxml.jackson.annotation.JsonInclude;
import fr.insee.pearljam.api.web.annotation.AtLeastOneDateValid;
import fr.insee.pearljam.domain.campaign.model.Visibility;
import jakarta.validation.constraints.NotBlank;
import org.springframework.lang.NonNull;
Expand All @@ -19,7 +18,6 @@
* @param endDate End date of the visibility
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@AtLeastOneDateValid
public record VisibilityCampaignUpdateDto(
Long managementStartDate,
Long interviewerStartDate,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package fr.insee.pearljam.api.campaign.dto.input;

import com.fasterxml.jackson.annotation.JsonInclude;
import fr.insee.pearljam.api.web.annotation.AtLeastOneDateValid;
import fr.insee.pearljam.domain.campaign.model.Visibility;
import lombok.NonNull;

Expand All @@ -16,7 +15,6 @@
* @param endDate End date of the visibility
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@AtLeastOneDateValid
public record VisibilityUpdateDto(
Long managementStartDate,
Long interviewerStartDate,
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,6 @@ void testUpdateCampaign05() throws Exception {
testUpdateExceptions(HttpStatus.NOT_FOUND, VisibilityNotFoundException.MESSAGE);
}

@Test
@DisplayName("Should return bad request when visibility has no date set")
void testUpdateCampaign06() throws Exception {
VisibilityCampaignUpdateDto visibility = generateVisibility("ou-id",
null, null,
null, null,
null, null,
true, "mail", "tel");
testUpdateExceptions(visibility, HttpStatus.BAD_REQUEST, ExceptionControllerAdvice.INVALID_PARAMETERS_MESSAGE);
}

@Test
@DisplayName("Should return conflict when invalidating update")
void testUpdateCampaign07() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import fr.insee.pearljam.api.utils.JsonTestHelper;
import fr.insee.pearljam.api.utils.MockMvcTestUtils;
import fr.insee.pearljam.api.utils.dummy.AuthenticationUserFakeService;
import fr.insee.pearljam.api.web.exception.ExceptionControllerAdvice;
import fr.insee.pearljam.domain.campaign.model.Visibility;
import fr.insee.pearljam.domain.exception.CampaignNotFoundException;
import fr.insee.pearljam.domain.exception.VisibilityHasInvalidDatesException;
Expand Down Expand Up @@ -137,19 +136,6 @@ void testUpdateVisibility03() throws Exception {
.andExpect(MockMvcTestUtils.apiErrorMatches(HttpStatus.CONFLICT, updatePath, VisibilityHasInvalidDatesException.MESSAGE));
}

@Test
@DisplayName("Should return bad request when visibility has no date set")
void testUpdateVisibility04() throws Exception {
VisibilityUpdateDto visibility = generateUpdateVisibility(
null, null,
null, null,
null, null);
mockMvc.perform(put(updatePath)
.content(JsonTestHelper.toJson(visibility))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(MockMvcTestUtils.apiErrorMatches(HttpStatus.BAD_REQUEST, updatePath, ExceptionControllerAdvice.INVALID_PARAMETERS_MESSAGE));
}

private VisibilityUpdateDto generateUpdateVisibility() {
return generateUpdateVisibility(1721683250000L, 1721683251000L,
1721683252000L, 1721683253000L,
Expand Down

0 comments on commit 540b847

Please sign in to comment.