Skip to content

Commit

Permalink
feat(instance-date-types): implement instance-date-types endpoint
Browse files Browse the repository at this point in the history
Closes: MODINVSTOR-1235
  • Loading branch information
psmagin committed Jul 23, 2024
1 parent 6525b40 commit 2dfa933
Show file tree
Hide file tree
Showing 30 changed files with 653 additions and 2 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Required sourceId field in holdings record ([MODINVSTOR-1161](https://folio-org.atlassian.net/browse/MODINVSTOR-1161))

### New APIs versions
* Provides `instance-date-types 1.0`
* Provides `instance-storage 10.1`
* Requires `holdings-storage 6.1`

Expand All @@ -13,6 +14,7 @@
* Implement domain event production for campus create/update/delete ([MODINVSTOR-1217](https://issues.folio.org/browse/MODINVSTOR-1217))
* Implement domain event production for institution create/update/delete ([MODINVSTOR-1218](https://issues.folio.org/browse/MODINVSTOR-1218))
* Implement a POST request to get Holdings and Instances ([MODINVSTOR-1223](https://folio-org.atlassian.net/browse/MODINVSTOR-1223))
* Implement instance-date-types endpoint ([MODINVSTOR-1235](https://folio-org.atlassian.net/browse/MODINVSTOR-1235))

### Bug fixes
* Unintended update of instance records \_version (optimistic locking) whenever any of its holdings or items are created, updated or deleted. ([MODINVSTOR-1186](https://folio-org.atlassian.net/browse/MODINVSTOR-1186))
Expand Down
30 changes: 28 additions & 2 deletions descriptors/ModuleDescriptor-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,21 @@
}
]
},
{
"id": "instance-date-types",
"version": "1.0",
"handlers": [
{
"methods": ["GET"],
"pathPattern": "/instance-date-types",
"permissionsRequired": ["inventory-storage.instance-date-types.collection.get"]
}, {
"methods": ["PATCH"],
"pathPattern": "/instance-date-types/{id}",
"permissionsRequired": ["inventory-storage.instance-date-types.item.patch"]
}
]
},
{
"id": "item-storage-batch-sync",
"version": "1.0",
Expand Down Expand Up @@ -2458,7 +2473,16 @@
"displayName": "inventory storage - submit migration job",
"description": "submit migration instance job"
},

{
"permissionName": "inventory-storage.instance-date-types.collection.get",
"displayName": "inventory storage - get list of instance-date-types",
"description": "get list of instance-date-types"
},
{
"permissionName": "inventory-storage.instance-date-types.item.patch",
"displayName": "inventory storage - patch instance-date-type",
"description": "patch instance-date-type"
},
{
"permissionName": "inventory-storage.all",
"displayName": "inventory storage module - all permissions",
Expand Down Expand Up @@ -2687,7 +2711,9 @@
"inventory-storage.migration.job.item.delete",
"inventory-storage.migration.job.post",
"inventory-storage.migration.job.item.get",
"inventory-storage.migration.item.get"
"inventory-storage.migration.item.get",
"inventory-storage.instance-date-types.collection.get",
"inventory-storage.instance-date-types.item.patch"
]
}
],
Expand Down
3 changes: 3 additions & 0 deletions ramls/examples/instance-date-types/instanceDateTypePatch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name": "new name"
}
25 changes: 25 additions & 0 deletions ramls/examples/instance-date-types/instanceDateTypes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"instanceDateTypes": [
{
"id": "c0b423e1-a885-4c09-a965-4d6979a97e53",
"name": "Detailed date",
"code": "e",
"displayFormat": {
"delimiter": ",",
"keepDelimiter": true
},
"source": "folio"
},
{
"id": "2a0915ff-7246-463b-96a4-4473cd027c6b",
"name": "Range of years of bulk of collection",
"code": "k",
"displayFormat": {
"delimiter": "-",
"keepDelimiter": false
},
"source": "folio"
}
],
"totalRecords": 2
}
84 changes: 84 additions & 0 deletions ramls/instance-date-type.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#%RAML 1.0
title: Inventory Storage Instance Date Type API
version: v1.0
protocols: [ HTTP, HTTPS ]
baseUri: http://localhost

traits:
pageable: !include raml-util/traits/pageable.raml
searchable: !include raml-util/traits/searchable.raml
validate: !include raml-util/traits/validation.raml

types:
instanceDateTypes: !include instance-date-types/instanceDateTypes.json
instanceDateTypePatch: !include instance-date-types/instanceDateTypePatch.json
errors: !include raml-util/schemas/errors.schema

/instance-date-types:
displayName: Instances Date Types API
get:
description: Retrieve a list of instances date type items.
is: [
searchable: {description: "with valid searchable fields", example: "code=a"},
pageable
]
responses:
200:
description: "Returns a list of instances date type items"
body:
application/json:
type: instanceDateTypes
example:
strict: false
value: examples/instance-date-types/instanceDateTypes.json
400:
description: "Bad request, e.g. malformed request body or query parameter. Details of the error (e.g. name of the parameter or line/character number with malformed data) provided in the response."
body:
text/plain:
example: "unable to list instances date type -- malformed parameter 'query', syntax error at column 6"
401:
description: "Not authorized to perform requested action"
body:
text/plain:
example: "unable to list instances date type -- unauthorized"
500:
description: "Internal server error, e.g. due to misconfiguration"
body:
text/plain:
example: "internal server error, contact administrator"
/{id}:
patch:
description: "Update Instances Date Type item with given id"
is: [ validate ]
body:
application/json:
type: instanceDateTypePatch
example:
strict: false
value: examples/instance-date-types/instanceDateTypePatch.json
responses:
204:
description: "Update accepted"
400:
description: "Bad request, e.g. malformed request body or query parameter. Details of the error (e.g. name of the parameter or line/character number with malformed data) provided in the response."
body:
text/plain:
example: |
"unable to list instances date type -- malformed parameter 'query', syntax error at column 6"
401:
description: "Not authorized to perform requested action"
body:
text/plain:
example: |
"unable to list instances date type -- unauthorized"
404:
description: "Item with a given ID not found"
body:
text/plain:
example: |
"instances date type not found"
500:
description: "Internal server error, e.g. due to misconfiguration"
body:
text/plain:
example: "internal server error, contact administrator"
59 changes: 59 additions & 0 deletions ramls/instance-date-types/instanceDateType.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "An instance date type that indicates the type of dates given in Date 1 and Date 2",
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Unique ID of the instance date type; a UUID",
"readonly": true
},
"name": {
"type": "string",
"description": "Name of the instance date type",
"readonly": true
},
"code": {
"type": "string",
"description": "Code of the instance date type",
"maxLength": 1,
"readonly": true
},
"displayFormat": {
"type": "object",
"description": "Describes how to format Date 1 and Date 2",
"properties": {
"delimiter": {
"type": "string",
"description": "Delimiter that will be used to format Date 1 and Date 2",
"example": ",",
"readonly": true
},
"keepDelimiter": {
"type": "boolean",
"description": "Define if formated date string should keep delimiter if one of dates is not exist",
"example": false,
"readonly": true
}
},
"readonly": true,
"additionalProperties": false
},
"source": {
"type": "string",
"description": "label indicating where the instance date type entry originates from, i.e. 'folio' or 'local'",
"enum": [
"folio",
"local"
],
"readonly": true
},
"metadata": {
"type": "object",
"$ref": "../raml-util/schemas/metadata.schema",
"readonly": true
}
},
"additionalProperties": false
}

13 changes: 13 additions & 0 deletions ramls/instance-date-types/instanceDateTypePatch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Object that represents patch operation for instance date type",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Name of the instance date type"
}
},
"additionalProperties": false
}

19 changes: 19 additions & 0 deletions ramls/instance-date-types/instanceDateTypes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "A collection of instance date types",
"type": "object",
"properties": {
"instanceDateTypes": {
"description": "List of instance date types",
"type": "array",
"items": {
"type": "object",
"$ref": "instanceDateType.json"
}
},
"totalRecords": {
"description": "Estimated or exact total number of records",
"type": "integer"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"id": "42dac21e-3c81-4cb1-9f16-9e50c81bacc4",
"name": "Continuing resource ceased publication",
"code": "d",
"displayFormat": {
"delimiter": "-",
"keepDelimiter": true
},
"source": "folio"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"id": "0750f52b-3bfc-458d-9307-e9afc8bcdffa",
"name": "Continuing resource currently published",
"code": "c",
"displayFormat": {
"delimiter": "-",
"keepDelimiter": true
},
"source": "folio"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"id": "5a1a1adb-de71-45e6-ba94-1c0838969f04",
"name": "Continuing resource status unknown",
"code": "e",
"displayFormat": {
"delimiter": "-",
"keepDelimiter": true
},
"source": "folio"
}
10 changes: 10 additions & 0 deletions reference-data/instance-date-types/date-of-distribution.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"id": "5f84208a-0aa6-4694-a58f-5310b654f012",
"name": "Date of distribution/release/issue and production/recording session when different",
"code": "p",
"displayFormat": {
"delimiter": ",",
"keepDelimiter": false
},
"source": "folio"
}
10 changes: 10 additions & 0 deletions reference-data/instance-date-types/dates-unknown.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"id": "e77bb7ed-2e53-4c62-8b06-5907b8934ba7",
"name": "Dates unknown",
"code": "n",
"displayFormat": {
"delimiter": ",",
"keepDelimiter": false
},
"source": "folio"
}
10 changes: 10 additions & 0 deletions reference-data/instance-date-types/detailed-date.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"id": "9669a463-5971-42dc-9eee-046bbd678fb1",
"name": "Detailed date",
"code": "e",
"displayFormat": {
"delimiter": ",",
"keepDelimiter": false
},
"source": "folio"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"id": "6de732c5-c29b-4a10-9db0-0729ca960f12",
"name": "Inclusive dates of collection",
"code": "i",
"displayFormat": {
"delimiter": "-",
"keepDelimiter": true
},
"source": "folio"
}
10 changes: 10 additions & 0 deletions reference-data/instance-date-types/multiple-dates.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"id": "8fa6d067-41ff-4362-96a0-96b16ddce267",
"name": "Multiple dates",
"code": "m",
"displayFormat": {
"delimiter": ",",
"keepDelimiter": false
},
"source": "folio"
}
10 changes: 10 additions & 0 deletions reference-data/instance-date-types/no-attempt-to-code.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"id": "6f8cd9a8-26ac-4df6-8709-62fe2c0d04f8",
"name": "No attempt to code",
"code": "|",
"displayFormat": {
"delimiter": ",",
"keepDelimiter": false
},
"source": "folio"
}
10 changes: 10 additions & 0 deletions reference-data/instance-date-types/no-dates.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"id": "77a09c3c-37bd-4ad3-aae4-9d86fc1b33d8",
"name": "No dates given; BC date involved",
"code": "b",
"displayFormat": {
"delimiter": ",",
"keepDelimiter": false
},
"source": "folio"
}
Loading

0 comments on commit 2dfa933

Please sign in to comment.