Skip to content

Commit

Permalink
CIRCSTORE-331 Create actual-cost-record entity CRUD (#341)
Browse files Browse the repository at this point in the history
* CIRCSTORE-331 Create actual-cost-record entity CRUD

* CIRCSTORE-331 Refactor tests and change schema descriptions

* CIRCSTORE-331 Remove imports

* Fix comments

* Add required fields to the schema

* Make id not required

* CIRSTORE-331 Remove package import

* CIRCSTORE-331 Create actual cost record and tlr feature toggle job interfaces

* Rename interface

* CIRCSTORE-331 Change effective call number schema

* CIRCSTORE-331 Fix test

* Delete type ID of call number components

* CIRCSTORE-331 Rename call number field name

* CIRCSTORE-331 Change schema description]

* CIRCSTORE-331 Change descriptions in schema

* CIRCSTORE-331 Change descriptions in schema

* CIRCSTORE-331 Change descriptions in schema

* CIRCSTORE-331 Rename RAML file

* CIRCSTORE-331 Remove redundant symbol

* CIRCSTORE-331 Change raml descriptions

Co-authored-by: Roman Barannyk <[email protected]>
  • Loading branch information
Mykyta-Varenyk and roman-barannyk authored Jun 20, 2022
1 parent ab1151c commit e999beb
Show file tree
Hide file tree
Showing 13 changed files with 550 additions and 3 deletions.
63 changes: 62 additions & 1 deletion descriptors/ModuleDescriptor-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,37 @@
}
]
},
{
"id": "actual-cost-record-storage",
"version": "0.1",
"handlers": [
{
"methods": ["GET"],
"pathPattern": "/actual-cost-record-storage/actual-cost-records",
"permissionsRequired": ["actual-cost-record-storage.actual-cost-records.collection.get"]
},
{
"methods": ["GET"],
"pathPattern": "/actual-cost-record-storage/actual-cost-records/{id}",
"permissionsRequired": ["actual-cost-record-storage.actual-cost-records.item.get"]
},
{
"methods": ["POST"],
"pathPattern": "/actual-cost-record-storage/actual-cost-records",
"permissionsRequired": ["actual-cost-record-storage.actual-cost-records.item.post"]
},
{
"methods": ["PUT"],
"pathPattern": "/actual-cost-record-storage/actual-cost-records/{id}",
"permissionsRequired": ["actual-cost-record-storage.actual-cost-records.item.put"]
},
{
"methods": ["DELETE"],
"pathPattern": "/actual-cost-record-storage/actual-cost-records/{id}",
"permissionsRequired": ["actual-cost-record-storage.actual-cost-records.item.delete"]
}
]
},
{
"id": "request-preference-storage",
"version": "2.0",
Expand Down Expand Up @@ -978,7 +1009,12 @@
"tlr-feature-toggle-job-storage.tlr-feature-toggle-jobs.collection.get",
"tlr-feature-toggle-job-storage.tlr-feature-toggle-jobs.item.get",
"tlr-feature-toggle-job-storage.tlr-feature-toggle-jobs.item.put",
"tlr-feature-toggle-job-storage.tlr-feature-toggle-jobs.item.delete"
"tlr-feature-toggle-job-storage.tlr-feature-toggle-jobs.item.delete",
"actual-cost-record-storage.actual-cost-records.collection.get",
"actual-cost-record-storage.actual-cost-records.item.get",
"actual-cost-record-storage.actual-cost-records.item.post",
"actual-cost-record-storage.actual-cost-records.item.put",
"actual-cost-record-storage.actual-cost-records.item.delete"
]
},
{
Expand Down Expand Up @@ -1035,6 +1071,31 @@
"permissionName": "tlr-feature-toggle-job-storage.tlr-feature-toggle-jobs.item.delete",
"displayName": "Circulation storage - delete tlr feature toggle job",
"description": "Delete tlr feature toggle job"
},
{
"permissionName": "actual-cost-record-storage.actual-cost-records.item.post",
"displayName": "Circulation storage - post actual cost record",
"description": "Create actual cost record"
},
{
"permissionName": "actual-cost-record-storage.actual-cost-records.collection.get",
"displayName": "Circulation storage - get actual cost record collection",
"description": "Get actual cost record collection"
},
{
"permissionName": "actual-cost-record-storage.actual-cost-records.item.get",
"displayName": "Circulation storage - get actual cost record",
"description": "Get actual cost record"
},
{
"permissionName": "actual-cost-record-storage.actual-cost-records.item.put",
"displayName": "Circulation storage - put actual cost record",
"description": "Update actual cost record"
},
{
"permissionName": "actual-cost-record-storage.actual-cost-records.item.delete",
"displayName": "Circulation storage - delete actual cost record",
"description": "Delete actual cost record"
}
],
"launchDescriptor": {
Expand Down
59 changes: 59 additions & 0 deletions ramls/actual-cost-record-storage.raml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#%RAML 1.0
title: Actual Cost Record Storage
version: v0.1
protocols: [ HTTP, HTTPS ]
baseUri: http://localhost:9130

documentation:
- title: Actual cost record API
content: <b>Storage for actual cost record</b>

types:
actual-cost-record: !include actual-cost-record.json
actual-cost-records: !include actual-cost-records.json
errors: !include raml-util/schemas/errors.schema
parameters: !include raml-util/schemas/parameters.schema

traits:
language: !include raml-util/traits/language.raml
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

/actual-cost-record-storage:
/actual-cost-records:
displayName: Actual cost records
type:
collection:
exampleCollection: !include examples/actual-cost-records.json
exampleItem: !include examples/actual-cost-record.json
schemaCollection: actual-cost-records
schemaItem: actual-cost-record
get:
is: [pageable,
searchable: {description: "by using CQL",
example: "lossType=\"Aged to lost\""}
]
post:
is: [validate]
body:
application/json:
type: actual-cost-record
/{id}:
type:
collection-item:
exampleItem: !include examples/actual-cost-record.json
schema: actual-cost-record
get:
description: "Get actual cost record"
put:
description: "Update actual cost record"
is: [validate]
delete:
description: "Delete actual cost record"
is: [language]

141 changes: 141 additions & 0 deletions ramls/actual-cost-record.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"description": "Actual cost record",
"properties": {
"id": {
"description": "Actual cost record ID",
"type": "string",
"$ref": "raml-util/schemas/uuid.schema"
},
"userId": {
"description": "ID of the patron the actual cost record was created for",
"type": "string",
"$ref": "raml-util/schemas/uuid.schema"
},
"userBarcode": {
"description": "Barcode of the patron the actual cost record was created for",
"type": "string"
},
"loanId": {
"description": "Unique ID (generated UUID) of the loan",
"type": "string",
"$ref": "raml-util/schemas/uuid.schema"
},
"itemLossType": {
"description": "Type of the item loss",
"type": "string",
"enum": [
"Aged to lost",
"Declared lost"
]
},
"dateOfLoss": {
"description": "Date and time when the item was lost",
"type": "string",
"format": "date-time"
},
"title": {
"description": "The primary title (or label) associated with the resource",
"type": "string"
},
"identifiers": {
"type": "array",
"description": "An extensible set of name-value pairs of identifiers associated with the resource",
"minItems": 0,
"items": {
"type": "object",
"properties": {
"value": {
"type": "string",
"description": "Resource identifier value"
},
"identifierTypeId": {
"type": "string",
"description": "UUID of resource identifier type (e.g. ISBN, ISSN, LCCN, CODEN, Locally defined identifiers)",
"$ref": "raml-util/schemas/uuid.schema"
}
},
"additionalProperties": false,
"required": [
"value",
"identifierTypeId"
]
}
},
"itemBarcode": {
"description": "Barcode of the lost item",
"type": "string"
},
"loanType": {
"description": "Loan type of the lost item",
"type": "string"
},
"effectiveCallNumberComponents": {
"type": "object",
"description": "Elements of a full call number generated from the item or holding",
"properties": {
"callNumber": {
"type": "string",
"description": "Effective Call Number is an identifier assigned to an item or its holding and associated with the item.",
"readonly": true
},
"prefix": {
"type": "string",
"description": "Effective Call Number Prefix is the prefix of the identifier assigned to an item or its holding and associated with the item.",
"readonly": true
},
"suffix": {
"type": "string",
"description": "Effective Call Number Suffix is the suffix of the identifier assigned to an item or its holding and associated with the item.",
"readonly": true
}
}
},
"permanentItemLocation": {
"description": "Permanent item location of the lost item",
"type": "string"
},
"feeFineOwnerId": {
"description": "Fee/fine owner ID",
"type": "string",
"$ref": "raml-util/schemas/uuid.schema"
},
"feeFineOwner": {
"description": "Fee/fine owner name",
"type": "string"
},
"feeFineTypeId": {
"description": "Fee/fine type ID",
"type": "string",
"$ref": "raml-util/schemas/uuid.schema"
},
"feeFineType": {
"description": "Fee/fine type name",
"type": "string"
},
"metadata": {
"description": "Metadata about creation and changes, provided by the server (client should not provide)",
"type": "object",
"$ref": "raml-util/schemas/metadata.schema"
}
},
"additionalProperties": false,
"required": [
"userId",
"userBarcode",
"loanId",
"itemLossType",
"dateOfLoss",
"title",
"identifiers",
"itemBarcode",
"loanType",
"effectiveCallNumberComponents",
"permanentItemLocation",
"feeFineOwnerId",
"feeFineOwner",
"feeFineTypeId",
"feeFineType"
]
}
24 changes: 24 additions & 0 deletions ramls/actual-cost-records.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Collection of Actual cost records",
"type": "object",
"properties": {
"actualCostRecords": {
"description": "List of Actual cost records",
"id": "actualCostRecords",
"type": "array",
"items": {
"type": "object",
"$ref": "actual-cost-record.json"
}
},
"totalRecords": {
"type": "integer"
}
},
"required": [
"actualCostRecords",
"totalRecords"
]
}

