f3-data-models 0.5.16__py3-none-any.whl → 0.6.0__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
@@ -23,6 +23,7 @@ from sqlalchemy import (
23
23
  func,
24
24
  inspect,
25
25
  )
26
+ from sqlalchemy.dialects.postgresql import JSONB
26
27
  from sqlalchemy.orm import (
27
28
  DeclarativeBase,
28
29
  Mapped,
@@ -49,6 +50,21 @@ dt_update = Annotated[
49
50
  ]
50
51
 
51
52
 
53
+ class Codex_Submission_Status(enum.Enum):
54
+ """
55
+ Enum representing the status of a codex submission.
56
+
57
+ Attributes:
58
+ pending
59
+ approved
60
+ rejected
61
+ """
62
+
63
+ pending = 1
64
+ approved = 2
65
+ rejected = 3
66
+
67
+
52
68
  class User_Status(enum.Enum):
53
69
  """
54
70
  Enum representing the status of a user.
@@ -1113,6 +1129,8 @@ class Achievement_x_User(Base):
1113
1129
  Attributes:
1114
1130
  achievement_id (int): The ID of the associated achievement.
1115
1131
  user_id (int): The ID of the associated user.
1132
+ award_year (int): The year the achievement was awarded. Default is -1 (used for lifetime achievements).
1133
+ award_period (int): The period (ie week, month) the achievement was awarded in. Default is -1 (used for lifetime achievements).
1116
1134
  date_awarded (date): The date the achievement was awarded. Default is the current date.
1117
1135
  """ # noqa: E501
1118
1136
 
@@ -1120,6 +1138,8 @@ class Achievement_x_User(Base):
1120
1138
 
1121
1139
  achievement_id: Mapped[int] = mapped_column(ForeignKey("achievements.id"), primary_key=True)
1122
1140
  user_id: Mapped[int] = mapped_column(ForeignKey("users.id"), primary_key=True)
1141
+ award_year: Mapped[int] = mapped_column(Integer, primary_key=True, server_default="-1")
1142
+ award_period: Mapped[int] = mapped_column(Integer, primary_key=True, server_default="-1")
1123
1143
  date_awarded: Mapped[date] = mapped_column(DateTime, server_default=func.timezone("utc", func.now()))
1124
1144
 
1125
1145
 
@@ -1397,3 +1417,166 @@ class UpdateRequest(Base):
1397
1417
  request_type: Mapped[Request_Type]
1398
1418
  created: Mapped[dt_create]
1399
1419
  updated: Mapped[dt_update]
1420
+
1421
+
1422
+ # -- Main table for entries
1423
+ # CREATE TABLE IF NOT EXISTS codex_entries (
1424
+ # id SERIAL PRIMARY KEY,
1425
+ # title VARCHAR(255) NOT NULL,
1426
+ # definition TEXT NOT NULL,
1427
+ # type VARCHAR(50) NOT NULL,
1428
+ # aliases JSONB DEFAULT '[]'::jsonb,
1429
+ # video_link TEXT,
1430
+ # updated_at TIMESTAMP NOT NULL DEFAULT now()
1431
+ # );
1432
+
1433
+ # -- Tags used to categorize entries
1434
+ # CREATE TABLE IF NOT EXISTS codex_tags (
1435
+ # id SERIAL PRIMARY KEY,
1436
+ # name VARCHAR(255) UNIQUE NOT NULL
1437
+ # );
1438
+
1439
+ # -- Many-to-many relationship between entries and tags
1440
+ # CREATE TABLE IF NOT EXISTS codex_entry_tags (
1441
+ # entry_id INTEGER NOT NULL REFERENCES entries(id) ON DELETE CASCADE,
1442
+ # tag_id INTEGER NOT NULL REFERENCES tags(id) ON DELETE CASCADE,
1443
+ # PRIMARY KEY (entry_id, tag_id)
1444
+ # );
1445
+
1446
+ # -- User-submitted suggestions (entries, edits, tags, etc.)
1447
+ # CREATE TABLE IF NOT EXISTS codex_user_submissions (
1448
+ # id SERIAL PRIMARY KEY,
1449
+ # submission_type VARCHAR(50) NOT NULL,
1450
+ # data JSONB NOT NULL,
1451
+ # submitter_name VARCHAR(255),
1452
+ # submitter_email VARCHAR(255),
1453
+ # timestamp TIMESTAMP NOT NULL DEFAULT now(),
1454
+ # status VARCHAR(50) NOT NULL DEFAULT 'pending'
1455
+ # );
1456
+
1457
+ # -- Internal linking between entries
1458
+
1459
+ # CREATE TABLE IF NOT EXISTS codex_references (
1460
+ # id SERIAL PRIMARY KEY,
1461
+ # from_entry_id INTEGER NOT NULL REFERENCES entries(id) ON DELETE CASCADE,
1462
+ # to_entry_id INTEGER NOT NULL REFERENCES entries(id) ON DELETE CASCADE,
1463
+ # context TEXT,
1464
+ # created_at TIMESTAMP NOT NULL DEFAULT now()
1465
+ # );
1466
+
1467
+
1468
+ class CodexEntry(Base):
1469
+ """
1470
+ Model representing a Codex entry.
1471
+
1472
+ Attributes:
1473
+ id (int): Primary Key of the model.
1474
+ title (str): The title of the entry.
1475
+ definition (text): The definition of the entry.
1476
+ type (str): The type of the entry.
1477
+ aliases (Optional[List[str]]): Aliases for the entry.
1478
+ video_link (Optional[str]): A link to a video related to the entry.
1479
+ created (datetime): The timestamp when the record was created.
1480
+ updated (datetime): The timestamp when the record was last updated.
1481
+ """ # noqa: E501
1482
+
1483
+ __tablename__ = "codex_entries"
1484
+
1485
+ id: Mapped[intpk]
1486
+ title: Mapped[str]
1487
+ definition: Mapped[text]
1488
+ type: Mapped[str]
1489
+ aliases: Mapped[Optional[List[str]]] = mapped_column(JSONB, server_default="[]")
1490
+ video_link: Mapped[Optional[str]]
1491
+ created: Mapped[dt_create]
1492
+ updated: Mapped[dt_update]
1493
+
1494
+
1495
+ class CodexTag(Base):
1496
+ """
1497
+ Model representing a Codex tag.
1498
+
1499
+ Attributes:
1500
+ id (int): Primary Key of the model.
1501
+ name (str): The name of the tag.
1502
+ created (datetime): The timestamp when the record was created.
1503
+ updated (datetime): The timestamp when the record was last updated.
1504
+ """ # noqa: E501
1505
+
1506
+ __tablename__ = "codex_tags"
1507
+
1508
+ id: Mapped[intpk]
1509
+ name: Mapped[str] = mapped_column(VARCHAR, unique=True, nullable=False)
1510
+ created: Mapped[dt_create]
1511
+ updated: Mapped[dt_update]
1512
+
1513
+
1514
+ class CodexEntryTag(Base):
1515
+ """
1516
+ Model representing the association between Codex entries and tags.
1517
+
1518
+ Attributes:
1519
+ entry_id (int): The ID of the associated Codex entry.
1520
+ tag_id (int): The ID of the associated Codex tag.
1521
+ """ # noqa: E501
1522
+
1523
+ __tablename__ = "codex_entry_tags"
1524
+
1525
+ entry_id: Mapped[int] = mapped_column(ForeignKey("codex_entries.id", ondelete="CASCADE"), primary_key=True)
1526
+ tag_id: Mapped[int] = mapped_column(ForeignKey("codex_tags.id", ondelete="CASCADE"), primary_key=True)
1527
+
1528
+
1529
+ class CodexUserSubmission(Base):
1530
+ """
1531
+ Model representing a user submission for the Codex.
1532
+
1533
+ Attributes:
1534
+ id (int): Primary Key of the model.
1535
+ submission_type (str): The type of the submission (e.g., 'entry', 'edit', 'tag').
1536
+ data (Dict[str, Any]): The data of the submission in JSON format.
1537
+ submitter_name (Optional[str]): The name of the submitter.
1538
+ submitter_email (Optional[str]): The email of the submitter.
1539
+ submitter_user_id (Optional[int]): The ID of the associated user, if available.
1540
+ timestamp (datetime): The timestamp when the submission was made.
1541
+ status (str): The status of the submission (e.g., 'pending', 'approved', 'rejected').
1542
+ created (datetime): The timestamp when the record was created.
1543
+ updated (datetime): The timestamp when the record was last updated.
1544
+ """ # noqa: E501
1545
+
1546
+ __tablename__ = "codex_user_submissions"
1547
+
1548
+ id: Mapped[intpk]
1549
+ submission_type: Mapped[str]
1550
+ data: Mapped[Dict[str, Any]] = mapped_column(JSON)
1551
+ submitter_name: Mapped[Optional[str]]
1552
+ submitter_email: Mapped[Optional[str]]
1553
+ submitter_user_id: Mapped[Optional[int]] = mapped_column(ForeignKey("users.id"))
1554
+ timestamp: Mapped[dt_create]
1555
+ status: Mapped[Codex_Submission_Status] = mapped_column(
1556
+ Enum(Codex_Submission_Status), default=Codex_Submission_Status.pending
1557
+ )
1558
+ created: Mapped[dt_create]
1559
+ updated: Mapped[dt_update]
1560
+
1561
+
1562
+ class CodexReference(Base):
1563
+ """
1564
+ Model representing a reference between Codex entries.
1565
+
1566
+ Attributes:
1567
+ id (int): Primary Key of the model.
1568
+ from_entry_id (int): The ID of the entry from which the reference originates.
1569
+ to_entry_id (int): The ID of the entry to which the reference points.
1570
+ context (Optional[str]): Context or description of the reference.
1571
+ created (datetime): The timestamp when the reference was created.
1572
+ updated (datetime): The timestamp when the record was last updated.
1573
+ """ # noqa: E501
1574
+
1575
+ __tablename__ = "codex_references"
1576
+
1577
+ id: Mapped[intpk]
1578
+ from_entry_id: Mapped[int] = mapped_column(ForeignKey("codex_entries.id", ondelete="CASCADE"))
1579
+ to_entry_id: Mapped[int] = mapped_column(ForeignKey("codex_entries.id", ondelete="CASCADE"))
1580
+ context: Mapped[Optional[str]]
1581
+ created: Mapped[dt_create]
1582
+ updated: Mapped[dt_update]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: f3-data-models
3
- Version: 0.5.16
3
+ Version: 0.6.0
4
4
  Summary: The data schema and models for F3 Nation applications.
5
5
  License: MIT
6
6
  Author: Evan Petzoldt
@@ -0,0 +1,7 @@
1
+ f3_data_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ f3_data_models/models.py,sha256=4LJ-t43h1iKceag7pQShV8sBXIPAO31cOhU96rnROas,61177
3
+ f3_data_models/testing.py,sha256=uHHgrfMOpUvu6-yOyuMsGadyeN-zuAFRYuGQNpXX4Lk,598
4
+ f3_data_models/utils.py,sha256=5ijpywxWMZZ5TZr7L7rLjs3QVsAHFvTQLtsrzIcnm04,12153
5
+ f3_data_models-0.6.0.dist-info/METADATA,sha256=wEiAnICuNck_4800TTWPKwTW1Ir2FzXYE3G1n01BKi0,3674
6
+ f3_data_models-0.6.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
7
+ f3_data_models-0.6.0.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=CjGVbV6Y8XlO8ZqvsQcvKlWoWqzB8VT6vg0IqmXqklo,54659
3
- f3_data_models/testing.py,sha256=uHHgrfMOpUvu6-yOyuMsGadyeN-zuAFRYuGQNpXX4Lk,598
4
- f3_data_models/utils.py,sha256=5ijpywxWMZZ5TZr7L7rLjs3QVsAHFvTQLtsrzIcnm04,12153
5
- f3_data_models-0.5.16.dist-info/METADATA,sha256=qT3g2ypSghP5ihJVzN7V_0kwPwLpRs3mpGatyoEMjWI,3675
6
- f3_data_models-0.5.16.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
7
- f3_data_models-0.5.16.dist-info/RECORD,,