Skip to content

Commit

Permalink
Merge pull request #88 from virtualidentityag/develop
Browse files Browse the repository at this point in the history
Sync develop from saas to OS
  • Loading branch information
mebo4b authored Jun 22, 2022
2 parents 30b886f + b251faf commit 3f3ee0a
Show file tree
Hide file tree
Showing 63 changed files with 1,638 additions and 343 deletions.
55 changes: 54 additions & 1 deletion api/agencyadminservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ paths:
schema:
type: integer
example: 20
- name: sort
in: query
description: The sort parameter containing field and order the response should be sorted
schema:
$ref: '#/components/schemas/Sort'
responses:
200:
description: OK - successfull operation
Expand Down Expand Up @@ -436,7 +441,24 @@ components:
$ref: '#/components/schemas/SearchResultLinks'
total:
type: integer

TopicDTO:
type: object
properties:
id:
type: long
example: 12132
name:
type: string
example: "Topic name"
description:
type: string
example: "Description"
internalIdentifier:
type: string
example: "identifier for data exports for example: alcohol"
status:
type: string
example: "Active"
AgencyAdminResponseDTO:
type: object
properties:
Expand Down Expand Up @@ -487,6 +509,10 @@ components:
external:
type: boolean
example: false
topics:
type: array
items:
$ref: '#/components/schemas/TopicDTO'
createDate:
type: string
example: "2019-08-23T08:52:05"
Expand Down Expand Up @@ -583,6 +609,10 @@ components:
external:
type: boolean
example: false
topicIds:
type: array
items:
type: long

AgencyAdminFullResponseDTO:
type: object
Expand Down Expand Up @@ -634,6 +664,10 @@ components:
external:
type: boolean
example: false
topicIds:
type: array
items:
type: long

UpdateAgencyResponseDTO:
type: object
Expand Down Expand Up @@ -716,6 +750,25 @@ components:
postcodeRanges:
$ref: '#/components/schemas/HalLink'

Sort:
type: object
properties:
field:
type: string
example: 'name|description|postcode|city|teamAgency'
enum:
- 'name'
- 'description'
- 'postCode'
- 'city'
- 'teamAgency'
order:
type: string
example: 'ASC|DESC'
enum:
- 'ASC'
- 'DESC'

securitySchemes:
Bearer:
type: apiKey
Expand Down
8 changes: 8 additions & 0 deletions api/agencyservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ paths:
type: integer
format: int32
example: 5
- name: topicId
in: query
required: false
description: The main topic of the registration form
schema:
type: integer
format: int32
example: 7
responses:
200:
description: OK - successfull operation
Expand Down
25 changes: 25 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,31 @@
</modelPackage>
</configuration>
</execution>
<execution>
<id>topic-service-client-model</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<configOptions>
<sourceFolder>/</sourceFolder>
<library>resttemplate</library>
<dateLibrary>java8</dateLibrary>
</configOptions>
<inputSpec>${project.basedir}/services/topicservice.yaml</inputSpec>
<generatorName>java</generatorName>
<generateApis>true</generateApis>
<generateApiTests>false</generateApiTests>
<generateModelTests>false</generateModelTests>
<apiPackage>
${project.groupId}.${project.artifactId}.topicservice.generated.web
</apiPackage>
<modelPackage>
${project.groupId}.${project.artifactId}.topicservice.generated.web.model
</modelPackage>
</configuration>
</execution>
</executions>
</plugin>
<!-- Liquibase Maven plugin -->
Expand Down
147 changes: 147 additions & 0 deletions services/topicservice.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
openapi: 3.0.1

info:
title: Definition for Topic API
description: This information will be replaced by the SpringFox config information
version: 0.0.1

