f3-data-models 0.3.8__tar.gz → 0.4.0__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.3
2
2
  Name: f3-data-models
3
- Version: 0.3.8
3
+ Version: 0.4.0
4
4
  Summary: The data schema and models for F3 Nation applications.
5
5
  License: MIT
6
6
  Author: Evan Petzoldt
@@ -1,6 +1,5 @@
1
1
  from datetime import datetime, date, time
2
2
  from typing import Any, Dict, List, Optional
3
- import uuid
4
3
  from sqlalchemy import (
5
4
  ARRAY,
6
5
  JSON,
@@ -32,6 +31,7 @@ import enum
32
31
  # Custom Annotations
33
32
  time_notz = Annotated[time, TIME(timezone=False)]
34
33
  time_with_tz = Annotated[time, TIME(timezone=True)]
34
+ ts_notz = Annotated[datetime, DateTime(timezone=False)]
35
35
  text = Annotated[str, TEXT]
36
36
  intpk = Annotated[int, mapped_column(Integer, primary_key=True, autoincrement=True)]
37
37
  dt_create = Annotated[
@@ -663,10 +663,13 @@ class Event(Base):
663
663
  secondary="event_tags_x_events", cascade="expunge", viewonly=True
664
664
  )
665
665
  event_x_event_types: Mapped[List[EventType_x_Event]] = relationship(
666
- back_populates="event"
666
+ back_populates="event", cascade="save-update, merge, delete"
667
667
  )
668
668
  event_x_event_tags: Mapped[Optional[List[EventTag_x_Event]]] = relationship(
669
- back_populates="event"
669
+ back_populates="event", cascade="save-update, merge, delete"
670
+ )
671
+ attendance: Mapped[List["Attendance"]] = relationship(
672
+ back_populates="event", cascade="expunge, delete"
670
673
  )
671
674
 
672
675
 
@@ -841,7 +844,7 @@ class Attendance(Base):
841
844
  innerjoin=False, cascade="expunge", secondary="users", viewonly=True
842
845
  )
843
846
  attendance_x_attendance_types: Mapped[List[Attendance_x_AttendanceType]] = (
844
- relationship(back_populates="attendance")
847
+ relationship(back_populates="attendance", cascade="save-update, merge, delete")
845
848
  )
