zhaoqingang
2024-12-18 ae88193c5153aa04226a8307e1294a9c75d312bb
app/api/organization.py
@@ -19,7 +19,7 @@
async def add_dept(dept: DeptInfo, current_user: UserModel = Depends(get_current_user), db=Depends(get_db)):
    if not dept.deptName:
        return Response(code=400, msg="The deptName cannot be empty!")
    if dept.status not in ["0", "1"]:
    if dept.status not in ["0", "1", 0, 1]:
        return Response(code=400, msg="The status cannot be {}!".format(dept.status))
    is_create = await create_dept(db, dept.deptName, dept.leader, dept.phone, dept.address, dept.status, dept.orderNum, dept.roles, dept.groups, dept.parentId)
    if not is_create:
@@ -62,9 +62,9 @@
@dept_router.put("/status", response_model=Response)
async def edit_status_api(dept: DeptStatus, current_user: UserModel = Depends(get_current_user), db=Depends(get_db)):
    if dept.status not in ["0", '1']:
    if dept.status not in ["0", '1', 0, 1]:
        return Response(code=400, msg="未知状态!", data={})
    msg = await edit_organization_status(db, dept.deptId, dept.status)
    msg = await edit_organization_status(db, dept.deptId, str(dept.status))
    if msg:
        return Response(code=400, msg=f"{msg}", data={})
    return Response(code=200, msg="dept delete successfully", data={})