diff --git a/pepdbagent/db_utils.py b/pepdbagent/db_utils.py index fe5ab6c..45c151c 100644 --- a/pepdbagent/db_utils.py +++ b/pepdbagent/db_utils.py @@ -366,14 +366,12 @@ class SchemaGroupRelations(Base): class TarNamespace(Base): - __tablename__ = "tar_namespace" + __tablename__ = "namespace_archives" id: Mapped[int] = mapped_column(primary_key=True) namespace: Mapped[str] = mapped_column(ForeignKey("users.namespace", ondelete="CASCADE")) file_path: Mapped[str] = mapped_column(nullable=False) - submission_date: Mapped[datetime.datetime] = mapped_column(default=deliver_update_date) - start_period: Mapped[datetime.datetime] = mapped_column(nullable=True) - end_period: Mapped[datetime.datetime] = mapped_column(nullable=True) + creation_date: Mapped[datetime.datetime] = mapped_column(default=deliver_update_date) number_of_projects: Mapped[int] = mapped_column(default=0) diff --git a/pepdbagent/models.py b/pepdbagent/models.py index 0d3d025..462d283 100644 --- a/pepdbagent/models.py +++ b/pepdbagent/models.py @@ -303,9 +303,7 @@ class TarNamespaceModel(BaseModel): identifier: int = None namespace: str file_path: str - submission_date: datetime.datetime = None - start_period: datetime.datetime - end_period: datetime.datetime + creation_date: datetime.datetime = None number_of_projects: int = 0 diff --git a/pepdbagent/modules/namespace.py b/pepdbagent/modules/namespace.py index 1f34975..e1ec80b 100644 --- a/pepdbagent/modules/namespace.py +++ b/pepdbagent/modules/namespace.py @@ -315,8 +315,7 @@ def upload_tar_info(self, tar_info: TarNamespaceModel) -> None: new_tar = TarNamespace( file_path=tar_info.file_path, namespace=tar_info.namespace, - start_period=tar_info.start_period, - end_period=tar_info.end_period, + creation_date=tar_info.creation_date, number_of_projects=tar_info.number_of_projects, ) session.add(new_tar) @@ -337,7 +336,7 @@ def get_tar_info(self, namespace: str) -> TarNamespaceModelReturn: tar_info = session.scalars( select(TarNamespace) .where(TarNamespace.namespace == namespace) - .order_by(TarNamespace.submission_date.desc()) + .order_by(TarNamespace.creation_date.desc()) ) results = [] @@ -347,9 +346,7 @@ def get_tar_info(self, namespace: str) -> TarNamespaceModelReturn: identifier=result.id, namespace=result.namespace, file_path=result.file_path, - start_period=result.start_period, - end_period=result.end_period, - submission_date=result.submission_date, + creation_date=result.creation_date, number_of_projects=result.number_of_projects, ) ) diff --git a/tests/test_tar_meta.py b/tests/test_tar_meta.py index 0b1a675..2488a4b 100644 --- a/tests/test_tar_meta.py +++ b/tests/test_tar_meta.py @@ -35,9 +35,6 @@ def test_create_meta_tar(self): result = agent.namespace.get_tar_info(namespace=self.test_namespace) assert result.count == 1 - assert result.results[0].end_period.strftime( - "%Y:%m:%d" - ) == self.tar_info.end_period.strftime("%Y:%m:%d") def test_delete_meta_tar(self): with PEPDBAgentContextManager(add_data=True) as agent: