-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
81ebee2
commit 33c2686
Showing
8 changed files
with
45 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,30 @@ | ||
from sqlalchemy import Column, ForeignKey, Integer | ||
from src.models.base_model import BaseModel | ||
from sqlalchemy import ForeignKey | ||
from sqlalchemy_serializer import SerializerMixin | ||
|
||
from src import db | ||
from src.models import Formation | ||
from src.models.base_model import BaseModel | ||
from src.models.helpers.UUIDType import UUIDType | ||
from sqlalchemy_serializer import SerializerMixin | ||
from sqlalchemy.orm import relationship | ||
|
||
|
||
class UserFavori(BaseModel, SerializerMixin): | ||
__tablename__ = "user_favori" | ||
|
||
serialize_only = "formation_id" | ||
|
||
formation_id = Column( | ||
formation_id = db.Column( | ||
UUIDType, | ||
ForeignKey("formation.id", ondelete="CASCADE"), | ||
primary_key=True, | ||
index=True, | ||
) | ||
|
||
user_id = Column( | ||
Integer, | ||
user_id = db.Column( | ||
db.Integer, | ||
ForeignKey("user.id", ondelete="CASCADE"), | ||
primary_key=True, | ||
index=True, | ||
) | ||
|
||
users = relationship("User", back_populates="favoris") | ||
formation: list[Formation] = relationship("Formation") | ||
users = db.relationship("User", back_populates="favoris") | ||
formation: list[Formation] = db.relationship("Formation") |