Skip to content

Commit

Permalink
Merge pull request #619 from bcgov/yj
Browse files Browse the repository at this point in the history
feat(dss-805)
  • Loading branch information
ychung-mot authored Sep 12, 2024
2 parents 788744f + 785eb96 commit 5eeb255
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 0 deletions.
67 changes: 67 additions & 0 deletions database/ddl/STR_DSS_Views_Sprint_14.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/* Sprint 13 View Changes to STR DSS */

drop view if exists dss_rental_listing_vw;

CREATE OR REPLACE VIEW dss_rental_listing_vw AS select drl.rental_listing_id
, dlst.listing_status_type
, dlst.listing_status_type_nm
, dlst.listing_status_sort_no
, (select max(drlr.report_period_ym)
from dss_rental_listing drl2
join dss_rental_listing_report drlr on drlr.rental_listing_report_id=drl2.including_rental_listing_report_id
where drl2.offering_organization_id=drl.offering_organization_id and drl2.platform_listing_no=drl.platform_listing_no
) as latest_report_period_ym
, drl.is_active
, drl.is_new
, drl.is_taken_down
, drl.is_lg_transferred
, drl.is_changed_address
, drl.offering_organization_id
, org.organization_cd as offering_organization_cd
, org.organization_nm as offering_organization_nm
, drl.platform_listing_no
, drl.platform_listing_url
, dpa.original_address_txt
, dpa.is_match_corrected
, dpa.is_match_verified
, dpa.match_score_amt
, dpa.match_address_txt
, dpa.province_cd as address_sort_1_province_cd
, dpa.locality_nm as address_sort_2_locality_nm
, dpa.locality_type_dsc as address_sort_3_locality_type_dsc
, dpa.street_nm as address_sort_4_street_nm
, dpa.street_type_dsc as address_sort_5_street_type_dsc
, dpa.street_direction_dsc as address_sort_6_street_direction_dsc
, dpa.civic_no as address_sort_7_civic_no
, dpa.unit_no as address_sort_8_unit_no
, (select string_agg(full_nm,' ; ') from dss_rental_listing_contact drlc where drlc.contacted_through_rental_listing_id=drl.rental_listing_id) as listing_contact_names_txt
, lg.organization_id as managing_organization_id
, lg.organization_nm as managing_organization_nm
, lgs.economic_region_dsc
, lgs.is_principal_residence_required
, lgs.is_business_licence_required
, drl.is_entire_unit
, drl.available_bedrooms_qty
, drl.nights_booked_qty as nights_booked_ytd_qty
, drl.separate_reservations_qty as separate_reservations_ytd_qty
, drl.business_licence_no
, drl.bc_registry_no
, demt.email_message_type_nm as last_action_nm
, dem.message_delivery_dtm as last_action_dtm
, dbl.business_licence_id
, dbl.business_licence_no as business_licence_no_matched
, dbl.expiry_dt as business_licence_expiry_dt
, dbl.licence_status_type
, drl.effective_business_licence_no
, drl.effective_host_nm
, drl.is_changed_business_licence
FROM dss_rental_listing drl
join dss_organization org on org.organization_id=drl.offering_organization_id
LEFT JOIN dss_listing_status_type dlst on drl.listing_status_type=dlst.listing_status_type
LEFT JOIN dss_physical_address dpa on drl.locating_physical_address_id=dpa.physical_address_id
left join dss_organization lgs on lgs.organization_id=dpa.containing_organization_id and dpa.match_score_amt>1
left join dss_organization lg on lgs.managing_organization_id=lg.organization_id
LEFT JOIN dss_email_message dem on dem.email_message_id = (select msg.email_message_id from dss_email_message msg where msg.concerned_with_rental_listing_id=drl.rental_listing_id order by msg.message_delivery_dtm desc limit 1)
LEFT JOIN dss_email_message_type demt on dem.email_message_type=demt.email_message_type
LEFT join dss_business_licence dbl on drl.governing_business_licence_id = dbl.business_licence_id
where drl.including_rental_listing_report_id is null;
4 changes: 4 additions & 0 deletions server/StrDss.Data/Entities/DssDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
entity.Property(e => e.BcRegistryNo)
.HasMaxLength(50)
.HasColumnName("bc_registry_no");
entity.Property(e => e.BusinessLicenceExpiryDt).HasColumnName("business_licence_expiry_dt");
entity.Property(e => e.BusinessLicenceId).HasColumnName("business_licence_id");
entity.Property(e => e.BusinessLicenceNo)
.HasMaxLength(320)
Expand Down Expand Up @@ -988,6 +989,9 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
.HasMaxLength(250)
.HasColumnName("last_action_nm");
entity.Property(e => e.LatestReportPeriodYm).HasColumnName("latest_report_period_ym");
entity.Property(e => e.LicenceStatusType)
.HasMaxLength(25)
.HasColumnName("licence_status_type");
entity.Property(e => e.ListingContactNamesTxt).HasColumnName("listing_contact_names_txt");
entity.Property(e => e.ListingStatusSortNo).HasColumnName("listing_status_sort_no");
entity.Property(e => e.ListingStatusType)
Expand Down
4 changes: 4 additions & 0 deletions server/StrDss.Data/Entities/DssRentalListingVw.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ public partial class DssRentalListingVw

public string? BusinessLicenceNoMatched { get; set; }

public DateOnly? BusinessLicenceExpiryDt { get; set; }

public string? LicenceStatusType { get; set; }

public string? EffectiveBusinessLicenceNo { get; set; }

public string? EffectiveHostNm { get; set; }
Expand Down
3 changes: 3 additions & 0 deletions server/StrDss.Model/RentalReportDtos/RentalListingViewDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ public class RentalListingViewDto
public long? BusinessLicenceId { get; set; }

public string? BusinessLicenceNoMatched { get; set; }
public DateOnly? BusinessLicenceExpiryDt { get; set; }

public string? LicenceStatusType { get; set; }

public string? EffectiveBusinessLicenceNo { get; set; }

Expand Down

0 comments on commit 5eeb255

Please sign in to comment.