diff --git a/content_api/items/model.py b/content_api/items/model.py index f01373296..532ad6e97 100644 --- a/content_api/items/model.py +++ b/content_api/items/model.py @@ -143,15 +143,9 @@ class ContentAPIItem(ResourceModel, ModelWithVersions): uri: Annotated[fields.Keyword | None, validators.validate_iunique_value_async("items", "uri")] = None usageterms: str | None = None version: str | None = None - versioncreated: datetime = Field( - default_factory=datetime.now - ) - firstcreated: datetime = Field( - default_factory=datetime.now - ) - firstpublished: datetime = Field( - default_factory=datetime.now - ) + versioncreated: datetime = Field(default_factory=datetime.now) + firstcreated: datetime = Field(default_factory=datetime.now) + firstpublished: datetime = Field(default_factory=datetime.now) embargoed: datetime | None = None evolvedfrom: fields.Keyword | None = None nextversion: fields.Keyword | None = None @@ -178,9 +172,7 @@ class ContentAPIItem(ResourceModel, ModelWithVersions): agenda_id: fields.Keyword | None = None agenda_href: fields.Keyword | None = None - refs: list[ContentReference] = Field( - default_factory=list - ) + refs: list[ContentReference] = Field(default_factory=list) expiry: datetime = Field(default_factory=datetime.now) @field_validator("version", mode="before") diff --git a/tests/core/resource_model_test.py b/tests/core/resource_model_test.py index c60cc753d..bf8f4c0c5 100644 --- a/tests/core/resource_model_test.py +++ b/tests/core/resource_model_test.py @@ -82,19 +82,23 @@ def test_elastic_mapping(self): "_updated": {"type": "date"}, "_etag": {"type": "text"}, "first_name": { - "type": "text", "fields": {"keyword": {"type": "keyword"}}, + "type": "text", + "fields": {"keyword": {"type": "keyword"}}, "analyzer": "html_field_analyzer", }, "last_name": { - "type": "text", "fields": {"keyword": {"type": "keyword"}}, + "type": "text", + "fields": {"keyword": {"type": "keyword"}}, "analyzer": "html_field_analyzer", }, "email": { - "type": "text", "fields": {"keyword": {"type": "keyword"}}, + "type": "text", + "fields": {"keyword": {"type": "keyword"}}, "analyzer": "html_field_analyzer", }, "name": { - "type": "text", "fields": {"keyword": {"type": "keyword"}}, + "type": "text", + "fields": {"keyword": {"type": "keyword"}}, "analyzer": "html_field_analyzer", }, "username": {"type": "text"},