Skip to content

Commit

Permalink
Merge pull request #240 from M3nin0/dev
Browse files Browse the repository at this point in the history
records: include icon-disclaimer fields in awards
  • Loading branch information
M3nin0 authored Dec 5, 2024
2 parents ac4e21e + cd9e097 commit dc6b5c4
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 2 deletions.
31 changes: 31 additions & 0 deletions geo_rdm_records/base/services/schemas/funding.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2022 Geo Secretariat.
#
# geo-rdm-records is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.

"""GEO RDM Records Funding schema definition."""

from invenio_rdm_records.services.schemas.metadata import (
FundingSchema as BaseFundingSchema,
)
from invenio_vocabularies.contrib.awards.schema import (
AwardRelationSchema as BaseAwardRelationSchema,
)
from marshmallow import fields
from marshmallow_utils.fields import SanitizedUnicode


class AwardRelationSchema(BaseAwardRelationSchema):
"""Award schema with support to icon and disclaimer."""

# ToDo: Review this to limit use for specific cases (e.g., EU projects)
icon = SanitizedUnicode(required=False)
disclaimer = SanitizedUnicode(required=False)


class FundingSchema(BaseFundingSchema):
"""Funding schema."""

award = fields.Nested(AwardRelationSchema)
3 changes: 3 additions & 0 deletions geo_rdm_records/base/services/schemas/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from marshmallow import fields, validate
from marshmallow_utils.fields import SanitizedHTML, SanitizedUnicode

from .funding import FundingSchema
from .location import FeatureSchema


Expand Down Expand Up @@ -76,6 +77,8 @@ class MetadataSchema(BaseMetadataSchema):
dump_default={"id": "knowledge", "title": {"en": "Knowledge Package"}},
)

funding = fields.List(fields.Nested(FundingSchema))

#
# Locations
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,12 @@
"items": {
"$ref": "local://definitions-v1.0.0.json#/identifiers_with_scheme"
}
},
"icon": {
"type": "string"
},
"disclaimer": {
"type": "string"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,12 @@
"type": "keyword"
}
}
},
"icon": {
"type": "text"
},
"disclaimer": {
"type": "text"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,12 @@
"type": "keyword"
}
}
},
"icon": {
"type": "text"
},
"disclaimer": {
"type": "text"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,12 @@
"items": {
"$ref": "local://definitions-v1.0.0.json#/identifiers_with_scheme"
}
},
"icon": {
"type": "string"
},
"disclaimer": {
"type": "string"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,12 @@
"type": "keyword"
}
}
},
"icon": {
"type": "text"
},
"disclaimer": {
"type": "text"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -571,8 +571,8 @@
}
}
},
"type": {
"type": "keyword"
"icon": {
"type": "text"
},
"disclaimer": {
"type": "text"
Expand Down

0 comments on commit dc6b5c4

Please sign in to comment.