This commit is contained in:
Filip Izydorczyk 2020-12-18 16:33:58 +01:00
parent ce0d63d7f9
commit 4a12dceab6
5 changed files with 22 additions and 24 deletions

View File

@ -24,14 +24,10 @@ public class Swagger2Config extends WebMvcConfigurationSupport {
@Bean @Bean
public Docket createRestApi() { public Docket createRestApi() {
Parameter authHeader = new ParameterBuilder() Parameter authHeader = new ParameterBuilder().parameterType("header").name("Authorization")
.parameterType("header") .modelRef(new ModelRef("string")).build();
.name("Authorization")
.modelRef(new ModelRef("string"))
.build();
return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select() return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select()
.apis(RequestHandlerSelectors.basePackage("com.plannaplan")).paths(PathSelectors.any()) .apis(RequestHandlerSelectors.basePackage("com.plannaplan")).paths(PathSelectors.any()).build()
.build()
.globalOperationParameters(Collections.singletonList(authHeader)); .globalOperationParameters(Collections.singletonList(authHeader));
} }

View File

@ -64,8 +64,8 @@ public class GroupController {
@PutMapping("/{id}/capacity") @PutMapping("/{id}/capacity")
@ApiOperation(value = "Change capacity of given group. You need to provide DEANERY token to be ale to change capacity") @ApiOperation(value = "Change capacity of given group. You need to provide DEANERY token to be ale to change capacity")
public ResponseEntity<String> updateCapacity( public ResponseEntity<String> updateCapacity(
@PathVariable(name = "id") @ApiParam(value = "id of group to change capacity") Long id, @PathVariable(name = "id", required = true) @ApiParam(value = "id of group to change capacity") Long id,
@RequestParam(name = "newcapacity") @ApiParam(value = "capacity to be set") int newcapacity) { @RequestParam(name = "newcapacity", required = true) Integer newcapacity) {
final Groups group = this.groupService.getGroupById(id).get(); final Groups group = this.groupService.getGroupById(id).get();
if (group == null) { if (group == null) {
return new ResponseEntity<>("Given group doens't exist", HttpStatus.NOT_FOUND); return new ResponseEntity<>("Given group doens't exist", HttpStatus.NOT_FOUND);

View File

@ -8,6 +8,7 @@ spring.jpa.hibernate.ddl-auto=create-drop
spring.jackson.serialization.fail-on-empty-beans=false spring.jackson.serialization.fail-on-empty-beans=false
spring.main.allow-bean-definition-overriding=true spring.main.allow-bean-definition-overriding=true
spring.jackson.default-property-inclusion = NON_NULL spring.jackson.default-property-inclusion = NON_NULL
logging.level.io.swagger.models.parameters.AbstractSerializableParameter=ERROR
server.port=1285 server.port=1285
plannaplan.dev = true plannaplan.dev = true
plannaplan.frontendUrl= http://localhost:3000 plannaplan.frontendUrl= http://localhost:3000

View File

@ -8,6 +8,7 @@ spring.jpa.hibernate.ddl-auto=update
spring.jackson.serialization.fail-on-empty-beans=false spring.jackson.serialization.fail-on-empty-beans=false
spring.main.allow-bean-definition-overriding=true spring.main.allow-bean-definition-overriding=true
spring.jackson.default-property-inclusion = NON_NULL spring.jackson.default-property-inclusion = NON_NULL
logging.level.io.swagger.models.parameters.AbstractSerializableParameter=ERROR
server.port=1285 server.port=1285