Fix homework fields
This commit is contained in:
parent
86845c81c5
commit
810dcda318
@ -52,10 +52,10 @@ def update_homework_type(
|
|||||||
if not homework_type or homework_type.user_id != current_user.id:
|
if not homework_type or homework_type.user_id != current_user.id:
|
||||||
raise HTTPException(status_code=403, detail="권한이 없습니다.")
|
raise HTTPException(status_code=403, detail="권한이 없습니다.")
|
||||||
|
|
||||||
homework_type.name = req.name
|
homework_type.title = req.title
|
||||||
homework_type.description = req.description
|
homework_type.description = req.description
|
||||||
homework_type.repeat_type = req.repeat_type
|
homework_type.reset_type = req.reset_type
|
||||||
homework_type.repeat_count = req.repeat_count
|
homework_type.clear_count = req.clear_count
|
||||||
|
|
||||||
db.commit()
|
db.commit()
|
||||||
return {"message": "숙제가 수정되었습니다."}
|
return {"message": "숙제가 수정되었습니다."}
|
||||||
|
|||||||
@ -5,7 +5,9 @@ from app.schemas.homework import HomeworkTypeCreate
|
|||||||
def create_homework_type(user_id: int, data: HomeworkTypeCreate, db: Session):
|
def create_homework_type(user_id: int, data: HomeworkTypeCreate, db: Session):
|
||||||
new_homework = HomeworkType(
|
new_homework = HomeworkType(
|
||||||
user_id=user_id,
|
user_id=user_id,
|
||||||
name=data.name,
|
title=data.title,
|
||||||
|
description=data.description,
|
||||||
|
reset_type=data.reset_type,
|
||||||
reset_time=data.reset_time,
|
reset_time=data.reset_time,
|
||||||
clear_count=data.clear_count,
|
clear_count=data.clear_count,
|
||||||
)
|
)
|
||||||
|
|||||||
@ -31,10 +31,10 @@ class HomeworkSelectableResponse(BaseModel):
|
|||||||
clear_count: int
|
clear_count: int
|
||||||
|
|
||||||
class HomeworkTypeUpdateRequest(BaseModel):
|
class HomeworkTypeUpdateRequest(BaseModel):
|
||||||
name: constr(min_length=1)
|
title: constr(min_length=1)
|
||||||
description: str | None = None
|
description: str | None = None
|
||||||
repeat_type: constr(min_length=1)
|
reset_type: constr(min_length=1)
|
||||||
repeat_count: conint(ge=1)
|
clear_count: conint(ge=1)
|
||||||
|
|
||||||
class HomeworkTypeDetailResponse(BaseModel):
|
class HomeworkTypeDetailResponse(BaseModel):
|
||||||
id: int
|
id: int
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user