Skip to content

Commit

Permalink
PDCT-892/upgrade_to_new_db-client (#104)
Browse files Browse the repository at this point in the history
* poetry lock

* refactor

* add new version of db-client
  • Loading branch information
asacristani authored Mar 25, 2024
1 parent e04a813 commit dae2faf
Show file tree
Hide file tree
Showing 33 changed files with 217 additions and 345 deletions.
2 changes: 1 addition & 1 deletion app/model/document.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from datetime import datetime
from typing import Optional

from db_client.models.law_policy.family import DocumentStatus
from db_client.models.dfce import DocumentStatus
from pydantic import AnyHttpUrl, BaseModel


Expand Down
2 changes: 1 addition & 1 deletion app/model/event.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from datetime import datetime
from typing import Optional

from db_client.models.law_policy.family import EventStatus
from db_client.models.dfce.family import EventStatus
from pydantic import BaseModel


Expand Down
2 changes: 1 addition & 1 deletion app/repository/app_user.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Optional, Tuple, cast

from db_client.models.app.users import AppUser, Organisation, OrganisationUser
from db_client.models.organisation import AppUser, Organisation, OrganisationUser
from sqlalchemy.orm import Session

MaybeAppUser = Optional[AppUser]
Expand Down
13 changes: 5 additions & 8 deletions app/repository/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@
from datetime import datetime
from typing import Optional, Tuple, Union, cast

from db_client.models.app.counters import CountedEntity
from db_client.models.app.users import Organisation
from db_client.models.law_policy import Collection
from db_client.models.law_policy.collection import (
CollectionFamily,
CollectionOrganisation,
)
from db_client.models.law_policy.family import Family
from db_client.models.dfce import Collection
from db_client.models.dfce.collection import CollectionFamily, CollectionOrganisation
from db_client.models.dfce.family import Family
from db_client.models.organisation.counters import CountedEntity
from db_client.models.organisation.users import Organisation
from sqlalchemy import Column, and_
from sqlalchemy import delete as db_delete
from sqlalchemy import desc, or_
Expand Down
10 changes: 5 additions & 5 deletions app/repository/config.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import logging
from typing import Any, Optional

from db_client.models.app.users import Organisation
from db_client.models.base import AnyModel
from db_client.models.document.physical_document import Language
from db_client.models.law_policy.family import (
from db_client.models.dfce.family import (
FamilyDocumentRole,
FamilyDocumentType,
FamilyEventType,
Variant,
)
from db_client.models.law_policy.geography import Geography
from db_client.models.law_policy.metadata import MetadataOrganisation, MetadataTaxonomy
from db_client.models.dfce.geography import Geography
from db_client.models.dfce.metadata import MetadataOrganisation, MetadataTaxonomy
from db_client.models.document.physical_document import Language
from db_client.models.organisation.users import Organisation
from sqlalchemy.orm import Session

from app.model.config import ConfigReadDTO, DocumentConfig, EventConfig, TaxonomyData
Expand Down
6 changes: 3 additions & 3 deletions app/repository/document.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import logging
from typing import Optional, Tuple, Union, cast

from db_client.models.app.counters import CountedEntity
from db_client.models.dfce import FamilyDocument
from db_client.models.dfce.family import DocumentStatus, Slug
from db_client.models.document.physical_document import (
Language,
LanguageSource,
PhysicalDocument,
PhysicalDocumentLanguage,
)
from db_client.models.law_policy import FamilyDocument
from db_client.models.law_policy.family import DocumentStatus, Slug
from db_client.models.organisation.counters import CountedEntity
from sqlalchemy import Column, and_
from sqlalchemy import delete as db_delete
from sqlalchemy import func
Expand Down
4 changes: 2 additions & 2 deletions app/repository/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from datetime import datetime
from typing import Optional, Tuple, Union, cast

from db_client.models.app.counters import CountedEntity
from db_client.models.law_policy import EventStatus, Family, FamilyDocument, FamilyEvent
from db_client.models.dfce import EventStatus, Family, FamilyDocument, FamilyEvent
from db_client.models.organisation.counters import CountedEntity
from sqlalchemy import Column, and_
from sqlalchemy import delete as db_delete
from sqlalchemy import or_
Expand Down
12 changes: 6 additions & 6 deletions app/repository/family.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
from datetime import datetime
from typing import Optional, Tuple, Union, cast

from db_client.models.app.counters import CountedEntity
from db_client.models.app.users import Organisation
from db_client.models.law_policy.collection import CollectionFamily
from db_client.models.law_policy.family import (
from db_client.models.dfce.collection import CollectionFamily
from db_client.models.dfce.family import (
DocumentStatus,
Family,
FamilyDocument,
FamilyOrganisation,
FamilyStatus,
Slug,
)
from db_client.models.law_policy.geography import Geography
from db_client.models.law_policy.metadata import FamilyMetadata, MetadataOrganisation
from db_client.models.dfce.geography import Geography
from db_client.models.dfce.metadata import FamilyMetadata, MetadataOrganisation
from db_client.models.organisation.counters import CountedEntity
from db_client.models.organisation.users import Organisation
from sqlalchemy import Column, and_
from sqlalchemy import delete as db_delete
from sqlalchemy import desc, or_
Expand Down
2 changes: 1 addition & 1 deletion app/repository/geography.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Optional

from db_client.models.law_policy.geography import Geography
from db_client.models.dfce.geography import Geography
from sqlalchemy.orm import Session


Expand Down
6 changes: 3 additions & 3 deletions app/repository/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
from typing import Union, cast
from uuid import uuid4

from db_client.models.app.counters import CountedEntity, EntityCounter
from db_client.models.app.users import Organisation
from db_client.models.law_policy.family import Slug
from db_client.models.dfce.family import Slug
from db_client.models.organisation.counters import CountedEntity, EntityCounter
from db_client.models.organisation.users import Organisation
from slugify import slugify
from sqlalchemy.orm import Session

Expand Down
2 changes: 1 addition & 1 deletion app/repository/metadata.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Optional

from db_client.models.law_policy.metadata import MetadataOrganisation, MetadataTaxonomy
from db_client.models.dfce.metadata import MetadataOrganisation, MetadataTaxonomy
from sqlalchemy.orm import Session

from app.model.general import Json
Expand Down
2 changes: 1 addition & 1 deletion app/repository/organisation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Optional

from db_client.models.app.users import Organisation
from db_client.models.organisation.users import Organisation
from sqlalchemy.orm import Session


Expand Down
2 changes: 1 addition & 1 deletion app/service/authorisation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from db_client.models.app.authorisation import (
from db_client.models.organisation.authorisation import (
AUTH_TABLE,
HTTP_MAP_TO_OPERATION,
AuthAccess,
Expand Down
2 changes: 1 addition & 1 deletion app/service/category.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from db_client.models.law_policy.family import FamilyCategory
from db_client.models.dfce.family import FamilyCategory

from app.errors import ValidationError

Expand Down
2 changes: 1 addition & 1 deletion integration_tests/collection/test_create.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from db_client.models.law_policy.collection import Collection
from db_client.models.dfce.collection import Collection
from fastapi import status
from fastapi.testclient import TestClient
from sqlalchemy.orm import Session
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/collection/test_delete.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from db_client.models.law_policy.collection import Collection
from db_client.models.dfce.collection import Collection
from fastapi import status
from fastapi.testclient import TestClient
from sqlalchemy.orm import Session
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/collection/test_update.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from db_client.models.law_policy.collection import (
from db_client.models.dfce.collection import (
Collection,
CollectionFamily,
CollectionOrganisation,
Expand Down
4 changes: 2 additions & 2 deletions integration_tests/document/test_create.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from db_client.models.dfce import FamilyDocument
from db_client.models.dfce.family import DocumentStatus, Slug
from db_client.models.document import PhysicalDocument
from db_client.models.document.physical_document import PhysicalDocumentLanguage
from db_client.models.law_policy import FamilyDocument
from db_client.models.law_policy.family import DocumentStatus, Slug
from fastapi import status
from fastapi.testclient import TestClient
from sqlalchemy.orm import Session
Expand Down
4 changes: 2 additions & 2 deletions integration_tests/document/test_delete.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from db_client.models.dfce import FamilyDocument
from db_client.models.dfce.family import DocumentStatus
from db_client.models.document import PhysicalDocument
from db_client.models.law_policy import FamilyDocument
from db_client.models.law_policy.family import DocumentStatus
from fastapi import status
from fastapi.testclient import TestClient
from sqlalchemy.orm import Session
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/document/test_update.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from typing import Tuple, cast

from db_client.models.dfce.family import FamilyDocument, Slug
from db_client.models.document.physical_document import (
Language,
LanguageSource,
PhysicalDocument,
PhysicalDocumentLanguage,
)
from db_client.models.law_policy.family import FamilyDocument, Slug
from fastapi import status
from fastapi.testclient import TestClient
from pydantic import AnyHttpUrl
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/event/test_create.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from db_client.models.law_policy import Family, FamilyEvent
from db_client.models.dfce import Family, FamilyEvent
from fastapi import status
from fastapi.encoders import jsonable_encoder
from fastapi.testclient import TestClient
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/event/test_delete.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from db_client.models.law_policy import FamilyEvent
from db_client.models.dfce import FamilyEvent
from fastapi import status
from fastapi.testclient import TestClient
from sqlalchemy.orm import Session
Expand Down
4 changes: 2 additions & 2 deletions integration_tests/event/test_update.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from datetime import datetime, timezone

from db_client.models.law_policy import FamilyEvent
from db_client.models.law_policy.family import EventStatus
from db_client.models.dfce import FamilyEvent
from db_client.models.dfce.family import EventStatus
from fastapi import status
from fastapi.encoders import jsonable_encoder
from fastapi.testclient import TestClient
Expand Down
6 changes: 3 additions & 3 deletions integration_tests/family/test_create.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from typing import Optional

from db_client.models.law_policy.collection import CollectionFamily
from db_client.models.law_policy.family import Family, Slug
from db_client.models.law_policy.metadata import FamilyMetadata
from db_client.models.dfce.collection import CollectionFamily
from db_client.models.dfce.family import Family, Slug
from db_client.models.dfce.metadata import FamilyMetadata
from fastapi import status
from fastapi.testclient import TestClient
from sqlalchemy.orm import Session
Expand Down
7 changes: 1 addition & 6 deletions integration_tests/family/test_delete.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
from db_client.models.law_policy import (
DocumentStatus,
Family,
FamilyDocument,
FamilyStatus,
)
from db_client.models.dfce import DocumentStatus, Family, FamilyDocument, FamilyStatus
from fastapi import status
from fastapi.testclient import TestClient
from sqlalchemy.orm import Session
Expand Down
6 changes: 3 additions & 3 deletions integration_tests/family/test_update.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from typing import Optional

from db_client.models.law_policy.collection import CollectionFamily
from db_client.models.law_policy.family import Family, FamilyCategory, Slug
from db_client.models.law_policy.metadata import FamilyMetadata
from db_client.models.dfce.collection import CollectionFamily
from db_client.models.dfce.family import Family, FamilyCategory, Slug
from db_client.models.dfce.metadata import FamilyMetadata
from fastapi import status
from fastapi.testclient import TestClient
from sqlalchemy.orm import Session
Expand Down
18 changes: 9 additions & 9 deletions integration_tests/setup_db.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
from typing import cast

from db_client.models.app.users import AppUser, Organisation, OrganisationUser
from db_client.models.document.physical_document import (
LanguageSource,
PhysicalDocument,
PhysicalDocumentLanguage,
)
from db_client.models.law_policy.collection import (
from db_client.models.dfce.collection import (
Collection,
CollectionFamily,
CollectionOrganisation,
)
from db_client.models.law_policy.family import (
from db_client.models.dfce.family import (
EventStatus,
Family,
FamilyDocument,
FamilyEvent,
FamilyOrganisation,
Slug,
)
from db_client.models.law_policy.metadata import (
from db_client.models.dfce.metadata import (
FamilyMetadata,
MetadataOrganisation,
MetadataTaxonomy,
)
from db_client.models.document.physical_document import (
LanguageSource,
PhysicalDocument,
PhysicalDocumentLanguage,
)
from db_client.models.organisation.users import AppUser, Organisation, OrganisationUser
from sqlalchemy import text
from sqlalchemy.orm import Session

Expand Down
Loading

0 comments on commit dae2faf

Please sign in to comment.