f3-data-models 0.1.8__py3-none-any.whl → 0.1.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 CHANGED
@@ -6,11 +6,9 @@ from sqlalchemy import (
6
6
  TIME,
7
7
  VARCHAR,
8
8
  Boolean,
9
- Column,
10
9
  DateTime,
11
10
  ForeignKey,
12
11
  Integer,
13
- Table,
14
12
  func,
15
13
  UniqueConstraint,
16
14
  )
@@ -259,30 +257,6 @@ class Role_x_User_x_Org(Base):
259
257
  org_id: Mapped[int] = mapped_column(ForeignKey("orgs.id"), primary_key=True)
260
258
 
261
259
 
262
- event_type_x_org_table = Table(
263
- "event_types_x_org",
264
- Base.metadata,
265
- Column("event_type_id", Integer, ForeignKey("event_types.id"), primary_key=True),
266
- Column("org_id", Integer, ForeignKey("orgs.id"), primary_key=True),
267
- Column("is_default", Boolean, default=False, nullable=False),
268
- )
269
-
270
- event_tag_x_org_table = Table(
271
- "event_tags_x_org",
272
- Base.metadata,
273
- Column("event_tag_id", Integer, ForeignKey("event_tags.id"), primary_key=True),
274
- Column("org_id", Integer, ForeignKey("orgs.id"), primary_key=True),
275
- Column("color_override", VARCHAR),
276
- )
277
-
278
- achievement_x_org_table = Table(
279
- "achievements_x_org",
280
- Base.metadata,
281
- Column("achievement_id", Integer, ForeignKey("achievements.id"), primary_key=True),
282
- Column("org_id", Integer, ForeignKey("orgs.id"), primary_key=True),
283
- )
284
-
285
-
286
260
  class Org(Base):
