Skip to content

Commit

Permalink
metadata: add internal notes
Browse files Browse the repository at this point in the history
  • Loading branch information
kpsherva authored and zzacharo committed Nov 8, 2024
1 parent 0fb18b6 commit 87bc8e3
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
16 changes: 16 additions & 0 deletions invenio_rdm_records/records/jsonschemas/records/record-v6.0.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,22 @@
}
}
}
},
"_internal_notes": {
"properties": {
"note": {
"type": "string"
},
"timestamp": {
"type": "string",
"description": "ISO8601 formatted timestamp in UTC.",
"format": "date-time"
},
"user": {
"type": "string",
"description": "User id of the person who created the note"
}
}
}
}
},
Expand Down
14 changes: 12 additions & 2 deletions invenio_rdm_records/services/schemas/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# it under the terms of the MIT License; see LICENSE file for more details.

"""RDM record schemas."""

from datetime import timezone
from functools import partial
from urllib import parse

Expand All @@ -35,11 +35,13 @@
EDTFDateTimeString,
IdentifierSet,
SanitizedHTML,
SanitizedUnicode,
SanitizedUnicode, TZDateTime,
)
from marshmallow_utils.schemas import GeometryObjectSchema, IdentifierSchema
from werkzeug.local import LocalProxy

from invenio_rdm_records.services.schemas.parent.access import Agent

record_personorg_schemes = LocalProxy(
lambda: current_app.config["RDM_RECORDS_PERSONORG_SCHEMES"]
)
Expand Down Expand Up @@ -351,6 +353,13 @@ class FeatureSchema(Schema):
features = fields.List(fields.Nested(LocationSchema))


class InternalNoteSchema(Schema):
"""Schema for internal notes."""
timestamp = TZDateTime(timezone=timezone.utc, format="iso", dump_only=True)
user = fields.Nested(Agent, dump_only=True)
note = SanitizedUnicode()


class MetadataSchema(Schema):
"""Schema for the record metadata."""

Expand Down Expand Up @@ -389,3 +398,4 @@ class MetadataSchema(Schema):
locations = fields.Nested(FeatureSchema)
funding = fields.List(fields.Nested(FundingSchema))
references = fields.List(fields.Nested(ReferenceSchema))
_internal_notes = fields.List(fields.Nested(InternalNoteSchema))
2 changes: 0 additions & 2 deletions invenio_rdm_records/services/schemas/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,11 @@ class Meta:
access = NestedAttribute(AccessSchema)
files = NestedAttribute(FilesSchema)
media_files = NestedAttribute(FilesSchema)
# notes = fields.List(fields.Nested(InternalNoteSchema))
revision = fields.Integer(dump_only=True)
versions = NestedAttribute(VersionsSchema, dump_only=True)
parent = NestedAttribute(RDMParentSchema)
is_published = fields.Boolean(dump_only=True)
status = fields.String(dump_only=True)

tombstone = fields.Nested(TombstoneSchema, dump_only=True)
deletion_status = fields.Nested(DeletionStatusSchema, dump_only=True)

Expand Down

0 comments on commit 87bc8e3

Please sign in to comment.