-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MODINVSTOR-1221 Implement Subject types management (#1050)
* MODINVSTOR-1221 Implement Subject types management * fix checkstyle * fix checkstyle * fix checkstyle * add tests * add perms into descriptors * update descriptor * Update ramls/examples/subjecttypes.json Co-authored-by: Pavlo Smahin <[email protected]> * Update ramls/subject-type.raml Co-authored-by: Pavlo Smahin <[email protected]> * Update ramls/subject-type.raml Co-authored-by: Pavlo Smahin <[email protected]> * small fixes * add validations * remove redundant lines * Update descriptors/ModuleDescriptor-template.json Co-authored-by: Ruslan Lavrov <[email protected]> * Update ramls/subject-type.raml Co-authored-by: Ruslan Lavrov <[email protected]> --------- Co-authored-by: Pavlo Smahin <[email protected]> Co-authored-by: Ruslan Lavrov <[email protected]> (cherry picked from commit 3c619cf)
- Loading branch information
1 parent
1bb14cc
commit 294c477
Showing
21 changed files
with
486 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"id": "535e3160-763a-42f9-b0c0-d8ed7df6e2a2", | ||
"name": "Personal name", | ||
"source": "folio" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"subjectTypes": [ | ||
{ | ||
"id": "06b2cbd8-66bf-4956-9d90-97c9776365b8", | ||
"name": "Personal name", | ||
"source": "folio" | ||
}, | ||
{ | ||
"id": "f9e5b41b-8d5b-47d3-91d0-ca9004796400", | ||
"name": "Occupation", | ||
"source": "folio" | ||
}, | ||
{ | ||
"id": "6e09d47d-95e2-4d8a-831b-f777b8ef6d99", | ||
"name": "Phone number", | ||
"source": "local" | ||
} | ||
], | ||
"totalRecords": 3 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#%RAML 1.0 | ||
title: Subject Types API | ||
version: v1.0 | ||
protocols: [ HTTP, HTTPS ] | ||
baseUri: http://localhost | ||
|
||
documentation: | ||
- title: Subject Types API | ||
content: This documents the API calls that can be made to query and manage subject types | ||
|
||
types: | ||
subjectType: !include subject-type.json | ||
subjectTypes: !include subject-types.json | ||
errors: !include raml-util/schemas/errors.schema | ||
|
||
traits: | ||
pageable: !include raml-util/traits/pageable.raml | ||
searchable: !include raml-util/traits/searchable.raml | ||
validate: !include raml-util/traits/validation.raml | ||
|
||
resourceTypes: | ||
collection: !include raml-util/rtypes/collection.raml | ||
collection-item: !include raml-util/rtypes/item-collection.raml | ||
get-delete-only: !include raml-util/rtypes/get-delete.raml | ||
|
||
/subject-types: | ||
type: | ||
collection: | ||
exampleCollection: !include examples/subject-types.json | ||
exampleItem: !include examples/subject-type.json | ||
schemaCollection: subjectTypes | ||
schemaItem: subjectType | ||
get: | ||
is: [ | ||
searchable: {description: "with valid searchable fields", example: "name=aaa"}, | ||
pageable | ||
] | ||
description: Return a list of subject types | ||
post: | ||
description: Create a new subject type | ||
is: [validate] | ||
/{subjectTypeId}: | ||
description: Pass in the subject type id | ||
type: | ||
collection-item: | ||
exampleItem: !include examples/subject-type.json | ||
schema: subjectType |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"description": "A collection of subject types", | ||
"type": "object", | ||
"properties": { | ||
"subjectTypes": { | ||
"description": "List of subject types", | ||
"id": "subjectType", | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"$ref": "subject-type.json" | ||
} | ||
}, | ||
"totalRecords": { | ||
"description": "Estimated or exact total number of records", | ||
"type": "integer" | ||
} | ||
}, | ||
"required": [ | ||
"subjectTypes", | ||
"totalRecords" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/main/java/org/folio/persist/SubjectTypeRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package org.folio.persist; | ||
|
||
import static org.folio.rest.persist.PgUtil.postgresClient; | ||
import static org.folio.services.subjecttype.SubjectTypeService.SUBJECT_TYPE; | ||
|
||
import io.vertx.core.Context; | ||
import java.util.Map; | ||
import org.folio.rest.jaxrs.model.SubjectType; | ||
|
||
public class SubjectTypeRepository extends AbstractRepository<SubjectType> { | ||
|
||
public SubjectTypeRepository(Context context, Map<String, String> okapiHeaders) { | ||
super(postgresClient(context, okapiHeaders), SUBJECT_TYPE, SubjectType.class); | ||
} | ||
} |
Oops, something went wrong.