287
261
  """
288
262
  Model representing an organization. The same model is used for all levels of organization (AOs, Regions, etc.).
@@ -328,13 +302,13 @@ class Org(Base):
328
302
  updated: Mapped[dt_update]
329
303
 
330
304
  event_types: Mapped[Optional[List["EventType"]]] = relationship(
331
- "EventType", secondary=event_type_x_org_table, cascade="expunge"
305
+ "EventType", secondary="event_types_x_org", cascade="expunge"
332
306
  )
333
307
  event_tags: Mapped[Optional[List["EventTag"]]] = relationship(
334
- "EventTag", secondary=event_tag_x_org_table, cascade="expunge"
308
+ "EventTag", secondary="event_tags_x_org", cascade="expunge"
335
309
  )
336
310
  achievements: Mapped[Optional[List["Achievement"]]] = relationship(
337
- "Achievement", secondary=achievement_x_org_table, cascade="expunge"
311
+ "Achievement", secondary="achievements_x_org", cascade="expunge"
338
312
  )
339
313
  parent_org: Mapped[Optional["Org"]] = relationship(
340
314
  "Org", remote_side=[id], cascade="expunge"
@@ -366,40 +340,40 @@ class EventType(Base):
366
340
  updated: Mapped[dt_update]
367
341
 
368
342
 
369
- # class EventType_x_Event(Base):
370
- # """
371
- # Model representing the association between events and event types. The intention is that a single event can be associated with multiple event types.
343
+ class EventType_x_Event(Base):
344
+ """
345
+ Model representing the association between events and event types. The intention is that a single event can be associated with multiple event types.
372
346
 
373
- # Attributes:
374
- # event_id (int): The ID of the associated event.
375
- # event_type_id (int): The ID of the associated event type.
376
- # """
347
+ Attributes:
348
+ event_id (int): The ID of the associated event.
349
+ event_type_id (int): The ID of the associated event type.
350
+ """
377
351
 
378
- # __tablename__ = "events_x_event_types"
352
+ __tablename__ = "events_x_event_types"
379
353
 
380
- # event_id: Mapped[int] = mapped_column(ForeignKey("events.id"), primary_key=True)
381
- # event_type_id: Mapped[int] = mapped_column(
382
- # ForeignKey("event_types.id"), primary_key=True
383
- # )
354
+ event_id: Mapped[int] = mapped_column(ForeignKey("events.id"), primary_key=True)
355
+ event_type_id: Mapped[int] = mapped_column(
356
+ ForeignKey("event_types.id"), primary_key=True
357
+ )
384
358
 
385
359
 
386
- # class EventType_x_Org(Base):
387
- # """
388
- # Model representing the association between event types and organizations. This controls which event types are available for selection at the region level, as well as default types for each AO.
360
+ class EventType_x_Org(Base):
361
+ """
362
+ Model representing the association between event types and organizations. This controls which event types are available for selection at the region level, as well as default types for each AO.
389
363
 
390
- # Attributes:
391
- # event_type_id (int): The ID of the associated event type.
392
- # org_id (int): The ID of the associated organization.
393
- # is_default (bool): Whether this is the default event type for the organization. Default is False.
394
- # """
364
+ Attributes:
365
+ event_type_id (int): The ID of the associated event type.
366
+ org_id (int): The ID of the associated organization.
367
+ is_default (bool): Whether this is the default event type for the organization. Default is False.
368
+ """
395
369
 
396
- # __tablename__ = "event_types_x_org"
370
+ __tablename__ = "event_types_x_org"
397
371
 
398
- # event_type_id: Mapped[int] = mapped_column(
399
- # ForeignKey("event_types.id"), primary_key=True
400
- # )
401
- # org_id: Mapped[int] = mapped_column(ForeignKey("orgs.id"), primary_key=True)
402
- # is_default: Mapped[bool] = mapped_column(Boolean, default=False)
372
+ event_type_id: Mapped[int] = mapped_column(
373
+ ForeignKey("event_types.id"), primary_key=True
374
+ )
375
+ org_id: Mapped[int] = mapped_column(ForeignKey("orgs.id"), primary_key=True)
376
+ is_default: Mapped[bool] = mapped_column(Boolean, default=False)
403
377
 
404
378
 
405
379
  class EventTag(Base):
@@ -425,40 +399,40 @@ class EventTag(Base):
425
399
  updated: Mapped[dt_update]
426
400
 
427
401
 
428
- # class EventTag_x_Event(Base):
429
- # """
430
- # Model representing the association between event tags and events. The intention is that a single event can be associated with multiple event tags.
402
+ class EventTag_x_Event(Base):
403
+ """
404
+ Model representing the association between event tags and events. The intention is that a single event can be associated with multiple event tags.
431
405
 
432
- # Attributes:
433
- # event_id (int): The ID of the associated event.
434
- # event_tag_id (int): The ID of the associated event tag.
435
- # """
406
+ Attributes:
407
+ event_id (int): The ID of the associated event.
408
+ event_tag_id (int): The ID of the associated event tag.
409
+ """
436
410
 
437
- # __tablename__ = "event_tags_x_events"
411
+ __tablename__ = "event_tags_x_events"
438
412
 
439
- # event_id: Mapped[int] = mapped_column(ForeignKey("events.id"), primary_key=True)
440
- # event_tag_id: Mapped[int] = mapped_column(
441
- # ForeignKey("event_tags.id"), primary_key=True
442
- # )
413
+ event_id: Mapped[int] = mapped_column(ForeignKey("events.id"), primary_key=True)
414
+ event_tag_id: Mapped[int] = mapped_column(
415
+ ForeignKey("event_tags.id"), primary_key=True
416
+ )
443
417
 
444
418
 
445
- # class EventTag_x_Org(Base):
446
- # """
447
- # Model representing the association between event tags and organizations. Controls which event tags are available for selection at the region level.
419
+ class EventTag_x_Org(Base):
420
+ """
421
+ Model representing the association between event tags and organizations. Controls which event tags are available for selection at the region level.
448
422
 
449
- # Attributes:
450
- # event_tag_id (int): The ID of the associated event tag.
451
- # org_id (int): The ID of the associated organization.
452
- # color_override (Optional[str]): The calendar color override for the event tag (if the region wants to use something other than the default).
453
- # """
423
+ Attributes:
424
+ event_tag_id (int): The ID of the associated event tag.
425
+ org_id (int): The ID of the associated organization.
426
+ color_override (Optional[str]): The calendar color override for the event tag (if the region wants to use something other than the default).
427
+ """
454
428
 
455
- # __tablename__ = "event_tags_x_org"
429
+ __tablename__ = "event_tags_x_org"
456
430
 
457
- # event_tag_id: Mapped[int] = mapped_column(
458
- # ForeignKey("event_tags.id"), primary_key=True
459
- # )
460
- # org_id: Mapped[int] = mapped_column(ForeignKey("orgs.id"), primary_key=True)
461
- # color_override: Mapped[Optional[str]]
431
+ event_tag_id: Mapped[int] = mapped_column(
432
+ ForeignKey("event_tags.id"), primary_key=True
433
+ )
434
+ org_id: Mapped[int] = mapped_column(ForeignKey("orgs.id"), primary_key=True)
435
+ color_override: Mapped[Optional[str]]
462
436
 
463
437
 
464
438
  class Org_x_SlackSpace(Base):
@@ -519,21 +493,6 @@ class Location(Base):
519
493
  updated: Mapped[dt_update]
520
494
 
521
495
 
522
- event_x_event_type_table = Table(
523
- "events_x_event_types",
524
- Base.metadata,
525
- Column("event_id", Integer, ForeignKey("events.id"), primary_key=True),
526
- Column("event_type_id", Integer, ForeignKey("event_types.id"), primary_key=True),
527
- )
528
-
529
- event_x_event_tag_table = Table(
530
- "event_tags_x_events",
531
- Base.metadata,
532
- Column("event_id", Integer, ForeignKey("events.id"), primary_key=True),
533
- Column("event_tag_id", Integer, ForeignKey("event_tags.id"), primary_key=True),
534
- )
535
-
536
-
537
496
  class Event(Base):
538
497
  """
