File tree Expand file tree Collapse file tree
Resql/global-classifier/POST
Ruuter.public/global-classifier/POST/centops Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ -- Check if agency exists in mock_centops table
2+ SELECT agency_id
3+ FROM public .mock_centops
4+ WHERE agency_id = :agencyId;
Original file line number Diff line number Diff line change @@ -22,6 +22,23 @@ extractRequestData:
2222 assign :
2323 agency_id : ${incoming.body.agency_id}
2424 agency_name : ${incoming.body.agency_name}
25+ next : checkAgencyExists
26+
27+ # Check if Agency Already Exists
28+ checkAgencyExists :
29+ call : http.post
30+ args :
31+ url : " [#GLOBAL_CLASSIFIER_RESQL]/get-agency-centops"
32+ body :
33+ agencyId : ${agency_id}
34+ result : agency_check_res
35+ next : evaluateAgencyExistence
36+
37+ # Evaluate Agency Existence
38+ evaluateAgencyExistence :
39+ switch :
40+ - condition : " ${agency_check_res.response.body.length > 0}"
41+ next : return_agency_exists
2542 next : insertAgencyData
2643
2744# Insert Agency Data
@@ -48,6 +65,11 @@ return_success:
4865 status : 200
4966 next : end
5067
68+ return_agency_exists :
69+ return : " error: agency already exists in centops"
70+ status : 400
71+ next : end
72+
5173return_insert_failed :
5274 return : " error: failed to add agency to centops"
5375 status : 500
You can’t perform that action at this time.
0 commit comments