Back to EIP
Messaging Mapper
⋯
service /api/v1 on new graphql:Listener(8080) {
resource function get invoice(string invoiceId) returns Invoice? {
return invoices[invoiceId];
}
remote function createInvoice(PurchasingRequest purchasingRequest) returns Invoice {
Invoice invoice = {
...purchasingRequest,
invoiceId: uuid:createType1AsString(),
total: from var {unitPrice, quantity} in purchasingRequest.items
let var itemTotalPrice = unitPrice * quantity
collect sum(itemTotalPrice)
};
invoices.add(invoice);
return invoice;
}
}