def delete(invoiceId, stationaryItemId): result = InvoiceStationaryItem.delete(invoiceId=invoiceId, stationaryItemId=stationaryItemId) db.session.commit() return result
def create(invoiceId, body): request_body = RequestBody(body) result = InvoiceStationaryItem.create( invoiceId=invoiceId, stationaryItemId=request_body.get("stationaryItemId")) return Schema().dump(result).data, 201
def receive(body): request_body = RequestBody(body) result = InvoiceStationaryItem.update( invoiceId=request_body.get("invoiceId"), stationaryItemId=request_body.get("stationaryItemId"), received=True, receivedFrom=request_body.get("receivedFrom"), receivedOfficeId=request_body.get("receivedOfficeId"), scannedImages=connexion.request.files['scannedImages']) return Schema().dump(result).data, 201
def get_all(invoiceId=None, stationaryItemId=None, received=None, receivedFrom=None, receivedBy=None, receivedOffice=None): result = InvoiceStationaryItem.get_all(invoiceId=invoiceId, stationaryItemId=stationaryItemId, received=received, receivedFrom=receivedFrom, receivedBy=receivedBy, receivedOffice=receivedOffice) return Schema(many=True).dump(result).data
def get_by_id(invoiceId, stationaryItemId): result = InvoiceStationaryItem.get_by_id(invoiceId, stationaryItemId) return Schema().dump(result).data, 201
def add_stationary_items(self, stationaryItemIds): for stationaryItemId in stationaryItemIds: InvoiceStationaryItem.create(invoiceId=self.invoiceId, stationaryItemId=stationaryItemId)
def add_stationary_item(self, stationaryItemId): return InvoiceStationaryItem.create(invoiceId=self.invoiceId, stationaryItemId=stationaryItemId)
def delete(invoiceId, stationaryItemId): result = InvoiceStationaryItem.delete(invoiceId=invoiceId, stationaryItemId=stationaryItemId) return result