feat(MED-86): add db fn to show medipost dispatch error for order in Medusa
This commit is contained in:
@@ -2110,6 +2110,14 @@ export type Database = {
|
|||||||
medusa_order_id: string
|
medusa_order_id: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
order_has_medipost_dispatch_error: {
|
||||||
|
Args: {
|
||||||
|
medusa_order_id: string
|
||||||
|
}
|
||||||
|
Returns: {
|
||||||
|
success: boolean
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Enums: {
|
Enums: {
|
||||||
analysis_feedback_status: "STARTED" | "DRAFT" | "COMPLETED"
|
analysis_feedback_status: "STARTED" | "DRAFT" | "COMPLETED"
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
CREATE OR REPLACE FUNCTION medreport.order_has_medipost_dispatch_error(medusa_order_id text)
|
||||||
|
RETURNS boolean AS $$
|
||||||
|
SELECT EXISTS (
|
||||||
|
SELECT 1 FROM medreport.medipost_actions
|
||||||
|
WHERE medusa_order_id = $1
|
||||||
|
AND has_error = true
|
||||||
|
);
|
||||||
|
$$ LANGUAGE sql STABLE;
|
||||||
|
|
||||||
|
grant execute on function medreport.order_has_medipost_dispatch_error(text) to service_role;
|
||||||
Reference in New Issue
Block a user