846
849
  attendance_types: Mapped[List[AttendanceType]] = relationship(
847
850
  secondary="attendance_x_attendance_types",
@@ -1002,7 +1005,7 @@ class NextAuthAccount(Base):
1002
1005
  provider (text): The provider of the account.
1003
1006
  provider_account_id (text): The provider account ID.
1004
1007
  refresh_token (Optional[text]): The refresh token.
1005
- access_token (text): The access token.
1008
+ access_token (Optional[text]): The access token.
1006
1009
  expires_at (Optional[datetime]): The expiration time of the token.
1007
1010
  token_type (Optional[text]): The token type.
1008
1011
  scope (Optional[text]): The scope of the token.
@@ -1019,7 +1022,7 @@ class NextAuthAccount(Base):
1019
1022
  provider: Mapped[text] = mapped_column(VARCHAR, primary_key=True)
1020
1023
  provider_account_id: Mapped[text] = mapped_column(VARCHAR, primary_key=True)
1021
1024
  refresh_token: Mapped[Optional[text]]
1022
- access_token: Mapped[text]
1025
+ access_token: Mapped[Optional[text]]
1023
1026
  expires_at: Mapped[Optional[datetime]]
1024
1027
  token_type: Mapped[Optional[text]]
1025
1028
  scope: Mapped[Optional[text]]
@@ -1036,7 +1039,7 @@ class NextAuthSession(Base):
1036
1039
  Attributes:
1037
1040
  session_token (text): The session token.
1038
1041
  user_id (int): The ID of the associated user.
1039
- expires (date): The expiration time of the session.
1042
+ expires (ts_notz): The expiration time of the session.
1040
1043
  created (datetime): The timestamp when the record was created.
1041
1044
  updated (datetime): The timestamp when the record was last updated.
1042
1045
  """
@@ -1044,8 +1047,8 @@ class NextAuthSession(Base):
1044
1047
  __tablename__ = "auth_sessions"
1045
1048
 
1046
1049
  session_token: Mapped[text] = mapped_column(TEXT, primary_key=True)
1047
- user_id: Mapped[int] = mapped_column(ForeignKey("users.id"))
1048
- expires: Mapped[date]
1050
+ user_id: Mapped[int] = mapped_column(ForeignKey("users.id", ondelete="CASCADE"))
1051
+ expires: Mapped[ts_notz]
1049
1052
  created: Mapped[dt_create]
1050
1053
  updated: Mapped[dt_update]
1051
1054
 
@@ -1057,7 +1060,7 @@ class NextAuthVerificationToken(Base):
1057
1060
  Attributes:
1058
1061
  identifier (text): The identifier of the token.
1059
1062
  token (text): The token.
1060
- expires (date): The expiration time of the token.
1063
+ expires (ts_notz): The expiration time of the token.
1061
1064
  created (datetime): The timestamp when the record was created.
1062
1065
  updated (datetime): The timestamp when the record was last updated.
1063
1066
  """
@@ -1066,7 +1069,7 @@ class NextAuthVerificationToken(Base):
1066
1069
 
1067
1070
  identifier: Mapped[text] = mapped_column(VARCHAR, primary_key=True)
1068
1071
  token: Mapped[text] = mapped_column(VARCHAR, primary_key=True)
1069
- expires: Mapped[date]
1072
+ expires: Mapped[ts_notz]
1070
1073
  created: Mapped[dt_create]
1071
1074
  updated: Mapped[dt_update]
1072
1075
 
@@ -1093,7 +1096,7 @@ class UpdateRequest(Base):
1093
1096
  event_day_of_week (Optional[Day_Of_Week]): The day of the week of the event.
1094
1097
  event_name (str): The name of the event.
1095
1098
  event_description (Optional[text]): A description of the event.
1096
- event_recurrence_pattern (Optional[str]): The recurrence pattern of the event.
1099
+ event_recurrence_pattern (Optional[Event_Cadence]): The recurrence pattern of the event.
1097
1100
  event_recurrence_interval (Optional[int]): The recurrence interval of the event.
1098
1101
  event_index_within_interval (Optional[int]): The index within the recurrence interval.
1099
1102
  event_meta (Optional[Dict[str, Any]]): Additional metadata for the event.
@@ -1124,7 +1127,9 @@ class UpdateRequest(Base):
1124
1127
  __tablename__ = "update_requests"
1125
1128
 
1126
1129
  id: Mapped[Uuid] = mapped_column(UUID(as_uuid=True), primary_key=True)
1127
- token: Mapped[Uuid] = mapped_column(UUID(as_uuid=True), default=uuid.uuid4)
1130
+ token: Mapped[Uuid] = mapped_column(
1131
+ UUID(as_uuid=True), server_default=func.gen_random_uuid()
1132
+ )
1128
1133
  region_id: Mapped[int] = mapped_column(ForeignKey("orgs.id"))
1129
1134
  event_id: Mapped[Optional[int]] = mapped_column(ForeignKey("events.id"))
1130
1135
  event_type_ids: Mapped[Optional[List[int]]] = mapped_column(ARRAY(Integer))
@@ -1140,7 +1145,7 @@ class UpdateRequest(Base):
1140
1145
  event_day_of_week: Mapped[Optional[Day_Of_Week]]
1141
1146
  event_name: Mapped[str]
1142
1147
  event_description: Mapped[Optional[text]]
1143
- event_recurrence_pattern: Mapped[Optional[str]] = mapped_column(VARCHAR(length=30))
1148
+ event_recurrence_pattern: Mapped[Optional[Event_Cadence]]
1144
1149
  event_recurrence_interval: Mapped[Optional[int]]
1145
1150
  event_index_within_interval: Mapped[Optional[int]]
1146
1151
  event_meta: Mapped[Optional[Dict[str, Any]]]
@@ -12,7 +12,7 @@ def test_update_event():
12
12
  highlight=True,
13
13
  start_date=datetime.date(2025, 2, 17),
14
14
  end_date=datetime.date(2026, 2, 17),
15
- start_time="0500",
15
+ start_time="0400",
16
16
  end_time="0600",
17
17
  event_x_event_types=[
18
18
  EventType_x_Event(event_type_id=3),
@@ -24,9 +24,10 @@ def test_update_event():
24
24
  name="Test Event",
25
25
  )
26
26
  update_dict = event.to_update_dict()
27
- DbManager.update_records(Event, [Event.id == 3], update_dict)
27
+ DbManager.update_record(Event, 3, update_dict)
28
28
 
29
- event = DbManager.get(Event, 3)
29
+ # event = DbManager.get(Event, 3)
30
+ DbManager.delete_records(Event, [Event.series_id == 3])
30
31
 
31
32
 
32
33
  if __name__ == "__main__":
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "f3-data-models"
3
- version = "0.3.8"
3
+ version = "0.4.0"
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