f3-data-models 0.1.5__py3-none-any.whl → 0.1.6__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
@@ -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 (
@@ -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):
@@ -826,65 +845,6 @@ class Expansion_x_User(Base):
826
845
  notes: Mapped[Optional[text]]
827
846
 
828
847
 
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
848
  class MagicLinkAuthRecord(Base):
889
849
  """
890
850
  Model representing a Magic Link Auth Record.
@@ -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.6
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=rS9xOfv2V5XNRJP8RDQUddSicF6pasf-lT1IHez2wXo,31940
3
+ f3_data_models/utils.py,sha256=oCxwNORr0-5l0ZugxMYLmKIbmcec-4HEdTSC1pRMoew,8002
4
+ f3_data_models-0.1.6.dist-info/METADATA,sha256=UN1Qgq5Z14VmK-fuYvETmOx1HG4UOK-SU1LiuXH5xdU,2361
5
+ f3_data_models-0.1.6.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
6
+ f3_data_models-0.1.6.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=8_oVajHTePf91I1E4p_HRgCkqb34b956RU_AVGH-Tk0,33782
3
- f3_data_models/utils.py,sha256=oCxwNORr0-5l0ZugxMYLmKIbmcec-4HEdTSC1pRMoew,8002
4
- f3_data_models-0.1.5.dist-info/METADATA,sha256=08RJ4aJCMZp3r7nsnB3dL4jnZRhBhzWIF7k62ZSooYM,2361
5
- f3_data_models-0.1.5.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
6
- f3_data_models-0.1.5.dist-info/RECORD,,