-
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.
fazendo a modelagem e o schema da tabela liked
- Loading branch information
1 parent
1d81f86
commit d4f04f3
Showing
5 changed files
with
33 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from app.config.app_config import * | ||
from app.config.db_config import * | ||
from app.models.tables.liked import Liked | ||
from app.models.schemas.user_schema import UserSchema | ||
from app.models.schemas.movie_schema import MovieSchema | ||
|
||
class LikedSchema(ma.SQLAlchemyAutoSchema): | ||
user = ma.Nested(UserSchema) | ||
movie = ma.Nested(MovieSchema) | ||
class Meta: | ||
model = Liked | ||
load_instance = True |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from app.config.app_config import * | ||
from app.config.db_config import * | ||
from sqlalchemy.orm import Mapped, mapped_column | ||
from sqlalchemy import String, ForeignKey | ||
from uuid import uuid4 | ||
|
||
class Liked(Base): | ||
id: Mapped[str] = mapped_column(String, primary_key=True, default=lambda: str(uuid4())) | ||
user_id: Mapped[str] = mapped_column(String, ForeignKey("user.id"), unique=False, nullable=True) | ||
movie_id: Mapped[str] = mapped_column(String, ForeignKey("movie.id"), unique=False, nullable=True) | ||
|
||
def __init__(self, user_id, movie_id): | ||
self.user_id = user_id | ||
self.movie_id = movie_id |
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