539
498
  Model representing an event or series; the same model is used for both with a self-referential relationship for series.
@@ -603,10 +562,10 @@ class Event(Base):
603
562
  org: Mapped[Org] = relationship(innerjoin=True, cascade="expunge")
604
563
  location: Mapped[Location] = relationship(innerjoin=True, cascade="expunge")
605
564
  event_types: Mapped[List[EventType]] = relationship(
606
- secondary=event_x_event_type_table, innerjoin=True, cascade="expunge"
565
+ secondary="events_x_event_types", innerjoin=True, cascade="expunge"
607
566
  )
608
567
  event_tags: Mapped[Optional[List[EventTag]]] = relationship(
609
- secondary=event_x_event_tag_table, cascade="expunge"
568
+ secondary="event_tags_x_events", cascade="expunge"
610
569
  )
611
570
 
612
571
 
@@ -628,32 +587,6 @@ class AttendanceType(Base):
628
587
  updated: Mapped[dt_update]
629
588
 
630
589
 
631
- class Attendance(Base):
632
- """
633
- Model representing an attendance record.
634
-
635
- Attributes:
636
- id (int): Primary Key of the model.
637
- event_id (int): The ID of the associated event.
638
- user_id (Optional[int]): The ID of the associated user.
639
- is_planned (bool): Whether this is planned attendance (True) vs actual attendance (False).
640
- meta (Optional[Dict[str, Any]]): Additional metadata for the attendance.
641
- created (datetime): The timestamp when the record was created.
642
- updated (datetime): The timestamp when the record was last updated.
643
- """
644
-
645
- __tablename__ = "attendance"
646
- __table_args__ = (UniqueConstraint("event_id", "user_id", "is_planned"),)
647
-
648
- id: Mapped[intpk]
649
- event_id: Mapped[int] = mapped_column(ForeignKey("events.id"))
650
- user_id: Mapped[int] = mapped_column(ForeignKey("users.id"))
651
- is_planned: Mapped[bool]
652
- meta: Mapped[Optional[Dict[str, Any]]]
653
- created: Mapped[dt_create]
654
- updated: Mapped[dt_update]
655
-
656
-
657
590
  class Attendance_x_AttenanceType(Base):
658
591
  """
659
592
  Model representing the association between attendance and attendance types.
@@ -756,6 +689,38 @@ class SlackUser(Base):
756
689
  updated: Mapped[dt_update]
757
690
 
758
691
 
692
+ class Attendance(Base):
693
+ """
694
+ Model representing an attendance record.
695
+
696
+ Attributes:
697
+ id (int): Primary Key of the model.
698
+ event_id (int): The ID of the associated event.
699
+ user_id (Optional[int]): The ID of the associated user.
700
+ is_planned (bool): Whether this is planned attendance (True) vs actual attendance (False).
701
+ meta (Optional[Dict[str, Any]]): Additional metadata for the attendance.
702
+ created (datetime): The timestamp when the record was created.
703
+ updated (datetime): The timestamp when the record was last updated.
704
+ """
705
+
706
+ __tablename__ = "attendance"
707
+ __table_args__ = (UniqueConstraint("event_id", "user_id", "is_planned"),)
708
+
709
+ id: Mapped[intpk]
710
+ event_id: Mapped[int] = mapped_column(ForeignKey("events.id"))
711
+ user_id: Mapped[int] = mapped_column(ForeignKey("users.id"))
712
+ is_planned: Mapped[bool]
713
+ meta: Mapped[Optional[Dict[str, Any]]]
714
+ created: Mapped[dt_create]
715
+ updated: Mapped[dt_update]
716
+
717
+ event: Mapped[Event] = relationship(innerjoin=True, cascade="expunge")
718
+ user: Mapped[User] = relationship(innerjoin=True, cascade="expunge", viewonly=True)
719
+ slack_user: Mapped[Optional[SlackUser]] = relationship(
720
+ innerjoin=False, cascade="expunge", secondary="users"
721
+ )
722
+
723
+
759
724
  class Achievement(Base):
760
725
  """
