Skip to content

Commit

Permalink
items: add new temporary_location field
Browse files Browse the repository at this point in the history
Adds a new `temporary_location` field to get only one holdings for
serial items actually in multiple locations.

The new field is a `$ref` to a location and has an `end_date`. Currently
no logic is added to this implementation.

Co-Authored-by: Aly Badr <[email protected]>
  • Loading branch information
Aly Badr committed Jun 9, 2021
1 parent 849f754 commit e38417b
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
49 changes: 49 additions & 0 deletions rero_ils/modules/items/jsonschemas/items/item-v0.0.1.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"item_type",
"temporary_item_type",
"location",
"temporary_location",
"type",
"url",
"pac_code",
Expand Down Expand Up @@ -230,6 +231,54 @@
}
}
},
"temporary_location": {
"title": "Temporary location",
"additionalProperties": false,
"type": "object",
"propertiesOrder": [
"$ref",
"end_date"
],
"required": [
"$ref"
],
"properties": {
"$ref": {
"title": "Location URI",
"type": "string",
"pattern": "^https://ils.rero.ch/api/locations/.+?$",
"form": {
"templateOptions": {
"hideLabel": true
},
"fieldMap": "location"
}
},
"end_date": {
"title": "Deletion date",
"type": "string",
"format": "date",
"pattern": "^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$",
"form": {
"type": "datepicker",
"validation": {
"messages": {
"pattern": "Should be in the ISO 8601, YYYY-MM-DD."
}
}
}
}
},
"form": {
"templateOptions": {
"cssClass": "editor-title"
},
"hide": true,
"navigation": {
"essential": true
}
}
},
"type": {
"title": "Item type",
"type": "string",
Expand Down
13 changes: 13 additions & 0 deletions rero_ils/modules/items/mappings/v7/items/item-v0.0.1.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,19 @@
}
}
},
"temporary_location": {
"properties": {
"type": {
"type": "keyword"
},
"pid": {
"type": "keyword"
},
"end_date": {
"type": "date"
}
}
},
"library": {
"properties": {
"type": {
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_items_jsonschema.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def test_item_all_jsonschema_keys_values(
{'key': 'second_call_number', 'value': 25},
{'key': 'item_type', 'value': 25},
{'key': 'location', 'value': 25},
{'key': 'temporary_location', 'value': 25},
{'key': 'enumerationAndChronology', 'value': 25},
{'key': 'document', 'value': 25},
{'key': 'type', 'value': 25},
Expand Down

0 comments on commit e38417b

Please sign in to comment.