paths:
/topic:
post:
tags:
- topic-controller
summary: 'Creates a new topic [Authorization: Role: topic-admin]'
operationId: createTopic
requestBody:
content:
'application/json':
schema:
$ref: '#/components/schemas/TopicDTO'
responses:
200:
description: OK - successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/TopicDTO'
400:
description: BAD REQUEST - invalid/incomplete request or body object
401:
description: UNAUTHORIZED - no/invalid Keycloak token
500:
description: INTERNAL SERVER ERROR - server encountered unexpected condition
get:
tags:
- topic-controller
summary: 'Get all topics'
operationId: getAllTopics
responses:
200:
description: OK - successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/TopicDTO'
204:
description: NO CONTENT - no content found
400:
description: BAD REQUEST - invalid/incomplete request or body object
401:
description: UNAUTHORIZED - no/invalid Keycloak token
500:
description: INTERNAL SERVER ERROR - server encountered unexpected condition
/topic/{id}:
summary: Represents a topic
description: This resource represents an individual topic in a system.
get:
tags:
- topic-controller
summary: 'Gets a topic by its id [Not yet implemented]'
operationId: getTopicById
parameters:
- name: id
in: path
description: Topic ID
required: true
schema:
type: integer
format: int64
responses:
200:
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/TopicDTO'
400:
description: BAD REQUEST - invalid/incomplete request or body object
401:
description: UNAUTHORIZED - no/invalid Keycloak token
404:
description: Not found
500:
description: INTERNAL SERVER ERROR - server encountered unexpected condition
put:
tags:
- topic-controller
summary: 'Updates a topic [Authorization: Role: topic-admin] [Not yet implemented]'
operationId: updateTopic
parameters:
- name: id
in: path
description: Topic ID
required: true
schema:
type: integer
format: int64
requestBody:
content:
'application/json':
schema:
$ref: '#/components/schemas/TopicDTO'
responses:
200:
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/TopicDTO'
401:
description: UNAUTHORIZED - no/invalid Keycloak token
409:
description: CONFLICT - unique constraint validation fails
500:
description: INTERNAL SERVER ERROR - server encountered unexpected condition
components:
schemas:
TopicDTO:
type: object
required:
- name
- description
properties:
id:
type: long
example: 12132
name:
type: string
example: "Topic name"
maxLength: 100
description:
type: string
example: "Description"
maxLength: 200
internalIdentifier:
type: string
example: "identifier for data exports for example: alcohol"
maxLength: 50
status:
type: string
example: "Active"
maxLength: 10
createDate:
type: string
updateDate:
type: string
23 changes: 23 additions & 0 deletions services/useradminservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ paths:
required: true
schema:
type: integer
- name: sort
in: query
description: The sort parameter containing field and order the response should be sorted
schema:
$ref: '#/components/schemas/Sort'
responses:
200:
description: OK - successfull operation
Expand Down Expand Up @@ -668,6 +673,24 @@ components:
absent:
type: boolean

Sort:
type: object
properties:
field:
type: string
example: 'firstName|lastName|username|email'
enum:
- 'firstName'
- 'lastName'
- 'username'
- 'email'
order:
type: string
example: 'ASC|DESC'
enum:
- 'ASC'
- 'DESC'

ConsultantAgencyAdminResultDTO:
type: object
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public ResponseEntity<Object> handleInternal(
return handleExceptionInternal(
ex,
null,
new HttpHeaders(),
new CustomHttpHeader(ex.getHttpStatusExceptionReason()).buildHeader(),
HttpStatus.CONFLICT,
request);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import de.caritas.cob.agencyservice.api.model.DioceseAdminResultDTO;
import de.caritas.cob.agencyservice.api.model.PostcodeRangeDTO;
import de.caritas.cob.agencyservice.api.model.RootDTO;
import de.caritas.cob.agencyservice.api.model.Sort;
import de.caritas.cob.agencyservice.api.model.UpdateAgencyDTO;
import de.caritas.cob.agencyservice.generated.api.admin.controller.AgencyadminApi;
import io.swagger.annotations.Api;
Expand Down Expand Up @@ -89,10 +90,11 @@ public ResponseEntity<DioceseAdminResultDTO> getDioceses(
*/
@Override
public ResponseEntity<AgencyAdminSearchResultDTO> searchAgencies(
@NotNull @Valid Integer page, @NotNull @Valid Integer perPage, @Valid String q) {
@NotNull @Valid Integer page, @NotNull @Valid Integer perPage, @Valid String q,
@Valid Sort sort) {

var agencyAdminSearchResultDTO =
this.agencyAdminSearchService.searchAgencies(q, page, perPage);
this.agencyAdminSearchService.searchAgencies(q, page, perPage, sort);

return new ResponseEntity<>(agencyAdminSearchResultDTO, HttpStatus.OK);
}
Expand All @@ -108,7 +110,7 @@ public ResponseEntity<AgencyAdminFullResponseDTO> createAgency(@Valid AgencyDTO

agencyValidator.validate(agencyDTO);
var agencyAdminFullResponseDTO = agencyAdminService
.saveAgency(agencyDTO);
.createAgency(agencyDTO);

return new ResponseEntity<>(agencyAdminFullResponseDTO, HttpStatus.CREATED);
}
Expand Down Expand Up @@ -176,7 +178,7 @@ public ResponseEntity<AgencyPostcodeRangeResponseDTO> createAgencyPostcodeRange(
/**
* Entry point to update a postcode range for the given postcode range Id.
*
* @param agencyId Postcode range Id (required)
* @param agencyId Postcode range Id (required)
* @param postcodeRangeDTO {@link PostcodeRangeDTO} (required)
* @return an entity containing the updated postcode range
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private HalLink buildSelfLink() {

private HalLink buildSearchLink() {
return buildHalLink(
methodOn(AgencyadminApi.class).searchAgencies(DEFAULT_PAGE, DEFAULT_PER_PAGE, null),
methodOn(AgencyadminApi.class).searchAgencies(DEFAULT_PAGE, DEFAULT_PER_PAGE, null, null),
MethodEnum.GET);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private HalLink buildSelfLink() {
}

private HalLink buildHalLinkForParams(Integer page, Integer perPage, String keyword) {
return buildHalLink(methodOn(AgencyadminApi.class).searchAgencies(page, perPage, keyword),
return buildHalLink(methodOn(AgencyadminApi.class).searchAgencies(page, perPage, keyword, null),
MethodEnum.GET);
}

Expand Down
Loading

0 comments on commit 3f3ee0a

Please sign in to comment.