761
726
  Model representing an achievement.
@@ -802,21 +767,21 @@ class Achievement_x_User(Base):
802
767
  )
803
768
 
804
769
 
805
- # class Achievement_x_Org(Base):
806
- # """
807
- # Model representing the association between achievements and organizations.
770
+ class Achievement_x_Org(Base):
771
+ """
772
+ Model representing the association between achievements and organizations.
808
773
 
809
- # Attributes:
810
- # achievement_id (int): The ID of the associated achievement.
811
- # org_id (int): The ID of the associated organization.
812
- # """
774
+ Attributes:
775
+ achievement_id (int): The ID of the associated achievement.
776
+ org_id (int): The ID of the associated organization.
777
+ """
813
778
 
814
- # __tablename__ = "achievements_x_org"
779
+ __tablename__ = "achievements_x_org"
815
780
 
816
- # achievement_id: Mapped[int] = mapped_column(
817
- # ForeignKey("achievements.id"), primary_key=True
818
- # )
819
- # org_id: Mapped[int] = mapped_column(ForeignKey("orgs.id"), primary_key=True)
781
+ achievement_id: Mapped[int] = mapped_column(
782
+ ForeignKey("achievements.id"), primary_key=True
783
+ )
784
+ org_id: Mapped[int] = mapped_column(ForeignKey("orgs.id"), primary_key=True)
820
785
 
821
786
 
822
787
  class Position(Base):
f3_data_models/utils.py CHANGED
@@ -99,7 +99,7 @@ class DbManager:
99
99
  def find_records(
100
100
  cls: T, filters: Optional[List], joinedloads: List | str = []
101
101
  ) -> List[T]:
102
- session = get_session(echo=True)
102
+ session = get_session()
103
103
  try:
104
104
  query = select(cls)
105
105
  query = _joinedloads(cls, query, joinedloads)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: f3-data-models
3
- Version: 0.1.8
3
+ Version: 0.1.10
4
4
  Summary: The data schema and models for F3 Nation applications.
5
5
  Home-page: https://github.com/F3-Nation/f3-data-models
6
6
  License: MIT
@@ -0,0 +1,6 @@
1
+ f3_data_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ f3_data_models/models.py,sha256=hE9vj_orXwtJn0y7tatQ61aK0Dnppyuw-8Xxi6jC53M,34017
3
+ f3_data_models/utils.py,sha256=Jw9YPAfKhsBYZWYilPO87mzrkuZbzDK-NNRBe9ojOsQ,8476
4
+ f3_data_models-0.1.10.dist-info/METADATA,sha256=4gp_tNF0q5lyEpegprWa-tq2AbIoBaCUUpEzI4pRbqc,2714
5
+ f3_data_models-0.1.10.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
6
+ f3_data_models-0.1.10.dist-info/RECORD,,
@@ -1,6 +0,0 @@
1
- f3_data_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- f3_data_models/models.py,sha256=efp_EX23ccgYNNrLTESEGHOg526Al_4ypJ7rlPwQbiE,35195
3
- f3_data_models/utils.py,sha256=r67DFa18kdkugvGcc3gKwpYfGbcl-TPSQIpdfsdgm0Q,8485
4
- f3_data_models-0.1.8.dist-info/METADATA,sha256=_o7MBzD5LAf92bRMwosTPqbjRHKpC54S7-zQHYc4qr4,2713
5
- f3_data_models-0.1.8.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
6
- f3_data_models-0.1.8.dist-info/RECORD,,