artemis-model 0.1.161__py3-none-any.whl → 0.1.162__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.

Potentially problematic release.


This version of artemis-model might be problematic. Click here for more details.

artemis_model/__init__.py CHANGED
@@ -1,4 +1,5 @@
1
1
  from artemis_model.album import * # noqa
2
+ from artemis_model.approved_playlist_list import * # noqa
2
3
  from artemis_model.artist import * # noqa
3
4
  from artemis_model.auth import * # noqa
4
5
  from artemis_model.category import * # noqa
@@ -0,0 +1,59 @@
1
+ import uuid
2
+ from typing import List
3
+
4
+ from sqlalchemy import ForeignKey
5
+ from sqlalchemy.orm import Mapped, mapped_column, relationship
6
+ from sqlalchemy.ext.declarative import declared_attr
7
+
8
+ from artemis_model.base import CustomSyncBase, TimeStampMixin, AuditMixin, CustomBase
9
+
10
+
11
+ class ApprovedPlaylistListMixin(TimeStampMixin, AuditMixin):
12
+
13
+ id: Mapped[int] = mapped_column(autoincrement=True, primary_key=True, index=True)
14
+ name: Mapped[str] = mapped_column(nullable=False)
15
+ organization_id: Mapped[uuid.UUID] = mapped_column(
16
+ ForeignKey("organization.id"), nullable=False, index=True
17
+ )
18
+
19
+ @declared_attr
20
+ def organization(cls) -> Mapped["Organization"]:
21
+ return relationship("Organization", back_populates="approved_playlist_lists")
22
+
23
+ @declared_attr
24
+ def playlist_associations(cls) -> Mapped[List["ApprovedPlaylistListPlaylistAssoc"]]:
25
+ return relationship(cascade="all, delete-orphan")
26
+
27
+ @declared_attr
28
+ def playlists(cls) -> Mapped[List["Playlist"]]:
29
+ return relationship(
30
+ "Playlist",
31
+ secondary="approved_playlist_list_playlist_assoc",
32
+ viewonly=True
33
+ )
34
+
35
+
36
+ class ApprovedPlaylistListSync(CustomSyncBase, ApprovedPlaylistListMixin):
37
+ pass
38
+
39
+
40
+ class ApprovedPlaylistList(CustomBase, ApprovedPlaylistListMixin):
41
+ pass
42
+
43
+
44
+ class ApprovedPlaylistListPlaylistAssocMixin(TimeStampMixin):
45
+
46
+ approved_playlist_list_id: Mapped[int] = mapped_column(
47
+ ForeignKey("approved_playlist_list.id"), primary_key=True, nullable=False
48
+ )
49
+ playlist_id: Mapped[int] = mapped_column(
50
+ ForeignKey("playlist.id"), primary_key=True, nullable=False
51
+ )
52
+
53
+
54
+ class ApprovedPlaylistListPlaylistAssocSync(CustomSyncBase, ApprovedPlaylistListPlaylistAssocMixin):
55
+ pass
56
+
57
+
58
+ class ApprovedPlaylistListPlaylistAssoc(CustomBase, ApprovedPlaylistListPlaylistAssocMixin):
59
+ pass
@@ -42,6 +42,21 @@ class OrganizationMixin(TimeStampMixin):
42
42
  def include_pal_setting(cls) -> Mapped["OrganizationIncludePalSetting"]:
43
43
  return relationship(back_populates="organization", uselist=False, cascade="all, delete-orphan")
44
44
 
45
+ @declared_attr
46
+ def approved_playlist_lists(cls) -> Mapped[List["ApprovedPlaylistList"]]:
47
+ return relationship("ApprovedPlaylistList", back_populates="organization")
48
+
49
+ @property
50
+ def approved_playlists(self) -> List[int]:
51
+ """
52
+ Convenience property to get all playlist IDs from all approved lists, flattened.
53
+ Returns empty list if no approved lists exist.
54
+ """
55
+ playlist_ids = []
56
+ for approved_list in self.approved_playlist_lists:
57
+ playlist_ids.extend([playlist.id for playlist in approved_list.playlists])
58
+ return playlist_ids
59
+
45
60
 
46
61
  def generate_slug(target: Any, value: Any, old_value: Any, initiator: Any) -> None:
