From f94f7a99cde542335c9cf9d0382c9e935ba1e0da Mon Sep 17 00:00:00 2001 From: looccasgtr Date: Thu, 24 Apr 2025 17:09:19 -0400 Subject: [PATCH] =?UTF-8?q?Cria=C3=A7=C3=A3o=20dos=20models=20tag=20e=20do?= =?UTF-8?q?c=5Ftag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/model-doc_tag.py | 12 ++++++++++++ app/models/model_tag.py | 12 ++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 app/models/model-doc_tag.py create mode 100644 app/models/model_tag.py diff --git a/app/models/model-doc_tag.py b/app/models/model-doc_tag.py new file mode 100644 index 0000000..ae185de --- /dev/null +++ b/app/models/model-doc_tag.py @@ -0,0 +1,12 @@ +from sqlalchemy import Column, ForeignKey +from sqlalchemy.dialects.postgresql import UUID +import uuid + +from .base import Base + +class DocTag(Base): + __tablename__ = "doc_tag" + + id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4) + documento_id = Column(UUID(as_uuid=True), ForeignKey("documento.id"), nullable=False) + tag_id = Column(UUID(as_uuid=True), ForeignKey("tag.id"), nullable=False) diff --git a/app/models/model_tag.py b/app/models/model_tag.py new file mode 100644 index 0000000..bb1b41d --- /dev/null +++ b/app/models/model_tag.py @@ -0,0 +1,12 @@ +from sqlalchemy import Column, String +from sqlalchemy.dialects.postgresql import UUID +from sqlalchemy.ext.declarative import declarative_base +import uuid + +Base = declarative_base() + +class Tag(Base): + __tablename__ = "tag" + + id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4) + nome = Column(String, unique=True, nullable=False)