artemis-model 0.1.78__py3-none-any.whl → 0.1.79__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
artemis_model/playlist.py
CHANGED
@@ -2,11 +2,11 @@ import uuid
|
|
2
2
|
from datetime import date, datetime
|
3
3
|
|
4
4
|
from sqlalchemy import Computed, ForeignKey, func, literal, text
|
5
|
+
from sqlalchemy.ext.hybrid import hybrid_property
|
5
6
|
from sqlalchemy.ext.associationproxy import AssociationProxy, association_proxy
|
6
7
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
7
8
|
|
8
9
|
from artemis_model.base import CustomBase, CustomSyncBase, TSVector, TimeStampMixin
|
9
|
-
|
10
10
|
from sqlalchemy.ext.declarative import declared_attr
|
11
11
|
|
12
12
|
|
@@ -15,6 +15,21 @@ def to_tsvector_ix(*columns):
|
|
15
15
|
return func.to_tsvector(literal("english"), text(s))
|
16
16
|
|
17
17
|
|
18
|
+
class FavoritePlaylistMixin:
|
19
|
+
playlist_id: Mapped[int] = mapped_column(
|
20
|
+
ForeignKey("playlist.id"), primary_key=True
|
21
|
+
)
|
22
|
+
user_id: Mapped[uuid.UUID] = mapped_column(ForeignKey("user.id"), primary_key=True)
|
23
|
+
|
24
|
+
|
25
|
+
class FavoritePlaylistSync(CustomSyncBase, FavoritePlaylistMixin):
|
26
|
+
pass
|
27
|
+
|
28
|
+
|
29
|
+
class FavoritePlaylist(CustomBase, FavoritePlaylistMixin):
|
30
|
+
pass
|
31
|
+
|
32
|
+
|
18
33
|
class PlaylistMixin(TimeStampMixin):
|
19
34
|
id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True)
|
20
35
|
name: Mapped[str] = mapped_column(nullable=False, unique=True)
|
@@ -26,9 +41,7 @@ class PlaylistMixin(TimeStampMixin):
|
|
26
41
|
is_published: Mapped[bool] = mapped_column(default=False) # legacy isTest
|
27
42
|
description: Mapped[str | None] = mapped_column(nullable=True)
|
28
43
|
cover_image: Mapped[str | None] = mapped_column(nullable=True)
|
29
|
-
is_ordered: Mapped[bool] = mapped_column(
|
30
|
-
default=False
|
31
|
-
) # CanBeShuffled - Migration'da tersini al
|
44
|
+
is_ordered: Mapped[bool] = mapped_column(default=False)
|
32
45
|
legacy_prepared_by: Mapped[str | None] = mapped_column(nullable=True)
|
33
46
|
notes: Mapped[str | None] = mapped_column(nullable=True)
|
34
47
|
published_at: Mapped[date | None] = mapped_column(nullable=True)
|
@@ -40,6 +53,19 @@ class PlaylistMixin(TimeStampMixin):
|
|
40
53
|
Computed("to_tsvector('english', name)", persisted=True),
|
41
54
|
)
|
42
55
|
|
56
|
+
@declared_attr
|
57
|
+
def favorite_playlist_associations(cls):
|
58
|
+
return relationship(
|
59
|
+
"FavoritePlaylist",
|
60
|
+
primaryjoin="and_(FavoritePlaylist.playlist_id == Playlist.id)",
|
61
|
+
viewonly=True,
|
62
|
+
lazy="select"
|
63
|
+
)
|
64
|
+
|
65
|
+
@hybrid_property
|
66
|
+
def is_favorite(self):
|
67
|
+
return bool(self.favorite_playlist_associations)
|
68
|
+
|
43
69
|
@declared_attr
|
44
70
|
def category_playlist_associations(cls) -> Mapped[
|
45
71
|
list["PlaylistCategoryAssoc"]
|
@@ -186,18 +212,3 @@ class PlaylistCounterSync(CustomSyncBase, PlaylistCounterMixin):
|
|
186
212
|
|
187
213
|
class PlaylistCounter(CustomBase, PlaylistCounterMixin):
|
188
214
|
pass
|
189
|
-
|
190
|
-
|
191
|
-
class FavoritePlaylistMixin:
|
192
|
-
playlist_id: Mapped[int] = mapped_column(
|
193
|
-
ForeignKey("playlist.id"), primary_key=True
|
194
|
-
)
|
195
|
-
user_id: Mapped[uuid.UUID] = mapped_column(ForeignKey("user.id"), primary_key=True)
|
196
|
-
|
197
|
-
|
198
|
-
class FavoritePlaylistSync(CustomSyncBase, FavoritePlaylistMixin):
|
199
|
-
pass
|
200
|
-
|
201
|
-
|
202
|
-
class FavoritePlaylist(CustomBase, FavoritePlaylistMixin):
|
203
|
-
pass
|
@@ -11,12 +11,12 @@ artemis_model/message.py,sha256=gua3X_1hS7akmS42wQGtL0I-FCJUHdTBM4n2DW4hTxQ,3280
|
|
11
11
|
artemis_model/organization.py,sha256=hu9jKB2qu57BwN0sUUK13p3tC-Hqw9EghFMqjFP9Pr4,2387
|
12
12
|
artemis_model/otp.py,sha256=TjZ_EHeIedjsLIqyZTtzd0s6Uc-1dleMEV8DhzsW44o,1046
|
13
13
|
artemis_model/permission.py,sha256=sEBRN-bQJl2TNtRJ5LRuySoEbW1lY4DCoyRk0nOM-kY,1503
|
14
|
-
artemis_model/playlist.py,sha256=
|
14
|
+
artemis_model/playlist.py,sha256=1mR1FbjeG5ZKzILLd7Mo_fuMplEwN3gPCO-jHvkE1WM,6550
|
15
15
|
artemis_model/schedule.py,sha256=pnoKDMlUh28o61I7kZddNYn6z-uqOt_ml1nbWxKVeRM,1722
|
16
16
|
artemis_model/setting.py,sha256=McWbeDZP45km3VSSwP1BgAmmjO4qCL0pTnOmJVAz0WI,1265
|
17
17
|
artemis_model/track.py,sha256=x8BHKDZl9uQmQH6DWpzH-SEsfecLghOBdBT7qXgN3d0,3865
|
18
18
|
artemis_model/user.py,sha256=ZtZVwavSPoQmYM1_MarMULy-DJa2pH482G_G8su0b6c,2211
|
19
19
|
artemis_model/zone.py,sha256=iGRUtzUwKh9LHT3MOfzzg1DnkPBts_ZBzZVTi2EmIgs,2282
|
20
|
-
artemis_model-0.1.
|
21
|
-
artemis_model-0.1.
|
22
|
-
artemis_model-0.1.
|
20
|
+
artemis_model-0.1.79.dist-info/METADATA,sha256=jmUd3dhnX7S5I2n7N9bX3cgeTBE_UaK7r1ZNtf3uxP8,3402
|
21
|
+
artemis_model-0.1.79.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
22
|
+
artemis_model-0.1.79.dist-info/RECORD,,
|
File without changes
|