Done ticket GEPAFINBE-195

This commit is contained in:
piyushkag
2025-04-03 14:51:16 +05:30
parent a4bd8d9329
commit 5afdf042bc
19 changed files with 429 additions and 253 deletions

View File

@@ -0,0 +1,26 @@
CREATE OR REPLACE VIEW application_amendment_request_view AS
SELECT a.id,
a.application_id,
p.protocol_number,
cl.name AS call_name,
c.company_name,
a.start_date,
a.end_date AS expiration_date,
COALESCE(NULLIF(TRIM(BOTH FROM concat(COALESCE(u.first_name, ''), ' ', COALESCE(u.last_name, ''))), ''), '') AS assigned_user_name,
aa.user_id AS assigned_user_id,
a.status,
a.note,
a.internal_note,
app.user_id AS application_user_id,
a.created_date,
a.updated_date,
a.is_deleted
FROM gepafin_schema.application_amendment_request a
LEFT JOIN gepafin_schema.application app ON a.application_id = app.id AND (app.is_deleted IS FALSE OR app.is_deleted IS NULL)
LEFT JOIN gepafin_schema.call cl ON app.call_id = cl.id
LEFT JOIN gepafin_schema.company c ON app.company_id = c.id
LEFT JOIN gepafin_schema.protocol p ON a.protocol_id = p.id
LEFT JOIN gepafin_schema.assigned_applications aa ON app.id = aa.application_id AND (aa.is_deleted IS FALSE OR aa.is_deleted IS NULL)
LEFT JOIN gepafin_schema.gepafin_user u ON aa.user_id = u.id
WHERE a.is_deleted IS FALSE OR a.is_deleted IS NULL ORDER BY id;