def CreateBorrowTicket(): req = CreateBorrowTicketReq(request.json) try: result = BorrowTicketSvc.CreateBorrowTicket(req) return jsonify(result) except ErrorRsp as e: return json.dumps(e.__dict__, ensure_ascii=False).encode('utf-8'), 401
def GetBorrowTickets(): req = GetItemsByPageReq(request.json) result = BorrowTicketSvc.GetBorrowTicketsByPage(req) res = GetItemsByPageRsp(has_next=result['has_next'], has_prev=result['has_prev'], items=result['borrow_tickets']).serialize() return jsonify(res)
def SearchBorrowTicket(): req = SearchBorrowTicketReq(request.json) result = BorrowTicketSvc.SearchBorrowTicket(req) res = SearchBorrowTicketRsp(result).serialize() return jsonify(res)
def DeleteBorrowTicket(): req = DeleteBorrowTicketReq(request.json) result = BorrowTicketSvc.DeleteBorrowTicket(req) return jsonify(result)
def FinishBorrowTicket(): req = FinishBorrowTicketReq(request.json) result = BorrowTicketSvc.FinishBorrowTicket(req) return jsonify(result)
def UpdateBorrowTicket(): req = UpdateBorrowTicketReq(request.json) result = BorrowTicketSvc.UpdateBorrowTicket(req) return jsonify(result)
def SendEmailForLateBorrowTicket(): req = SendEmailForLateBorrowTicketReq(request.json) result = BorrowTicketSvc.SendMessageForLate(req) return jsonify(result)