From c3460abfdc98d09888ee7537aed70746873b1513 Mon Sep 17 00:00:00 2001 From: Doug Lovett Date: Thu, 31 Oct 2024 08:00:19 -0700 Subject: [PATCH] API owner search add party types. (#2056) Signed-off-by: Doug Lovett --- mhr-api/migrations/versions/0001_rebase_2024-10.py | 4 ++-- .../src/database/postgres_views/mhr_search_owner_bus_vw.py | 2 +- .../src/database/postgres_views/mhr_search_owner_ind_vw.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mhr-api/migrations/versions/0001_rebase_2024-10.py b/mhr-api/migrations/versions/0001_rebase_2024-10.py index f1bbdc9c4..5d6aa3d1c 100644 --- a/mhr-api/migrations/versions/0001_rebase_2024-10.py +++ b/mhr-api/migrations/versions/0001_rebase_2024-10.py @@ -3270,14 +3270,14 @@ def upgrade(): public_mhr_search_owner_bus_vw = PGView( schema="public", signature="mhr_search_owner_bus_vw", - definition="SELECT r.mhr_number, r.status_type, r.registration_ts, a.city,\n (SELECT s.serial_number\n FROM mhr_registrations rs, mhr_sections s\n WHERE rs.mhr_number = r.mhr_number \n AND rs.id = s.registration_id\n AND s.status_type = 'ACTIVE'\n ORDER BY s.id\n FETCH FIRST 1 ROWS ONLY) AS serial_number,\n d.year_made,\n d.make, d.model, r.id,\n p.business_name,\n og.status_type AS owner_status_type,\n p.compressed_name\n FROM mhr_registrations r,\n mhr_registrations rl,\n mhr_registrations rd,\n mhr_registrations ro,\n mhr_owner_groups og,\n mhr_parties p,\n mhr_locations l, \n addresses a, \n mhr_descriptions d\n WHERE (r.registration_type = 'MHREG' or r.registration_type = 'MHREG_CONVERSION')\n AND ro.mhr_number = r.mhr_number \n AND ro.id = og.registration_id\n AND og.registration_id = p.registration_id\n AND p.owner_group_id = og.id\n AND p.party_type = 'OWNER_BUS'\n AND r.mhr_number = rl.mhr_number\n AND r.mhr_number = rd.mhr_number\n AND rl.id = l.registration_id\n AND l.status_type = 'ACTIVE'\n AND l.address_id = a.id\n AND rd.id = d.registration_id\n AND d.status_type = 'ACTIVE'" + definition="SELECT r.mhr_number, r.status_type, r.registration_ts, a.city,\n (SELECT s.serial_number\n FROM mhr_registrations rs, mhr_sections s\n WHERE rs.mhr_number = r.mhr_number \n AND rs.id = s.registration_id\n AND s.status_type = 'ACTIVE'\n ORDER BY s.id\n FETCH FIRST 1 ROWS ONLY) AS serial_number,\n d.year_made,\n d.make, d.model, r.id,\n p.business_name,\n og.status_type AS owner_status_type,\n p.compressed_name\n FROM mhr_registrations r,\n mhr_registrations rl,\n mhr_registrations rd,\n mhr_registrations ro,\n mhr_owner_groups og,\n mhr_parties p,\n mhr_locations l, \n addresses a, \n mhr_descriptions d\n WHERE (r.registration_type = 'MHREG' or r.registration_type = 'MHREG_CONVERSION')\n AND ro.mhr_number = r.mhr_number \n AND ro.id = og.registration_id\n AND og.registration_id = p.registration_id\n AND p.owner_group_id = og.id\n AND p.party_type IN ('EXECUTOR', 'TRUSTEE', 'ADMINISTRATOR', 'TRUST', 'OWNER_BUS')\n AND r.mhr_number = rl.mhr_number\n AND r.mhr_number = rd.mhr_number\n AND rl.id = l.registration_id\n AND l.status_type = 'ACTIVE'\n AND l.address_id = a.id\n AND rd.id = d.registration_id\n AND d.status_type = 'ACTIVE'" ) op.create_entity(public_mhr_search_owner_bus_vw) public_mhr_search_owner_ind_vw = PGView( schema="public", signature="mhr_search_owner_ind_vw", - definition="SELECT r.mhr_number, r.status_type, r.registration_ts, a.city,\n (SELECT s.serial_number\n FROM mhr_registrations rs, mhr_sections s\n WHERE rs.mhr_number = r.mhr_number \n AND rs.id = s.registration_id\n AND s.status_type = 'ACTIVE'\n ORDER BY s.id\n FETCH FIRST 1 ROWS ONLY) AS serial_number,\n d.year_made,\n d.make, d.model, r.id,\n p.last_name,\n p.first_name,\n p.middle_name,\n og.status_type AS owner_status_type,\n p.compressed_name\n FROM mhr_registrations r,\n mhr_registrations rl,\n mhr_registrations rd,\n mhr_registrations ro,\n mhr_owner_groups og,\n mhr_parties p,\n mhr_locations l, \n addresses a, \n mhr_descriptions d\n WHERE (r.registration_type = 'MHREG' or r.registration_type = 'MHREG_CONVERSION')\n AND ro.mhr_number = r.mhr_number \n AND ro.id = og.registration_id\n AND og.registration_id = p.registration_id\n AND p.party_type = 'OWNER_IND'\n AND p.owner_group_id = og.id\n AND r.mhr_number = rl.mhr_number\n AND r.mhr_number = rd.mhr_number\n AND rl.id = l.registration_id\n AND l.status_type = 'ACTIVE'\n AND l.address_id = a.id\n AND rd.id = d.registration_id\n AND d.status_type = 'ACTIVE'" + definition="SELECT r.mhr_number, r.status_type, r.registration_ts, a.city,\n (SELECT s.serial_number\n FROM mhr_registrations rs, mhr_sections s\n WHERE rs.mhr_number = r.mhr_number \n AND rs.id = s.registration_id\n AND s.status_type = 'ACTIVE'\n ORDER BY s.id\n FETCH FIRST 1 ROWS ONLY) AS serial_number,\n d.year_made,\n d.make, d.model, r.id,\n p.last_name,\n p.first_name,\n p.middle_name,\n og.status_type AS owner_status_type,\n p.compressed_name\n FROM mhr_registrations r,\n mhr_registrations rl,\n mhr_registrations rd,\n mhr_registrations ro,\n mhr_owner_groups og,\n mhr_parties p,\n mhr_locations l, \n addresses a, \n mhr_descriptions d\n WHERE (r.registration_type = 'MHREG' or r.registration_type = 'MHREG_CONVERSION')\n AND ro.mhr_number = r.mhr_number \n AND ro.id = og.registration_id\n AND og.registration_id = p.registration_id\n AND p.party_type IN ('EXECUTOR', 'TRUSTEE', 'ADMINISTRATOR', 'TRUST', 'OWNER_IND')\n AND p.owner_group_id = og.id\n AND r.mhr_number = rl.mhr_number\n AND r.mhr_number = rd.mhr_number\n AND rl.id = l.registration_id\n AND l.status_type = 'ACTIVE'\n AND l.address_id = a.id\n AND rd.id = d.registration_id\n AND d.status_type = 'ACTIVE'" ) op.create_entity(public_mhr_search_owner_ind_vw) diff --git a/mhr-api/src/database/postgres_views/mhr_search_owner_bus_vw.py b/mhr-api/src/database/postgres_views/mhr_search_owner_bus_vw.py index 8f830676f..bb15b5fe8 100644 --- a/mhr-api/src/database/postgres_views/mhr_search_owner_bus_vw.py +++ b/mhr-api/src/database/postgres_views/mhr_search_owner_bus_vw.py @@ -34,7 +34,7 @@ AND ro.id = og.registration_id AND og.registration_id = p.registration_id AND p.owner_group_id = og.id - AND p.party_type = 'OWNER_BUS' + AND p.party_type IN ('EXECUTOR', 'TRUSTEE', 'ADMINISTRATOR', 'TRUST', 'OWNER_BUS') AND r.mhr_number = rl.mhr_number AND r.mhr_number = rd.mhr_number AND rl.id = l.registration_id diff --git a/mhr-api/src/database/postgres_views/mhr_search_owner_ind_vw.py b/mhr-api/src/database/postgres_views/mhr_search_owner_ind_vw.py index c90e3c820..05671f62a 100644 --- a/mhr-api/src/database/postgres_views/mhr_search_owner_ind_vw.py +++ b/mhr-api/src/database/postgres_views/mhr_search_owner_ind_vw.py @@ -35,7 +35,7 @@ AND ro.mhr_number = r.mhr_number AND ro.id = og.registration_id AND og.registration_id = p.registration_id - AND p.party_type = 'OWNER_IND' + AND p.party_type IN ('EXECUTOR', 'TRUSTEE', 'ADMINISTRATOR', 'TRUST', 'OWNER_IND') AND p.owner_group_id = og.id AND r.mhr_number = rl.mhr_number AND r.mhr_number = rd.mhr_number