Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

items: Add identifiers object list field #1205

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions invenio_app_ils/documents/jsonresolvers/document_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def items_resolver(document_pid):
"status": item.get("status"),
"description": item.get("description"),
"shelf": item.get("shelf"),
"identifiers": item.get("identifiers"),
"internal_location": {
"name": item.get("internal_location", {}).get("name", ""),
"location": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,17 @@
"shelf": {
"type": "keyword"
},
"identifiers": {
"properties": {
"description": {
"type": "text"
},
"value": {
"type": "keyword"
}
},
"type": "object"
},
"status": {
"type": "keyword"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,17 @@
"shelf": {
"type": "keyword"
},
"identifiers": {
"properties": {
"description": {
"type": "text"
},
"value": {
"type": "keyword"
}
},
"type": "object"
},
"status": {
"type": "keyword"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,17 @@
"shelf": {
"type": "keyword"
},
"identifiers": {
"properties": {
"description": {
"type": "text"
},
"value": {
"type": "keyword"
}
},
"type": "object"
},
"status": {
"type": "keyword"
}
Expand Down
2 changes: 2 additions & 0 deletions invenio_app_ils/items/loaders/jsonschemas/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
set_changed_by,
)
from invenio_app_ils.records.loaders.schemas.price import PriceSchema
from invenio_app_ils.documents.loaders.jsonschemas.document import IdentifierSchema
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identifiers schema to be moved to records.loaders (like above)



class ISBNSchema(Schema):
Expand Down Expand Up @@ -56,6 +57,7 @@ class Meta:
price = fields.Nested(PriceSchema)
shelf = fields.Str()
status = fields.Str(required=True, validate=validate.OneOf(Item.STATUSES))
identifiers = fields.List(fields.Nested(IdentifierSchema))

@pre_load
def set_changed_by(self, data, **kwargs):
Expand Down
11 changes: 11 additions & 0 deletions invenio_app_ils/items/mappings/os-v1/items/item-v1.0.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,17 @@
"shelf": {
"type": "text"
},
"identifiers": {
"properties": {
"scheme": {
"type": "keyword"
},
"value": {
"type": "keyword"
}
},
"type": "object"
},
"status": {
"type": "keyword"
}
Expand Down
11 changes: 11 additions & 0 deletions invenio_app_ils/items/mappings/os-v2/items/item-v1.0.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,17 @@
"shelf": {
"type": "text"
},
"identifiers": {
"properties": {
"scheme": {
"type": "keyword"
},
"value": {
"type": "keyword"
}
},
"type": "object"
},
"status": {
"type": "keyword"
}
Expand Down
11 changes: 11 additions & 0 deletions invenio_app_ils/items/mappings/v7/items/item-v1.0.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,17 @@
"shelf": {
"type": "text"
},
"identifiers": {
"properties": {
"scheme": {
"type": "keyword"
},
"value": {
"type": "keyword"
}
},
"type": "object"
},
"status": {
"type": "keyword"
}
Expand Down
22 changes: 22 additions & 0 deletions invenio_app_ils/items/schemas/items/item-v1.0.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,28 @@
"type": "string",
"title": "The shelf location of this Item"
},
"identifiers": {
"items": {
"additionalProperties": false,
"properties": {
"scheme": {
"type": "string",
"title": "Type of identification"
},
"value": {
"minLength": 1,
"type": "string",
"title": "Scheme's value"
}
},
"required": ["scheme", "value"],
"title": "Identifiers",
"type": "object"
},
"title": "List of Identifiers",
"type": "array",
"uniqueItems": true
},
"status": {
"type": "string",
"title": "The current status of this Item"
Expand Down