f3-data-models 0.1.5__tar.gz → 0.1.7__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: f3-data-models
3
- Version: 0.1.5
3
+ Version: 0.1.7
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
@@ -10,6 +10,7 @@ from sqlalchemy import (
10
10
  ForeignKey,
11
11
  Integer,
12
12
  func,
13
+ UniqueConstraint,
13
14
  )
14
15
  from typing_extensions import Annotated
15
16
  from sqlalchemy.orm import (
@@ -308,7 +309,7 @@ class EventType(Base):
308
309
  id (int): Primary Key of the model.
309
310
  name (str): The name of the event type.
310
311
  description (Optional[text]): A description of the event type.
311
- acronyms (Optional[str]): Acronyms associated with the event type.
312
+ acronym (Optional[str]): Acronyms associated with the event type.
312
313
  category_id (int): The ID of the associated event category.
313
314
  created (datetime): The timestamp when the record was created.
314
315
  updated (datetime): The timestamp when the record was last updated.
@@ -319,7 +320,7 @@ class EventType(Base):
319
320
  id: Mapped[intpk]
320
321
  name: Mapped[str]
321
322
  description: Mapped[Optional[text]]
322
- acronyms: Mapped[Optional[str]]
323
+ acronym: Mapped[Optional[str]]
323
324
  category_id: Mapped[int] = mapped_column(ForeignKey("event_categories.id"))
324
325
  created: Mapped[dt_create]
325
326
  updated: Mapped[dt_update]
@@ -420,7 +421,7 @@ class EventTag_x_Org(Base):
420
421
  color_override: Mapped[Optional[str]]
421
422
 
422
423
 
423
- class Org_x_Slack(Base):
424
+ class Org_x_SlackSpace(Base):
424
425
  """
425
426
  Model representing the association between organizations and Slack workspaces. This is currently meant to be one to one, but theoretically could support multiple workspaces per organization.
426
427
 
@@ -429,10 +430,10 @@ class Org_x_Slack(Base):
429
430
  slack_space_id (str): The ID of the associated Slack workspace.
430
431
  """
431
432
 
432
- __tablename__ = "org_x_slack"
433
+ __tablename__ = "orgs_x_slack_spaces"
433
434
 
434
435
  org_id: Mapped[int] = mapped_column(ForeignKey("orgs.id"), primary_key=True)
435
- slack_space_id: Mapped[str] = mapped_column(
436
+ slack_space_id: Mapped[int] = mapped_column(
436
437
  ForeignKey("slack_spaces.id"), primary_key=True
437
438
  )
438
439
 
@@ -568,9 +569,9 @@ class Attendance(Base):
568
569
  Model representing an attendance record.
569
570
 
570
571
  Attributes:
572
+ id (int): Primary Key of the model.
571
573
  event_id (int): The ID of the associated event.
572
574
  user_id (Optional[int]): The ID of the associated user.
573
- attendance_type_id (int): The ID of the associated attendance type.
574
575
  is_planned (bool): Whether this is planned attendance (True) vs actual attendance (False).
575
576
  meta (Optional[Dict[str, Any]]): Additional metadata for the attendance.
576
577
  created (datetime): The timestamp when the record was created.
@@ -578,16 +579,34 @@ class Attendance(Base):
578
579
  """
579
580
 
580
581
  __tablename__ = "attendance"
582
+ __table_args__ = (UniqueConstraint("event_id", "user_id", "is_planned"),)
581
583
 
582
- event_id: Mapped[int] = mapped_column(ForeignKey("events.id"), primary_key=True)
583
- user_id: Mapped[Optional[int]] = mapped_column(
584
- ForeignKey("users.id"), primary_key=True
585
- ) # NOTE: Should this be optional?
584
+ id: Mapped[intpk]
585
+ event_id: Mapped[int] = mapped_column(ForeignKey("events.id"))
586
+ user_id: Mapped[int] = mapped_column(ForeignKey("users.id"))
587
+ is_planned: Mapped[bool]
588
+ meta: Mapped[Optional[Dict[str, Any]]]
589
+ created: Mapped[dt_create]
590
+ updated: Mapped[dt_update]
591
+
592
+
593
+ class Attendance_x_AttenanceType(Base):
594
+ """
595
+ Model representing the association between attendance and attendance types.
596
+
597
+ Attributes:
598
+ attendance_id (int): The ID of the associated attendance.
599
+ attendance_type_id (int): The ID of the associated attendance type.
600
+ """
601
+
602
+ __tablename__ = "attendance_x_attendance_types"
603
+
604
+ attendance_id: Mapped[int] = mapped_column(
605
+ ForeignKey("attendance.id"), primary_key=True
606
+ )
586
607
  attendance_type_id: Mapped[int] = mapped_column(
587
608
  ForeignKey("attendance_types.id"), primary_key=True
588
609
  )
589
- is_planned: Mapped[bool] = mapped_column(Boolean, primary_key=True)
590
- meta: Mapped[Optional[Dict[str, Any]]]
591
610
 
592
611
 
593
612
  class User(Base):
@@ -616,6 +635,9 @@ class User(Base):
616
635
  last_name: Mapped[Optional[str]]
617
636
  email: Mapped[str] = mapped_column(VARCHAR, unique=True)
618
637
  phone: Mapped[Optional[str]]
638
+ emergency_contact: Mapped[Optional[str]]
639
+ emergency_phone: Mapped[Optional[str]]
640
+ emergency_notes: Mapped[Optional[str]]
619
641
  home_region_id: Mapped[Optional[int]] = mapped_column(ForeignKey("orgs.id"))
620
642
  avatar_url: Mapped[Optional[str]]
621
643
  meta: Mapped[Optional[Dict[str, Any]]]
@@ -826,65 +848,6 @@ class Expansion_x_User(Base):
826
848
  notes: Mapped[Optional[text]]
827
849
 
828
850
 
829
- # def upgrade() -> None:
830
- # # ### commands auto generated by Alembic - please adjust! ###
831
- # op.create_table(
832
- # "magiclinkauthrecord",
833
- # sa.Column("id", sa.Integer(), nullable=False),
834
- # sa.Column("email", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
835
- # sa.Column("otp_hash", sa.LargeBinary(), nullable=False),
836
- # sa.Column(
837
- # "created",
838
- # sa.DateTime(timezone=True),
839
- # server_default=sa.text("(CURRENT_TIMESTAMP)"),
840
- # nullable=False,
841
- # ),
842
- # sa.Column(
843
- # "expiration",
844
- # sa.DateTime(timezone=True),
845
- # server_default=sa.text("(CURRENT_TIMESTAMP)"),
846
- # nullable=False,
847
- # ),
848
- # sa.Column("client_ip", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
849
- # sa.Column("recent_attempts", sa.Integer(), nullable=False),
850
- # sa.PrimaryKeyConstraint("id"),
851
- # )
852
- # op.create_table(
853
- # "magiclinkauthsession",
854
- # sa.Column("id", sa.Integer(), nullable=False),
855
- # sa.Column("email", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
856
- # sa.Column("persistent_id", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
857
- # sa.Column("session_token", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
858
- # sa.Column(
859
- # "created",
860
- # sa.DateTime(timezone=True),
861
- # server_default=sa.text("(CURRENT_TIMESTAMP)"),
862
- # nullable=False,
863
- # ),
864
- # sa.Column(
865
- # "expiration",
866
- # sa.DateTime(timezone=True),
867
- # server_default=sa.text("(CURRENT_TIMESTAMP)"),
868
- # nullable=False,
869
- # ),
870
- # sa.PrimaryKeyConstraint("id"),
871
- # )
872
- # with op.batch_alter_table("magiclinkauthsession", schema=None) as batch_op:
873
- # batch_op.create_index(
874
- # batch_op.f("ix_magiclinkauthsession_email"), ["email"], unique=False
875
- # )
876
- # batch_op.create_index(
877
- # batch_op.f("ix_magiclinkauthsession_persistent_id"),
878
- # ["persistent_id"],
879
- # unique=False,
880
- # )
881
- # batch_op.create_index(
882
- # batch_op.f("ix_magiclinkauthsession_session_token"),
883
- # ["session_token"],
884
- # unique=True,
885
- # )
886
-
887
-
888
851
  class MagicLinkAuthRecord(Base):
889
852
  """
890
853
  Model representing a Magic Link Auth Record.
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "f3-data-models"
3
- version = "0.1.5"
3
+ version = "0.1.7"
4
4
  description = "The data schema and models for F3 Nation applications."
5
5
  authors = ["Evan Petzoldt <evan.petzoldt@protonmail.com>"]
6
6
  readme = "README.md"
File without changes