f3-data-models 0.5.7__py3-none-any.whl → 0.5.10__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.
- f3_data_models/models.py +34 -14
- f3_data_models/testing.py +18 -6
- {f3_data_models-0.5.7.dist-info → f3_data_models-0.5.10.dist-info}/METADATA +1 -1
- f3_data_models-0.5.10.dist-info/RECORD +7 -0
- {f3_data_models-0.5.7.dist-info → f3_data_models-0.5.10.dist-info}/WHEEL +1 -1
- f3_data_models-0.5.7.dist-info/RECORD +0 -7
f3_data_models/models.py
CHANGED
@@ -500,7 +500,7 @@ class EventType_x_Event(Base):
|
|
500
500
|
|
501
501
|
__tablename__ = "events_x_event_types"
|
502
502
|
|
503
|
-
event_id: Mapped[int] = mapped_column(ForeignKey("events.id"), primary_key=True)
|
503
|
+
event_id: Mapped[int] = mapped_column(ForeignKey("events.id"), primary_key=True, onupdate="CASCADE")
|
504
504
|
event_type_id: Mapped[int] = mapped_column(ForeignKey("event_types.id"), primary_key=True)
|
505
505
|
__table_args__ = (
|
506
506
|
Index("idx_events_x_event_types_event_id", "event_id"),
|
@@ -523,7 +523,9 @@ class EventType_x_EventInstance(Base):
|
|
523
523
|
|
524
524
|
__tablename__ = "event_instances_x_event_types"
|
525
525
|
|
526
|
-
event_instance_id: Mapped[int] = mapped_column(
|
526
|
+
event_instance_id: Mapped[int] = mapped_column(
|
527
|
+
ForeignKey("event_instances.id"), primary_key=True, onupdate="CASCADE"
|
528
|
+
)
|
527
529
|
event_type_id: Mapped[int] = mapped_column(ForeignKey("event_types.id"), primary_key=True)
|
528
530
|
|
529
531
|
event_instance: Mapped["EventInstance"] = relationship(back_populates="event_instances_x_event_types")
|
@@ -567,7 +569,7 @@ class EventTag_x_Event(Base):
|
|
567
569
|
|
568
570
|
__tablename__ = "event_tags_x_events"
|
569
571
|
|
570
|
-
event_id: Mapped[int] = mapped_column(ForeignKey("events.id"), primary_key=True)
|
572
|
+
event_id: Mapped[int] = mapped_column(ForeignKey("events.id"), primary_key=True, onupdate="CASCADE")
|
571
573
|
event_tag_id: Mapped[int] = mapped_column(ForeignKey("event_tags.id"), primary_key=True)
|
572
574
|
|
573
575
|
event: Mapped["Event"] = relationship(back_populates="event_x_event_tags")
|
@@ -586,7 +588,9 @@ class EventTag_x_EventInstance(Base):
|
|
586
588
|
|
587
589
|
__tablename__ = "event_tags_x_event_instances"
|
588
590
|
|
589
|
-
event_instance_id: Mapped[int] = mapped_column(
|
591
|
+
event_instance_id: Mapped[int] = mapped_column(
|
592
|
+
ForeignKey("event_instances.id"), primary_key=True, onupdate="CASCADE"
|
593
|
+
)
|
590
594
|
event_tag_id: Mapped[int] = mapped_column(ForeignKey("event_tags.id"), primary_key=True)
|
591
595
|
|
592
596
|
event_instance: Mapped["EventInstance"] = relationship(back_populates="event_instances_x_event_tags")
|
@@ -735,10 +739,12 @@ class Event(Base):
|
|
735
739
|
secondary="event_tags_x_events", cascade="expunge", viewonly=True
|
736
740
|
)
|
737
741
|
event_x_event_types: Mapped[List[EventType_x_Event]] = relationship(
|
738
|
-
back_populates="event",
|
742
|
+
back_populates="event",
|
743
|
+
passive_deletes=True,
|
739
744
|
)
|
740
745
|
event_x_event_tags: Mapped[Optional[List[EventTag_x_Event]]] = relationship(
|
741
|
-
back_populates="event",
|
746
|
+
back_populates="event",
|
747
|
+
passive_deletes=True,
|
742
748
|
)
|
743
749
|
|
744
750
|
|
@@ -781,11 +787,16 @@ class EventInstance(Base):
|
|
781
787
|
""" # noqa: E501
|
782
788
|
|
783
789
|
__tablename__ = "event_instances"
|
790
|
+
__table_args__ = (
|
791
|
+
Index("idx_event_instances_org_id", "org_id"),
|
792
|
+
Index("idx_event_instances_location_id", "location_id"),
|
793
|
+
Index("idx_event_instances_is_active", "is_active"),
|
794
|
+
)
|
784
795
|
|
785
796
|
id: Mapped[intpk]
|
786
797
|
org_id: Mapped[int] = mapped_column(ForeignKey("orgs.id"))
|
787
798
|
location_id: Mapped[Optional[int]] = mapped_column(ForeignKey("locations.id"))
|
788
|
-
series_id: Mapped[Optional[int]] = mapped_column(ForeignKey("events.id"))
|
799
|
+
series_id: Mapped[Optional[int]] = mapped_column(ForeignKey("events.id"), onupdate="CASCADE")
|
789
800
|
is_active: Mapped[bool] = mapped_column(Boolean, default=True)
|
790
801
|
highlight: Mapped[bool] = mapped_column(Boolean, default=False)
|
791
802
|
start_date: Mapped[date]
|
@@ -825,12 +836,14 @@ class EventInstance(Base):
|
|
825
836
|
secondary="event_tags_x_event_instances", cascade="expunge", viewonly=True
|
826
837
|
)
|
827
838
|
event_instances_x_event_types: Mapped[List[EventType_x_EventInstance]] = relationship(
|
828
|
-
back_populates="event_instance",
|
839
|
+
back_populates="event_instance",
|
840
|
+
passive_deletes=True,
|
829
841
|
)
|
830
842
|
event_instances_x_event_tags: Mapped[Optional[List[EventTag_x_EventInstance]]] = relationship(
|
831
|
-
back_populates="event_instance",
|
843
|
+
back_populates="event_instance",
|
844
|
+
passive_deletes=True,
|
832
845
|
)
|
833
|
-
attendance: Mapped[List["Attendance"]] = relationship(back_populates="event_instance",
|
846
|
+
attendance: Mapped[List["Attendance"]] = relationship(back_populates="event_instance", passive_deletes=True)
|
834
847
|
|
835
848
|
|
836
849
|
class AttendanceType(Base):
|
@@ -864,7 +877,7 @@ class Attendance_x_AttendanceType(Base):
|
|
864
877
|
|
865
878
|
__tablename__ = "attendance_x_attendance_types"
|
866
879
|
|
867
|
-
attendance_id: Mapped[int] = mapped_column(ForeignKey("attendance.id"), primary_key=True)
|
880
|
+
attendance_id: Mapped[int] = mapped_column(ForeignKey("attendance.id"), primary_key=True, onupdate="CASCADE")
|
868
881
|
attendance_type_id: Mapped[int] = mapped_column(ForeignKey("attendance_types.id"), primary_key=True)
|
869
882
|
|
870
883
|
attendance: Mapped["Attendance"] = relationship(back_populates="attendance_x_attendance_types")
|
@@ -980,10 +993,15 @@ class Attendance(Base):
|
|
980
993
|
""" # noqa: E501
|
981
994
|
|
982
995
|
__tablename__ = "attendance"
|
983
|
-
__table_args__ = (
|
996
|
+
__table_args__ = (
|
997
|
+
UniqueConstraint("event_instance_id", "user_id", "is_planned"),
|
998
|
+
Index("idx_attendance_event_instance_id", "event_instance_id"),
|
999
|
+
Index("idx_attendance_user_id", "user_id"),
|
1000
|
+
Index("idx_attendance_is_planned", "is_planned"),
|
1001
|
+
)
|
984
1002
|
|
985
1003
|
id: Mapped[intpk]
|
986
|
-
event_instance_id: Mapped[int] = mapped_column(ForeignKey("event_instances.id"))
|
1004
|
+
event_instance_id: Mapped[int] = mapped_column(ForeignKey("event_instances.id"), onupdate="CASCADE")
|
987
1005
|
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"))
|
988
1006
|
is_planned: Mapped[bool]
|
989
1007
|
meta: Mapped[Optional[Dict[str, Any]]]
|
@@ -996,7 +1014,7 @@ class Attendance(Base):
|
|
996
1014
|
innerjoin=False, cascade="expunge", secondary="users", viewonly=True
|
997
1015
|
)
|
998
1016
|
attendance_x_attendance_types: Mapped[List[Attendance_x_AttendanceType]] = relationship(
|
999
|
-
back_populates="attendance",
|
1017
|
+
back_populates="attendance", passive_deletes=True
|
1000
1018
|
)
|
1001
1019
|
attendance_types: Mapped[List[AttendanceType]] = relationship(
|
1002
1020
|
secondary="attendance_x_attendance_types",
|
@@ -1258,6 +1276,7 @@ class UpdateRequest(Base):
|
|
1258
1276
|
ao_id (Optional[int]): The ID of the associated AO.
|
1259
1277
|
ao_name (Optional[text]): The name of the AO.
|
1260
1278
|
ao_logo (Optional[text]): The URL of the AO logo.
|
1279
|
+
ao_website (Optional[text]): The website of the AO.
|
1261
1280
|
submitted_by (str): The user who submitted the request.
|
1262
1281
|
submitter_validated (Optional[bool]): Whether the submitter has validated the request. Default is False.
|
1263
1282
|
reviewed_by (Optional[str]): The user who reviewed the request.
|
@@ -1310,6 +1329,7 @@ class UpdateRequest(Base):
|
|
1310
1329
|
ao_id: Mapped[Optional[int]] = mapped_column(ForeignKey("orgs.id"))
|
1311
1330
|
ao_name: Mapped[Optional[text]]
|
1312
1331
|
ao_logo: Mapped[Optional[text]]
|
1332
|
+
ao_website: Mapped[Optional[text]]
|
1313
1333
|
|
1314
1334
|
submitted_by: Mapped[text]
|
1315
1335
|
submitter_validated: Mapped[Optional[bool]] = mapped_column(Boolean, default=False)
|
f3_data_models/testing.py
CHANGED
@@ -1,12 +1,24 @@
|
|
1
|
-
from
|
1
|
+
from datetime import date
|
2
|
+
|
3
|
+
from sqlalchemy import or_
|
4
|
+
|
5
|
+
from f3_data_models.models import Event, Org
|
2
6
|
from f3_data_models.utils import DbManager
|
3
7
|
|
4
8
|
|
5
|
-
def
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
+
def test():
|
10
|
+
org_id = 25272
|
11
|
+
event_records = DbManager.find_records(
|
12
|
+
Event,
|
13
|
+
filters=[
|
14
|
+
Event.is_active,
|
15
|
+
or_(Event.org_id == org_id, Event.org.has(Org.parent_id == org_id)),
|
16
|
+
or_(Event.end_date >= date.today(), Event.end_date.is_(None)),
|
17
|
+
],
|
18
|
+
joinedloads="all",
|
19
|
+
)
|
20
|
+
print(f"Found {len(event_records)} active events for org_id {org_id}.")
|
9
21
|
|
10
22
|
|
11
23
|
if __name__ == "__main__":
|
12
|
-
|
24
|
+
test()
|
@@ -0,0 +1,7 @@
|
|
1
|
+
f3_data_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
+
f3_data_models/models.py,sha256=1XEgYQd64FJAU-scqSI7MpXiSTCUR_8dRVVX3G5rwIU,52240
|
3
|
+
f3_data_models/testing.py,sha256=uHHgrfMOpUvu6-yOyuMsGadyeN-zuAFRYuGQNpXX4Lk,598
|
4
|
+
f3_data_models/utils.py,sha256=LBNy7BXwRY0tqNKGUBoYi6-1Ch9dSLjGysLoes1Jfys,12083
|
5
|
+
f3_data_models-0.5.10.dist-info/METADATA,sha256=uuQRjzE1kQpibkUvE-uZD10xdqRc3UBbxzFODFWSMT4,2767
|
6
|
+
f3_data_models-0.5.10.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
7
|
+
f3_data_models-0.5.10.dist-info/RECORD,,
|
@@ -1,7 +0,0 @@
|
|
1
|
-
f3_data_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
f3_data_models/models.py,sha256=Nd57_jd5lkVbTfj2CZ_Eg4AfVVa7QjK86Ko7qYlrT1I,51616
|
3
|
-
f3_data_models/testing.py,sha256=xDTZdEo5BXx8zzXCBsadxtN2wNnK9tj0w_HYL3pFl3A,314
|
4
|
-
f3_data_models/utils.py,sha256=LBNy7BXwRY0tqNKGUBoYi6-1Ch9dSLjGysLoes1Jfys,12083
|
5
|
-
f3_data_models-0.5.7.dist-info/METADATA,sha256=9K6BEPYZ0OIEl41sX7IBZcyjOuUNRPyCVVYJo4CjUvM,2766
|
6
|
-
f3_data_models-0.5.7.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
|
7
|
-
f3_data_models-0.5.7.dist-info/RECORD,,
|