mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: init ug database models + svcs
This commit is contained in:
parent
e763f0933e
commit
e1b3b62e40
5 changed files with 233 additions and 0 deletions
33
apps/api/src/db/usergroups.py
Normal file
33
apps/api/src/db/usergroups.py
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
from typing import Optional
|
||||
from sqlalchemy import Column, ForeignKey, Integer
|
||||
from sqlmodel import Field, SQLModel
|
||||
|
||||
|
||||
class UserGroupBase(SQLModel):
|
||||
name: str
|
||||
description: str
|
||||
|
||||
class UserGroup(UserGroupBase, table=True):
|
||||
id: Optional[int] = Field(default=None, primary_key=True)
|
||||
org_id: int = Field(
|
||||
sa_column=Column(Integer, ForeignKey("organization.id", ondelete="CASCADE"))
|
||||
)
|
||||
usergroup_uuid: str = ""
|
||||
creation_date: str = ""
|
||||
update_date: str = ""
|
||||
|
||||
class UserGroupCreate(UserGroupBase):
|
||||
org_id: int = Field(default=None, foreign_key="organization.id")
|
||||
pass
|
||||
|
||||
class UserGroupUpdate(UserGroupBase):
|
||||
name: str
|
||||
description: str
|
||||
|
||||
class UserGroupRead(UserGroupBase):
|
||||
id: int
|
||||
org_id: int = Field(default=None, foreign_key="organization.id")
|
||||
usergroup_uuid: str
|
||||
creation_date: str
|
||||
update_date: str
|
||||
pass
|
||||
Loading…
Add table
Add a link
Reference in a new issue