Skip to content

Commit

Permalink
[PNPG-263] feat: added dedicate response object for check-manager API (
Browse files Browse the repository at this point in the history
  • Loading branch information
empassaro authored Nov 7, 2024
1 parent 862b8d3 commit 5f8592e
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 8 deletions.
17 changes: 13 additions & 4 deletions app/src/main/resources/swagger/api-docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2673,10 +2673,7 @@
"content" : {
"application/json" : {
"schema" : {
"type" : "object",
"additionalProperties" : {
"type" : "boolean"
}
"$ref" : "#/components/schemas/CheckManagerResponse"
}
}
}
Expand Down Expand Up @@ -3403,6 +3400,18 @@
}
}
},
"CheckManagerResponse" : {
"title" : "CheckManagerResponse",
"required" : [ "response" ],
"type" : "object",
"properties" : {
"response" : {
"type" : "boolean",
"description" : "Is the given user manager of the institution",
"example" : false
}
}
},
"CompanyBillingDataDto" : {
"title" : "CompanyBillingDataDto",
"required" : [ "businessName", "certified", "digitalAddress", "taxCode" ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import it.pagopa.selfcare.commons.base.logging.LogUtils;
import it.pagopa.selfcare.commons.web.model.Problem;
import it.pagopa.selfcare.onboarding.core.UserService;
import it.pagopa.selfcare.onboarding.web.model.CheckManagerResponse;
import it.pagopa.selfcare.onboarding.web.model.OnboardingUserDto;
import it.pagopa.selfcare.onboarding.web.model.UserDataValidationDto;
import it.pagopa.selfcare.onboarding.web.model.mapper.OnboardingResourceMapper;
Expand All @@ -20,8 +21,6 @@
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.Collections;
import java.util.Map;

import static org.springframework.http.MediaType.APPLICATION_PROBLEM_JSON_VALUE;

Expand Down Expand Up @@ -100,11 +99,11 @@ public void onboardingAggregator(@RequestBody @Valid OnboardingUserDto request)
@PostMapping(value = "/check-manager")
@ResponseStatus(HttpStatus.OK)
@ApiOperation(value = "", notes = "${swagger.onboarding.users.api.check-manager}", nickname = "checkManager")
public Map<String, Boolean> checkManager(@RequestBody @Valid OnboardingUserDto request) {
public CheckManagerResponse checkManager(@RequestBody @Valid OnboardingUserDto request) {
log.trace("onboarding start");
boolean checkManager = userService.checkManager(onboardingResourceMapper.toEntity(request));
log.trace("onboarding end");
return Collections.singletonMap("result", checkManager);
return new CheckManagerResponse(checkManager);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package it.pagopa.selfcare.onboarding.web.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@Data
public class CheckManagerResponse {
@ApiModelProperty(value = "${swagger.user.check-manager.model.response}", required = true)
@JsonProperty(required = true)
private boolean response;

public CheckManagerResponse(boolean response) {
this.response = response;
}
}
1 change: 1 addition & 0 deletions web/src/main/resources/swagger/swagger_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,5 @@ swagger.onboarding.institutions.model.additionalInformations.otherNote=Other not
swagger.onboarding.institutions.model.aggregates=List of Aggregate Institutions, not empty only if isAggregator field's value is True
swagger.onboarding.institutions.model.isAggregator=specified if given institution is an Aggregator

swagger.user.check-manager.model.response=Is the given user manager of the institution

0 comments on commit 5f8592e

Please sign in to comment.