mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: init collections
This commit is contained in:
parent
727f17ba7c
commit
e6adbca562
4 changed files with 219 additions and 178 deletions
|
|
@ -1,3 +1,40 @@
|
|||
from typing import Optional
|
||||
from sqlmodel import Field, SQLModel
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class CollectionBase(SQLModel):
|
||||
name: str
|
||||
public: bool
|
||||
description: Optional[str] = ""
|
||||
|
||||
|
||||
class Collection(CollectionBase, table=True):
|
||||
id: Optional[int] = Field(default=None, primary_key=True)
|
||||
org_id: int = Field(default=None, foreign_key="organization.id")
|
||||
collection_uuid: str = ""
|
||||
creation_date: str = ""
|
||||
update_date: str = ""
|
||||
|
||||
|
||||
class CollectionCreate(CollectionBase):
|
||||
courses: list
|
||||
org_id: int = Field(default=None, foreign_key="organization.id")
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class CollectionUpdate(CollectionBase):
|
||||
collection_id: int
|
||||
courses: Optional[list]
|
||||
name: Optional[str]
|
||||
public: Optional[bool]
|
||||
description: Optional[str]
|
||||
|
||||
|
||||
class CollectionRead(CollectionBase):
|
||||
id: int
|
||||
courses: list
|
||||
collection_uuid: str
|
||||
creation_date: str
|
||||
update_date: str
|
||||
pass
|
||||
|
|
|
|||
11
apps/api/src/db/collections_courses.py
Normal file
11
apps/api/src/db/collections_courses.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
from typing import Optional
|
||||
from sqlmodel import Field, SQLModel
|
||||
|
||||
|
||||
class CollectionCourse(SQLModel, table=True):
|
||||
id: Optional[int] = Field(default=None, primary_key=True)
|
||||
collection_id: int = Field(default=None, foreign_key="collection.id")
|
||||
course_id: int = Field(default=None, foreign_key="course.id")
|
||||
org_id: int = Field(default=None, foreign_key="organization.id")
|
||||
creation_date: str
|
||||
update_date: str
|
||||
Loading…
Add table
Add a link
Reference in a new issue