27 changes: 27 additions & 0 deletions ramls/examples/actual-cost-record.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"id": "89105c06-dbdb-4aa0-9695-d4d19c733270",
"userId": "88805c06-dbdb-4aa0-9695-d4d19c733221",
"userBarcode": "777",
"loanId": "98805c06-dbdb-4aa0-9695-d4d19c733221",
"itemLossType": "Aged to lost",
"dateOfLoss": "2022-01-01T22:25:37Z",
"title": "Test Title",
"identifiers": [
{
"identifierTypeId": "8261054f-be78-422d-bd51-4ed9f33c3422",
"value": "9781466636897"
}
],
"itemBarcode": "888",
"loanType": "Can Circulate",
"effectiveCallNumber": {
"callNumber": "TX809.M17J66",
"suffix": "1993",
"prefix": "f"
},
"permanentItemLocation": "UC/HP/JCL/Sci",
"feeFineOwnerId": "88805c06-dbdb-4aa0-9695-d4d19c733221",
"feeFineOwner": "Main circ desk",
"feeFineTypeId": "88805c06-dbdb-4aa0-9695-d4d19c733221",
"feeFineType": "Lost Item fee (actual cost)"
}
32 changes: 32 additions & 0 deletions ramls/examples/actual-cost-records.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"actualCostRecords" : [
{
"id": "89105c06-dbdb-4aa0-9695-d4d19c733270",
"userId": "88805c06-dbdb-4aa0-9695-d4d19c733221",
"userBarcode": "777",
"loanId": "98805c06-dbdb-4aa0-9695-d4d19c733221",
"itemLossType": "Aged to lost",
"dateOfLoss": "2022-01-01T22:25:37Z",
"title": "Test Title",
"identifiers": [
{
"identifierTypeId": "8261054f-be78-422d-bd51-4ed9f33c3422",
"value": "9781466636897"
}
],
"itemBarcode": "888",
"loanType": "Can Circulate",
"effectiveCallNumber": {
"callNumber": "TX809.M17J66",
"suffix": "1993",
"prefix": "f"
},
"permanentItemLocation": "UC/HP/JCL/Sci",
"feeFineOwnerId": "88805c06-dbdb-4aa0-9695-d4d19c733221",
"feeFineOwner": "Main circ desk",
"feeFineTypeId": "88805c06-dbdb-4aa0-9695-d4d19c733221",
"feeFineType": "Lost Item fee (actual cost)"
}
],
"totalRecords": 1
}
Loading

0 comments on commit e999beb

Please sign in to comment.