Back to EIP
Resequencer
⋯
service /api/v1 on new http:Listener(8080) {
resource function post employees/[string emoloyeeId]/approval(Approval approvalReq) returns error? {
Approval[]? approvals = incompleteApprovals[emoloyeeId];
if approvals == () {
incompleteApprovals[emoloyeeId] = [approvalReq];
return;
}
approvals.push(approvalReq);
if approvals.length() < 3 {
return;
}
from Approval approval in approvals
order by approval.leadLevel
do {
_ = check hrClient->/promotions/employees/[emoloyeeId]/approval.post(approval, targetType = json);
};
_ = incompleteApprovals.remove(emoloyeeId);
}
}