add experience_links table
This commit is contained in:
1 parent
11bfc9e387
commit
13982ac495
3 files changed
+46
No files matched your search
@@ -45,3 +45,9 @@ class Experience(Base):
|
|||||||
back_populates="experience",
|
back_populates="experience",
|
||||||
cascade="all, delete-orphan"
|
cascade="all, delete-orphan"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
links = relationship(
|
||||||
|
"ExperienceLink",
|
||||||
|
back_populates="experience",
|
||||||
|
cascade="all, delete-orphan"
|
||||||
|
)
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
from sqlalchemy import (
|
||||||
|
Column,
|
||||||
|
Integer,
|
||||||
|
String,
|
||||||
|
ForeignKey
|
||||||
|
)
|
||||||
|
|
||||||
|
from sqlalchemy.orm import relationship
|
||||||
|
|
||||||
|
from app.database import Base
|
||||||
|
|
||||||
|
|
||||||
|
class ExperienceLinks(Base):
|
||||||
|
__tablename__ = "experience_links"
|
||||||
|
|
||||||
|
id = Column(
|
||||||
|
Integer,
|
||||||
|
primary_key=True,
|
||||||
|
index=True
|
||||||
|
)
|
||||||
|
|
||||||
|
link = Column(
|
||||||
|
String(255),
|
||||||
|
nullable=False
|
||||||
|
)
|
||||||
|
|
||||||
|
experience_id = Column(
|
||||||
|
Integer,
|
||||||
|
ForeignKey(
|
||||||
|
"experiences.id",
|
||||||
|
ondelete="CASCADE"
|
||||||
|
),
|
||||||
|
nullable=False
|
||||||
|
)
|
||||||
|
|
||||||
|
experience = relationship(
|
||||||
|
"Experience",
|
||||||
|
back_populates="links"
|
||||||
|
)
|
||||||
@@ -14,6 +14,7 @@ class ExperienceResponse(BaseModel):
|
|||||||
duration: str
|
duration: str
|
||||||
role: str
|
role: str
|
||||||
tasks: list[ExperienceTaskResponse]
|
tasks: list[ExperienceTaskResponse]
|
||||||
|
links: list[ExperienceLinkResponse]
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
from_attributes = True
|
from_attributes = True
|
||||||
|
|||||||
Reference in new issue
Block a user