From f2ceb5f4d0ad276d2329e84c4bd4d53a4e056eb2 Mon Sep 17 00:00:00 2001 From: Katy Baulch <46493669+katybaulch@users.noreply.github.com> Date: Mon, 29 Apr 2024 17:46:09 +0100 Subject: [PATCH] Feature/pdct 1056 add corpus title to family read dto (#128) * Turn off B rules in ruff * Add corpus_id and corpus_type to Family read DTO * Rename function to create_family_read_dto & add corpus fields to family read dto helper * Bump poetry to 1.7.1, update lockfile & bump pypackage version to 2.4.1 * Bump pypackage version to 2.4.0 * Revert "Bump pypackage version to 2.4.0" This reverts commit c5a384eb2e8da0fe745212af6fcdb657428a9924. * Add corpus title to family read DTO --- app/model/family.py | 1 + app/repository/family.py | 1 + pyproject.toml | 2 +- tests/helpers/family.py | 1 + tests/integration_tests/setup_db.py | 3 +++ 5 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/model/family.py b/app/model/family.py index 7c81073c..b63b6f92 100644 --- a/app/model/family.py +++ b/app/model/family.py @@ -24,6 +24,7 @@ class FamilyReadDTO(BaseModel): collections: list[str] organisation: str corpus_id: str + corpus_title: str corpus_type: str created: datetime last_modified: datetime diff --git a/app/repository/family.py b/app/repository/family.py index 0bd1c33b..7e9e585f 100644 --- a/app/repository/family.py +++ b/app/repository/family.py @@ -79,6 +79,7 @@ def _family_to_dto( ], organisation=org, corpus_id=cast(str, corpus.import_id), + corpus_title=cast(str, corpus.title), corpus_type=cast(str, corpus.corpus_type_name), created=cast(datetime, fam.created), last_modified=cast(datetime, fam.last_modified), diff --git a/pyproject.toml b/pyproject.toml index cbe17abc..f5329c70 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "admin_backend" -version = "2.4.0" +version = "2.4.1" description = "" authors = ["CPR-dev-team "] packages = [{ include = "app" }, { include = "tests" }] diff --git a/tests/helpers/family.py b/tests/helpers/family.py index 851451ad..9e9db6fa 100644 --- a/tests/helpers/family.py +++ b/tests/helpers/family.py @@ -38,6 +38,7 @@ def create_family_read_dto( collections=collections, organisation="CCLW", corpus_id="CCLW.corpus.i00000001.n0000", + corpus_title="CCLW national policies", corpus_type="Laws and Policies", created=datetime.now(), last_modified=datetime.now(), diff --git a/tests/integration_tests/setup_db.py b/tests/integration_tests/setup_db.py index 38279bee..643ca432 100644 --- a/tests/integration_tests/setup_db.py +++ b/tests/integration_tests/setup_db.py @@ -36,6 +36,7 @@ "metadata": {"size": [3], "color": ["red"]}, "organisation": "CCLW", "corpus_id": "CCLW.corpus.i00000001.n0000", + "corpus_title": "CCLW national policies", "corpus_type": "Laws and Policies", "slug": "Slug1", "events": ["E.0.0.1", "E.0.0.2"], @@ -54,6 +55,7 @@ "metadata": {"size": [4], "color": ["green"]}, "organisation": "CCLW", "corpus_id": "CCLW.corpus.i00000001.n0000", + "corpus_title": "CCLW national policies", "corpus_type": "Laws and Policies", "slug": "Slug2", "events": [], @@ -72,6 +74,7 @@ "metadata": {"size": [100], "color": ["blue"]}, "organisation": "CCLW", "corpus_id": "CCLW.corpus.i00000001.n0000", + "corpus_title": "CCLW national policies", "corpus_type": "Laws and Policies", "slug": "Slug3", "events": ["E.0.0.3"],