def delete_item( *, session: Session = Depends(get_db), user_id: UserID = Depends(get_jwt_user), item_id: ItemID, ) -> APIMessage: item = get_owned_item(session, user_id, item_id) session.delete(item) session.commit() return APIMessage(detail=f"Deleted item {item_id}")
async def _delete_one(self, uid: UUID): self.ensure_authenticated() await self.service.delete_by_uid(self.user, uid) return APIMessage( detail=f"Object with uid: {uid} deleted successfully!")
async def cancel_one(self, uid: UUID) -> APIMessage: self.ensure_authenticated() await self.service.cancel(self.user, uid) return APIMessage(detail=f"Invoice with uid: {uid} cancelled!")
async def publish_one(self, uid: UUID) -> APIMessage: self.ensure_authenticated() await self.service.publish(self.user, uid) return APIMessage(detail=f"Invoice with uid: {uid} published!")
async def delete_item(self, list_id: int) -> APIMessage: q = delete(TaskList).where(TaskList.id == list_id) await session.execute(q) return APIMessage(detail=f"Deleted task list {list_id}")
def delete_item(self, item_id: ItemID) -> APIMessage: item = get_owned_item(self.session, self.user_id, item_id) self.session.delete(item) self.session.commit() return APIMessage(detail=f"Deleted item {item_id}")
async def delete_item(self, task_id: int) -> APIMessage: q = delete(Task).where(Task.id == task_id) await session.execute(q) return APIMessage(detail=f"Deleted task {task_id}")
def _publish_invoice(client, invoice_uid) -> APIMessage: response = client.post(f'/api/invoices/{invoice_uid}/publish/') check_response(response) new_obj = APIMessage.parse_obj(response.json()) debug(new_obj) return new_obj