mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
fix: chapters org_id and course_id issue
This commit is contained in:
parent
4a10f9a858
commit
f454520972
1 changed files with 3 additions and 6 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
from typing import Any, List, Optional
|
from typing import Any, List, Optional
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
from sqlalchemy import Column, ForeignKey
|
from sqlmodel import Column, ForeignKey, Integer
|
||||||
from sqlmodel import Field, SQLModel
|
from sqlmodel import Field, SQLModel
|
||||||
from src.db.courses.activities import ActivityRead
|
from src.db.courses.activities import ActivityRead
|
||||||
|
|
||||||
|
|
@ -10,18 +10,15 @@ class ChapterBase(SQLModel):
|
||||||
description: Optional[str] = ""
|
description: Optional[str] = ""
|
||||||
thumbnail_image: Optional[str] = ""
|
thumbnail_image: Optional[str] = ""
|
||||||
org_id: int = Field(
|
org_id: int = Field(
|
||||||
sa_column=Column("org_id", ForeignKey("organization.id", ondelete="CASCADE"))
|
sa_column=Column("org_id", Integer, ForeignKey("organization.id", ondelete="CASCADE"))
|
||||||
)
|
)
|
||||||
course_id: int = Field(
|
course_id: int = Field(
|
||||||
sa_column=Column("course_id", ForeignKey("course.id", ondelete="CASCADE"))
|
sa_column=Column("course_id", Integer, ForeignKey("course.id", ondelete="CASCADE"))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class Chapter(ChapterBase, table=True):
|
class Chapter(ChapterBase, table=True):
|
||||||
id: Optional[int] = Field(default=None, primary_key=True)
|
id: Optional[int] = Field(default=None, primary_key=True)
|
||||||
course_id: int = Field(
|
|
||||||
sa_column=Column("course_id", ForeignKey("course.id", ondelete="CASCADE"))
|
|
||||||
)
|
|
||||||
chapter_uuid: str = ""
|
chapter_uuid: str = ""
|
||||||
creation_date: str = ""
|
creation_date: str = ""
|
||||||
update_date: str = ""
|
update_date: str = ""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue