artemis-model 0.1.86__tar.gz → 0.1.87__tar.gz
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-0.1.86 → artemis_model-0.1.87}/PKG-INFO +1 -1
- {artemis_model-0.1.86 → artemis_model-0.1.87}/artemis_model/auth.py +0 -9
- {artemis_model-0.1.86 → artemis_model-0.1.87}/artemis_model/device.py +8 -17
- {artemis_model-0.1.86 → artemis_model-0.1.87}/artemis_model/user.py +8 -0
- {artemis_model-0.1.86 → artemis_model-0.1.87}/pyproject.toml +1 -1
- {artemis_model-0.1.86 → artemis_model-0.1.87}/README.md +0 -0
- {artemis_model-0.1.86 → artemis_model-0.1.87}/artemis_model/__init__.py +0 -0
- {artemis_model-0.1.86 → artemis_model-0.1.87}/artemis_model/album.py +0 -0
- {artemis_model-0.1.86 → artemis_model-0.1.87}/artemis_model/artist.py +0 -0
- {artemis_model-0.1.86 → artemis_model-0.1.87}/artemis_model/base.py +0 -0
- {artemis_model-0.1.86 → artemis_model-0.1.87}/artemis_model/category.py +0 -0
- {artemis_model-0.1.86 → artemis_model-0.1.87}/artemis_model/dj_set.py +0 -0
- {artemis_model-0.1.86 → artemis_model-0.1.87}/artemis_model/genre.py +0 -0
- {artemis_model-0.1.86 → artemis_model-0.1.87}/artemis_model/location.py +0 -0
- {artemis_model-0.1.86 → artemis_model-0.1.87}/artemis_model/message.py +0 -0
- {artemis_model-0.1.86 → artemis_model-0.1.87}/artemis_model/organization.py +0 -0
- {artemis_model-0.1.86 → artemis_model-0.1.87}/artemis_model/otp.py +0 -0
- {artemis_model-0.1.86 → artemis_model-0.1.87}/artemis_model/permission.py +0 -0
- {artemis_model-0.1.86 → artemis_model-0.1.87}/artemis_model/playlist.py +0 -0
- {artemis_model-0.1.86 → artemis_model-0.1.87}/artemis_model/schedule.py +0 -0
- {artemis_model-0.1.86 → artemis_model-0.1.87}/artemis_model/setting.py +0 -0
- {artemis_model-0.1.86 → artemis_model-0.1.87}/artemis_model/track.py +0 -0
- {artemis_model-0.1.86 → artemis_model-0.1.87}/artemis_model/zone.py +0 -0
@@ -63,15 +63,6 @@ class UserAccountMixin(TimeStampMixin):
|
|
63
63
|
disabled_reason: Mapped[Optional[str]] = mapped_column(nullable=True)
|
64
64
|
is_onboarded: Mapped[bool] = mapped_column(default=False)
|
65
65
|
|
66
|
-
|
67
|
-
@declared_attr
|
68
|
-
def devices(cls) -> Mapped[list["Device"]]:
|
69
|
-
return relationship(
|
70
|
-
"Device",
|
71
|
-
secondary="device_user_assoc", # Directly reference the association table
|
72
|
-
back_populates="users",
|
73
|
-
)
|
74
|
-
|
75
66
|
@declared_attr
|
76
67
|
def login_histories(cls) -> Mapped["LoginHistory"]:
|
77
68
|
return relationship("LoginHistory", back_populates="account")
|
@@ -2,32 +2,23 @@ import enum
|
|
2
2
|
import uuid
|
3
3
|
from datetime import datetime
|
4
4
|
|
5
|
-
from sqlalchemy import JSON, UUID,
|
5
|
+
from sqlalchemy import JSON, UUID, ForeignKey
|
6
6
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
7
7
|
from sqlalchemy.ext.declarative import declared_attr
|
8
|
-
from sqlalchemy.ext.associationproxy import
|
8
|
+
from sqlalchemy.ext.associationproxy import association_proxy
|
9
9
|
|
10
10
|
from artemis_model.base import CustomSyncBase, CustomBase, TimeStampMixin
|
11
11
|
|
12
12
|
|
13
|
-
class DeviceControlMode(enum.Enum):
|
14
|
-
PLAYER = "player"
|
15
|
-
CONTROL = "control"
|
16
|
-
|
17
|
-
|
18
13
|
class DeviceMixin(TimeStampMixin):
|
19
14
|
"""
|
20
15
|
Represents a Jukebox device that can be controlled by multiple users.
|
21
16
|
"""
|
22
|
-
id: Mapped[uuid.UUID] = mapped_column(
|
23
|
-
UUID(as_uuid=True), primary_key=True, default=uuid.uuid4
|
24
|
-
)
|
17
|
+
id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
25
18
|
device_id: Mapped[str] = mapped_column(nullable=False, unique=True, index=True)
|
26
19
|
name: Mapped[str] = mapped_column(nullable=False) # e.g., "Living Room Jukebox"
|
27
|
-
|
28
|
-
|
29
|
-
version: Mapped[int] = mapped_column(default=0)
|
30
|
-
device_specs: Mapped[JSON] = mapped_column(JSON, nullable=True)
|
20
|
+
fcm_token: Mapped[str | None] = mapped_column(nullable=True)
|
21
|
+
device_specs: Mapped[dict] = mapped_column(JSON, nullable=True) # control_mode can be stored here
|
31
22
|
|
32
23
|
@declared_attr
|
33
24
|
def device_user_assoc(cls) -> Mapped[list["DeviceUserAssoc"]]:
|
@@ -42,7 +33,7 @@ class DeviceMixin(TimeStampMixin):
|
|
42
33
|
)
|
43
34
|
|
44
35
|
@declared_attr
|
45
|
-
def users(cls) -> Mapped[list["
|
36
|
+
def users(cls) -> Mapped[list["User"]]:
|
46
37
|
return relationship(
|
47
38
|
secondary="device_user_assoc",
|
48
39
|
viewonly=True
|
@@ -66,7 +57,7 @@ class DeviceUserAssocMixin(TimeStampMixin):
|
|
66
57
|
ForeignKey("device.id"), primary_key=True, nullable=False
|
67
58
|
)
|
68
59
|
user_id: Mapped[uuid.UUID] = mapped_column(
|
69
|
-
ForeignKey("
|
60
|
+
ForeignKey("user.id"), primary_key=True, nullable=False
|
70
61
|
)
|
71
62
|
|
72
63
|
|
@@ -75,4 +66,4 @@ class DeviceUserAssocSync(CustomSyncBase, DeviceUserAssocMixin):
|
|
75
66
|
|
76
67
|
|
77
68
|
class DeviceUserAssoc(CustomBase, DeviceUserAssocMixin):
|
78
|
-
pass
|
69
|
+
pass
|
@@ -28,6 +28,14 @@ class UserMixin(TimeStampMixin):
|
|
28
28
|
cascade="all, delete-orphan",
|
29
29
|
)
|
30
30
|
|
31
|
+
@declared_attr
|
32
|
+
def devices(cls) -> Mapped[list["Device"]]:
|
33
|
+
return relationship(
|
34
|
+
"Device",
|
35
|
+
secondary="device_user_assoc", # Directly reference the association table
|
36
|
+
back_populates="users",
|
37
|
+
)
|
38
|
+
|
31
39
|
@declared_attr
|
32
40
|
def user_permission_associations(cls) -> Mapped[List["UserPermissionAssoc"]]:
|
33
41
|
return relationship(
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|