feat(MED-85): add logging for medipost actions with xml and related order id
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
-- Parameters order_id
|
||||
CREATE OR REPLACE FUNCTION medreport.send_medipost_test_response_for_order(order_id text)
|
||||
CREATE OR REPLACE FUNCTION medreport.send_medipost_test_response_for_order(medusa_order_id text)
|
||||
RETURNS void
|
||||
LANGUAGE plpgsql
|
||||
AS $$
|
||||
BEGIN
|
||||
select net.http_post(
|
||||
url := 'https://test.medreport.ee/api/job/send-medipost-test-response-for-order',
|
||||
url := 'https://test.medreport.ee/api/order/medipost-test-response',
|
||||
headers := jsonb_build_object(
|
||||
'Content-Type', 'application/json',
|
||||
'x-jobs-api-key', 'fd26ec26-70ed-11f0-9e95-431ac3b15a84'
|
||||
),
|
||||
body := jsonb_build_object(
|
||||
'order_id', order_id
|
||||
'medusaOrderId', medusa_order_id
|
||||
)
|
||||
) as request_id;
|
||||
END;
|
||||
|
||||
16
supabase/migrations/20250828105844_medipost_actions.sql
Normal file
16
supabase/migrations/20250828105844_medipost_actions.sql
Normal file
@@ -0,0 +1,16 @@
|
||||
CREATE TABLE medreport.medipost_actions (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
action VARCHAR(255) NOT NULL,
|
||||
xml VARCHAR(131072),
|
||||
has_analysis_results BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
medusa_order_id VARCHAR(255),
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT now()
|
||||
);
|
||||
|
||||
ALTER TABLE medreport.medipost_actions ENABLE ROW LEVEL SECURITY;
|
||||
|
||||
CREATE POLICY "service_role_select" ON medreport.medipost_actions FOR SELECT TO service_role USING (true);
|
||||
CREATE POLICY "service_role_insert" ON medreport.medipost_actions FOR INSERT TO service_role WITH CHECK (true);
|
||||
CREATE POLICY "service_role_update" ON medreport.medipost_actions FOR UPDATE TO service_role USING (true);
|
||||
CREATE POLICY "service_role_delete" ON medreport.medipost_actions FOR DELETE TO service_role USING (true);
|
||||
grant select, insert, update, delete on table medreport.medipost_actions to service_role;
|
||||
Reference in New Issue
Block a user