mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
fix: refc code to use dictionary serialization instead of model_dump()
This commit is contained in:
parent
7d86ff4a85
commit
b57e6e55ce
6 changed files with 9 additions and 7 deletions
|
|
@ -8,7 +8,7 @@ router = APIRouter()
|
||||||
@router.get("/config")
|
@router.get("/config")
|
||||||
async def config():
|
async def config():
|
||||||
config = get_learnhouse_config()
|
config = get_learnhouse_config()
|
||||||
return config.model_dump()
|
return config.dict()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ async def create_image_block(
|
||||||
block = Block(
|
block = Block(
|
||||||
activity_id=activity.id if activity.id else 0,
|
activity_id=activity.id if activity.id else 0,
|
||||||
block_type=BlockTypeEnum.BLOCK_IMAGE,
|
block_type=BlockTypeEnum.BLOCK_IMAGE,
|
||||||
content=block_data.model_dump(),
|
content=block_data.dict(),
|
||||||
org_id=org.id if org.id else 0,
|
org_id=org.id if org.id else 0,
|
||||||
course_id=course.id if course.id else 0,
|
course_id=course.id if course.id else 0,
|
||||||
block_uuid=block_uuid,
|
block_uuid=block_uuid,
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ async def create_pdf_block(
|
||||||
block = Block(
|
block = Block(
|
||||||
activity_id=activity.id if activity.id else 0,
|
activity_id=activity.id if activity.id else 0,
|
||||||
block_type=BlockTypeEnum.BLOCK_DOCUMENT_PDF,
|
block_type=BlockTypeEnum.BLOCK_DOCUMENT_PDF,
|
||||||
content=block_data.model_dump(),
|
content=block_data.dict(),
|
||||||
org_id=org.id if org.id else 0,
|
org_id=org.id if org.id else 0,
|
||||||
course_id=course.id if course.id else 0,
|
course_id=course.id if course.id else 0,
|
||||||
block_uuid=block_uuid,
|
block_uuid=block_uuid,
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ async def create_video_block(
|
||||||
block = Block(
|
block = Block(
|
||||||
activity_id=activity.id if activity.id else 0,
|
activity_id=activity.id if activity.id else 0,
|
||||||
block_type=BlockTypeEnum.BLOCK_VIDEO,
|
block_type=BlockTypeEnum.BLOCK_VIDEO,
|
||||||
content=block_data.model_dump(),
|
content=block_data.dict(),
|
||||||
org_id=org.id if org.id else 0,
|
org_id=org.id if org.id else 0,
|
||||||
course_id=course.id if course.id else 0,
|
course_id=course.id if course.id else 0,
|
||||||
block_uuid=block_uuid,
|
block_uuid=block_uuid,
|
||||||
|
|
|
||||||
|
|
@ -327,6 +327,8 @@ async def get_courses_orgslug(
|
||||||
limit: int = 10,
|
limit: int = 10,
|
||||||
):
|
):
|
||||||
|
|
||||||
|
# TODO : This entire function is a mess. It needs to be rewritten.
|
||||||
|
|
||||||
# Query for public courses
|
# Query for public courses
|
||||||
statement_public = (
|
statement_public = (
|
||||||
select(Course)
|
select(Course)
|
||||||
|
|
|
||||||
|
|
@ -279,9 +279,9 @@ async def install_default_elements(db_session: Session):
|
||||||
)
|
)
|
||||||
|
|
||||||
# Serialize rights to JSON
|
# Serialize rights to JSON
|
||||||
role_global_admin.rights = role_global_admin.rights.model_dump() # type: ignore
|
role_global_admin.rights = role_global_admin.rights.dict() # type: ignore
|
||||||
role_global_maintainer.rights = role_global_maintainer.rights.model_dump() # type: ignore
|
role_global_maintainer.rights = role_global_maintainer.rights.dict() # type: ignore
|
||||||
role_global_user.rights = role_global_user.rights.model_dump() # type: ignore
|
role_global_user.rights = role_global_user.rights.dict() # type: ignore
|
||||||
|
|
||||||
# Insert roles in DB
|
# Insert roles in DB
|
||||||
db_session.add(role_global_admin)
|
db_session.add(role_global_admin)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue