Skip to content

Commit 52b51cb

Browse files
feat: add short titles for licenses
1 parent 240058f commit 52b51cb

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

oc4ids_datastore_api/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class DatasetSQLModel(SQLModel, table=True):
1111
publisher_name: str
1212
license_url: str | None
1313
license_title: str | None
14+
license_title_short: str | None
1415
json_url: str | None
1516
csv_url: str | None
1617
xlsx_url: str | None

oc4ids_datastore_api/schemas.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class Publisher(BaseModel):
1010
class License(BaseModel):
1111
url: str | None
1212
title: str | None
13+
title_short: str | None
1314

1415

1516
class Download(BaseModel):

oc4ids_datastore_api/services.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def _transform_dataset(dataset: DatasetSQLModel) -> Dataset:
1919
license=License(
2020
url=dataset.license_url,
2121
title=dataset.license_title,
22+
title_short=dataset.license_title_short,
2223
),
2324
downloads=downloads,
2425
)

tests/test_services.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def test_get_all_datasets(mocker: MockerFixture) -> None:
1818
publisher_name="test_publisher",
1919
license_url="https://license.com",
2020
license_title="License",
21+
license_title_short="L",
2122
json_url="https://downloads/test_dataset.json",
2223
csv_url="https://downloads/test_dataset.csv",
2324
xlsx_url="https://downloads/test_dataset.xlsx",
@@ -31,7 +32,7 @@ def test_get_all_datasets(mocker: MockerFixture) -> None:
3132
loaded_at=now,
3233
source_url="https://test-dataset.json",
3334
publisher=Publisher(name="test_publisher"),
34-
license=License(title="License", url="https://license.com"),
35+
license=License(title="License", title_short="L", url="https://license.com"),
3536
downloads=[
3637
Download(format="json", url="https://downloads/test_dataset.json"),
3738
Download(format="csv", url="https://downloads/test_dataset.csv"),
@@ -52,6 +53,7 @@ def test_get_all_datasets_missing_download_formats(mocker: MockerFixture) -> Non
5253
publisher_name="test_publisher",
5354
license_url="https://license.com",
5455
license_title="License",
56+
license_title_short="L",
5557
json_url="https://downloads/test_dataset.json",
5658
csv_url=None,
5759
xlsx_url=None,
@@ -65,7 +67,7 @@ def test_get_all_datasets_missing_download_formats(mocker: MockerFixture) -> Non
6567
loaded_at=now,
6668
source_url="https://test-dataset.json",
6769
publisher=Publisher(name="test_publisher"),
68-
license=License(title="License", url="https://license.com"),
70+
license=License(title="License", title_short="L", url="https://license.com"),
6971
downloads=[
7072
Download(format="json", url="https://downloads/test_dataset.json"),
7173
],

0 commit comments

Comments
 (0)