-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added tags for images, events and news #103
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generellt sätt en snygg pull request, dock krävs det mer arbete genom att bygga upp fler tables då detta skulle skapa galet mycket redundant utrymme i våran databas. Jag vill ha tables så som NewsTags osv istället
|
||
id: Mapped[int] = mapped_column(primary_key=True, init=False) | ||
tag_name: Mapped[str] = mapped_column(String(MAX_TAG_NAME)) | ||
color: Mapped[str] = mapped_column(String(7)) # Defined as #ff0000 for example |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kan vara värt att kolla på detta: https://docs.pydantic.dev/2.0/usage/types/extra_types/color_types/
tag_name: Mapped[str] = mapped_column(String(MAX_TAG_NAME)) | ||
color: Mapped[str] = mapped_column(String(7)) # Defined as #ff0000 for example | ||
|
||
events: AssociationProxy[list["Event_DB"]] = association_proxy( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Detta är inte rätt implementerat, ska vara kopplat på annat sätt, skulle läsa att du vill göra typ en EventTags model också istället
target_collection="event_tags", attr="tag", init=False | ||
) | ||
|
||
news: AssociationProxy[list["News_DB"]] = association_proxy(target_collection="news_tags", attr="tag", init=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
samma sak som ovam
|
||
news: AssociationProxy[list["News_DB"]] = association_proxy(target_collection="news_tags", attr="tag", init=False) | ||
|
||
images: AssociationProxy[list["Img_DB"]] = association_proxy(target_collection="image_tags", attr="tag", init=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
samma sak igen
Hmm. Varje tag-modell kommer väl i princip bli ekvivalent med de andra förutom att man byter ut typen av lista? Finns det nåt smidigt sätt att göra det utan att behöva göra massa copy paste? Som jag förstår det blir det samma problem sen när man väl ska definiera varje individuell tag, alltså att lägga in t.ex. "nollning" och "styrelsen" både som EventTag, ImageTag, NewsTag osv. Samma sak när man ska hämta allt innehåll kopplat till en viss tag. |
Asså grejen är att AssociationProxy löser inte alla problem åt oss utan man behöver skapa ett mellanliggande table... |
Anything else that needs to be added at this stage?