forked from sr2/cloud-api
feat: applied model mixins
IdMixin used on every table with an ID index (no changes needed to db) Timestamp and Deleted mixins applied to org and user tables. ActivatedMixin added to users.
This commit is contained in:
parent
7e1ab6c6ee
commit
c28b4dc37b
6 changed files with 60 additions and 15 deletions
|
|
@ -10,6 +10,8 @@ Models:
|
|||
- groups: Calc property dict of {group_rel.org_rel.name: group_rel.name}
|
||||
"""
|
||||
|
||||
from src.models import IdMixin, ActivatedMixin, TimestampMixin, DeletedTimestampMixin
|
||||
|
||||
from collections import defaultdict
|
||||
|
||||
from sqlalchemy.orm import relationship, mapped_column, Mapped
|
||||
|
|
@ -17,10 +19,9 @@ from sqlalchemy.orm import relationship, mapped_column, Mapped
|
|||
from src.models import CustomBase
|
||||
|
||||
|
||||
class User(CustomBase):
|
||||
class User(CustomBase, IdMixin, ActivatedMixin, TimestampMixin, DeletedTimestampMixin):
|
||||
__tablename__ = "user"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
email: Mapped[str]
|
||||
first_name: Mapped[str]
|
||||
last_name: Mapped[str]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue