mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
41 lines
751 B
Python
41 lines
751 B
Python
from typing import Literal
|
|
from pydantic import BaseModel
|
|
|
|
|
|
# Database Models
|
|
|
|
class Permission(BaseModel):
|
|
action_create: bool
|
|
action_read: bool
|
|
action_update: bool
|
|
action_delete: bool
|
|
|
|
def __getitem__(self, item):
|
|
return getattr(self, item)
|
|
|
|
|
|
class Elements(BaseModel):
|
|
courses: Permission
|
|
users: Permission
|
|
houses: Permission
|
|
collections: Permission
|
|
organizations: Permission
|
|
coursechapters: Permission
|
|
activities: Permission
|
|
|
|
def __getitem__(self, item):
|
|
return getattr(self, item)
|
|
|
|
|
|
class Role(BaseModel):
|
|
name: str
|
|
description: str
|
|
elements : Elements
|
|
org_id: str | Literal["*"]
|
|
|
|
|
|
class RoleInDB(Role):
|
|
role_id: str
|
|
created_at: str
|
|
updated_at: str
|
|
|