f3-data-models 0.5.17__tar.gz → 0.6.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.
- {f3_data_models-0.5.17 → f3_data_models-0.6.0}/PKG-INFO +1 -1
- {f3_data_models-0.5.17 → f3_data_models-0.6.0}/f3_data_models/models.py +179 -0
- {f3_data_models-0.5.17 → f3_data_models-0.6.0}/pyproject.toml +1 -1
- {f3_data_models-0.5.17 → f3_data_models-0.6.0}/README.md +0 -0
- {f3_data_models-0.5.17 → f3_data_models-0.6.0}/f3_data_models/__init__.py +0 -0
- {f3_data_models-0.5.17 → f3_data_models-0.6.0}/f3_data_models/testing.py +0 -0
- {f3_data_models-0.5.17 → f3_data_models-0.6.0}/f3_data_models/utils.py +0 -0
@@ -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.
|
@@ -1401,3 +1417,166 @@ class UpdateRequest(Base):
|
|
1401
1417
|
request_type: Mapped[Request_Type]
|
1402
1418
|
created: Mapped[dt_create]
|
1403
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]
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|