47
62
  """Creates a reasonable slug based on organization name."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: artemis-model
3
- Version: 0.1.161
3
+ Version: 0.1.162
4
4
  Summary:
5
5
  Author: Jukeboxy
6
6
  Requires-Python: >=3.10.6,<4.0.0
@@ -1,5 +1,6 @@
1
- artemis_model/__init__.py,sha256=k2vjBKwr-B0GU51teQMyNwVaXxqW9lJT3GoyU_yI2ZM,922
1
+ artemis_model/__init__.py,sha256=R__YcDg7FMAMHyy9CVjqi6fC58DEWkwMXCg0S9Az6Ck,981
2
2
  artemis_model/album.py,sha256=9uw9HVNHVBjl-0Dgv-o5MHXhUPwedvbnbzzY3A1cKQg,2077
3
+ artemis_model/approved_playlist_list.py,sha256=JJ2n15JA7kBbsKrQA-GpfriMEjCHZmWcFhFAKfNcPxY,1869
3
4
  artemis_model/artist.py,sha256=vjXlFN2mOEidAzUzxmsAP5GnVTvJUuhFdhQaH214lgw,1563
4
5
  artemis_model/auth.py,sha256=0Yg_6N1nj4U31F86u1PE0leIa3D64QlYrsDlavulN6s,4033
5
6
  artemis_model/banned_tracks.py,sha256=uU-F-6DL2EshPAUwLTTHjYZ7UEz4vm0Wfcif2F0lSKw,664
@@ -10,7 +11,7 @@ artemis_model/genre.py,sha256=8_-IuJS543wIhUVCES3bdrDpKPKx-plDuBKGBcoMIbc,1570
10
11
  artemis_model/location.py,sha256=6Z99OCxhB3VQ4CqNwZP3ShnJ-gOnc5rxGnCn5aCIFZ8,4896
11
12
  artemis_model/location_genre_exclusion.py,sha256=SMX4TXmpwn28tytUq7-qP9ZyJ_ULs5SUv4h7sU0dRFo,1252
12
13
  artemis_model/message.py,sha256=W4vhllsD4Nn11JIKeXlgsKC2NWCt3UMkWh-Sma71gBI,3325
13
- artemis_model/organization.py,sha256=_UON9x6iDsU6bW_GWbtQaRnetFx1Bel4ZqXTiugjL2s,2556
14
+ artemis_model/organization.py,sha256=oyq8YIqVr5HAli1IuqFj2UlVKw9KBpWIMlZGcEzmYyA,3167
14
15
  artemis_model/organization_include_pal_setting.py,sha256=OhNRn4aH96IquJcJBsubvZEgIY3ENqPr4Rda4GWEZ1g,1179
15
16
  artemis_model/otp.py,sha256=guIRGtyFlHUBthCAEsTh5_Hs-1yiGN_qfEO4uHNcv4s,1017
16
17
  artemis_model/permission.py,sha256=Bn1Bg1aCS4Z4_3tqEqvtrzqAYDCImsvmGyIEMoVycEk,1452
@@ -29,6 +30,6 @@ artemis_model/track.py,sha256=QwUF0QKVn1I64648B-NI75-IzGQvnLt9B0emD4GnS6E,3757
29
30
  artemis_model/user.py,sha256=eqIdCiBJRNLjCwPPCn-gQ6si0O5JUBGfp9oWJL5zVW4,2131
30
31
  artemis_model/zone.py,sha256=iGRUtzUwKh9LHT3MOfzzg1DnkPBts_ZBzZVTi2EmIgs,2282
31
32
  artemis_model/zone_activity.py,sha256=BY4iODavY9ceJ5oRChdjjxf26S3U30Yb7Pxm5YRFpCo,1590
32
- artemis_model-0.1.161.dist-info/METADATA,sha256=w4-UfZtUowzQA1dFj4snfh1N9EgMrtuvk7Y0wSnjuF4,3496
33
- artemis_model-0.1.161.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
34
- artemis_model-0.1.161.dist-info/RECORD,,
33
+ artemis_model-0.1.162.dist-info/METADATA,sha256=3XZN_7l9gN4TsDWsJ8OLH_e99p_ZZEtIR_Gm4IIjYwU,3496
34
+ artemis_model-0.1.162.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
35
+ artemis_model-0.1.162.dist-info/RECORD,,