async def update_cast(id: int, payload: CastUpdate): cast = await db_manager.get_cast(id) if not cast: raise HTTPException(status_code=404, detail="Cast not found") update_data = payload.dict(exclude_unset=True) cast_in_db = CastIn(**cast) updated_cast = cast_in_db.copy(update=update_data) return await db_manager.update_cast(id, updated_cast)
async def create_cast(payload: CastIn): cast_id = await service.create_cast(payload) response = {'id': cast_id, **payload.dict()} debug(response) return response
async def create_cast(payload: CastIn): cast_id = await db_manager.add_cast(payload) response = { 'id': cast_id, **payload.dict() } return response
async def post(payload: CastIn): query = casts.insert().values(**payload.dict()) return await database.execute(query=query)