fix: refc code to use dictionary serialization instead of model_dump()

This commit is contained in:
swve 2024-04-06 13:54:28 +02:00
parent 7d86ff4a85
commit b57e6e55ce
6 changed files with 9 additions and 7 deletions

View file

@ -8,7 +8,7 @@ router = APIRouter()
@router.get("/config")
async def config():
config = get_learnhouse_config()
return config.model_dump()
return config.dict()

View file

@ -54,7 +54,7 @@ async def create_image_block(
block = Block(
activity_id=activity.id if activity.id else 0,
block_type=BlockTypeEnum.BLOCK_IMAGE,
content=block_data.model_dump(),
content=block_data.dict(),
org_id=org.id if org.id else 0,
course_id=course.id if course.id else 0,
block_uuid=block_uuid,

View file

@ -55,7 +55,7 @@ async def create_pdf_block(
block = Block(
activity_id=activity.id if activity.id else 0,
block_type=BlockTypeEnum.BLOCK_DOCUMENT_PDF,
content=block_data.model_dump(),
content=block_data.dict(),
org_id=org.id if org.id else 0,
course_id=course.id if course.id else 0,
block_uuid=block_uuid,

View file

@ -55,7 +55,7 @@ async def create_video_block(
block = Block(
activity_id=activity.id if activity.id else 0,
block_type=BlockTypeEnum.BLOCK_VIDEO,
content=block_data.model_dump(),
content=block_data.dict(),
org_id=org.id if org.id else 0,
course_id=course.id if course.id else 0,
block_uuid=block_uuid,

View file

@ -327,6 +327,8 @@ async def get_courses_orgslug(
limit: int = 10,
):
# TODO : This entire function is a mess. It needs to be rewritten.
# Query for public courses
statement_public = (
select(Course)

View file

@ -279,9 +279,9 @@ async def install_default_elements(db_session: Session):
)
# Serialize rights to JSON
role_global_admin.rights = role_global_admin.rights.model_dump() # type: ignore
role_global_maintainer.rights = role_global_maintainer.rights.model_dump() # type: ignore
role_global_user.rights = role_global_user.rights.model_dump() # type: ignore
role_global_admin.rights = role_global_admin.rights.dict() # type: ignore
role_global_maintainer.rights = role_global_maintainer.rights.dict() # type: ignore
role_global_user.rights = role_global_user.rights.dict() # type: ignore
# Insert roles in DB
db_session.add(role_global_admin)