Skip to content

Commit

Permalink
Merge pull request #118 from bcgov/yj
Browse files Browse the repository at this point in the history
Yj
  • Loading branch information
OleksandrBohuslavskyi authored Apr 11, 2024
2 parents a318495 + 4ad2675 commit 06c45ba
Show file tree
Hide file tree
Showing 30 changed files with 473 additions and 112 deletions.
4 changes: 4 additions & 0 deletions server/StrDss.Api/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using StrDss.Api.Middlewares;
using StrDss.Api;
using StrDss.Service.Bceid;
using StrDss.Service.Hangfire;

var builder = WebApplication.CreateBuilder(args);

Expand Down Expand Up @@ -100,12 +101,14 @@
builder.Services
.AddHangfire(configuration => configuration
.SetDataCompatibilityLevel(CompatibilityLevel.Version_170)

.UseSimpleAssemblyNameTypeSerializer()
.UseRecommendedSerializerSettings()
.UsePostgreSqlStorage((option) =>
{
option.UseNpgsqlConnection(connString);
}

));

builder.Services.AddHangfireServer(options =>
Expand Down Expand Up @@ -194,5 +197,6 @@

// make sure this is after app.UseHangfireDashboard()
//RecurringJob.AddOrUpdate<HangfireJobs>("Process Rental Listing Report", job => job.ProcessRentalListingReport(), "*/1 * * * *");
//RecurringJob.AddOrUpdate<HangfireJobs>("Process Takedown Request Batch Emails", job => job.ProcessTakedownRequestBatchEmails(), "50 15 * * *"); //UTC time 23:50

app.Run();
3 changes: 2 additions & 1 deletion server/StrDss.Common/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,10 @@ public static class EmailMessageTypes
public const string AccessGranted = "Access Granted";
public const string EscalationRequest = "Escalation Request";
public const string TakedownRequest = "Takedown Request";
public const string AccessRequested = "Access Requested";
public const string AccessDenied = "Access Denied";
public const string NoticeOfTakedown = "Notice of Takedown";
public const string AccessRequested = "Access Requested";
public const string BatchTakedownRequest = "Batch Takedown Request";
}

public static class Permissions
Expand Down
9 changes: 9 additions & 0 deletions server/StrDss.Data/Entities/DssAccessRequestStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,19 @@

namespace StrDss.Data.Entities;

/// <summary>
/// A potential status for a user access request (e.g. Requested, Approved, or Denied)
/// </summary>
public partial class DssAccessRequestStatus
{
/// <summary>
/// System-consistent code for the request status
/// </summary>
public string AccessRequestStatusCd { get; set; } = null!;

/// <summary>
/// Business term for the request status
/// </summary>
public string AccessRequestStatusNm { get; set; } = null!;

public virtual ICollection<DssUserIdentity> DssUserIdentities { get; set; } = new List<DssUserIdentity>();
Expand Down
73 changes: 61 additions & 12 deletions server/StrDss.Data/Entities/DssDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,15 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
{
entity.HasKey(e => e.AccessRequestStatusCd).HasName("dss_access_request_status_pk");

entity.ToTable("dss_access_request_status");
entity.ToTable("dss_access_request_status", tb => tb.HasComment("A potential status for a user access request (e.g. Requested, Approved, or Denied)"));

entity.Property(e => e.AccessRequestStatusCd)
.HasMaxLength(25)
.HasComment("System-consistent code for the request status")
.HasColumnName("access_request_status_cd");
entity.Property(e => e.AccessRequestStatusNm)
.HasMaxLength(250)
.HasComment("Business term for the request status")
.HasColumnName("access_request_status_nm");
});

Expand All @@ -74,14 +76,21 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
entity.Property(e => e.AffectedByUserIdentityId)
.HasComment("Foreign key")
.HasColumnName("affected_by_user_identity_id");
entity.Property(e => e.BatchingEmailMessageId)
.HasComment("Foreign key")
.HasColumnName("batching_email_message_id");
entity.Property(e => e.CcEmailAddressDsc)
.HasMaxLength(4000)
.HasComment("E-mail address of a secondary message recipient (directly entered by the user)")
.HasColumnName("cc_email_address_dsc");
entity.Property(e => e.EmailMessageType)
.HasMaxLength(50)
.HasComment("Business term for the type or purpose of the message (e.g. Notice of Takedown, Takedown Request, Delisting Warning, Delisting Request, Access Granted Notification, Access Denied Notification)")
.HasComment("Foreign key")
.HasColumnName("email_message_type");
entity.Property(e => e.ExternalMessageNo)
.HasMaxLength(50)
.HasComment("External identifier for tracking the message delivery progress")
.HasColumnName("external_message_no");
entity.Property(e => e.HostEmailAddressDsc)
.HasMaxLength(320)
.HasComment("E-mail address of a short term rental host (directly entered by the user as a message recipient)")
Expand All @@ -92,81 +101,111 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
entity.Property(e => e.InvolvedInOrganizationId)
.HasComment("Foreign key")
.HasColumnName("involved_in_organization_id");
entity.Property(e => e.IsHostContactedExternally).HasColumnName("is_host_contacted_externally");
entity.Property(e => e.IsSubmitterCcRequired).HasColumnName("is_submitter_cc_required");
entity.Property(e => e.IsHostContactedExternally)
.HasComment("Indicates whether the the property host has already been contacted by external means")
.HasColumnName("is_host_contacted_externally");
entity.Property(e => e.IsSubmitterCcRequired)
.HasComment("Indicates whether the user initiating the message should receive a copy of the email")
.HasColumnName("is_submitter_cc_required");
entity.Property(e => e.LgEmailAddressDsc)
.HasMaxLength(320)
.HasComment("E-mail address of a local government contact (directly entered by the user as a message recipient)")
.HasColumnName("lg_email_address_dsc");
entity.Property(e => e.LgPhoneNo)
.HasMaxLength(30)
.HasComment("A phone number associated with a Local Government contact")
.HasColumnName("lg_phone_no");
entity.Property(e => e.LgStrBylawUrl)
.HasMaxLength(4000)
.HasComment("User-provided URL for a local government bylaw that is the subject of the message")
.HasColumnName("lg_str_bylaw_url");
entity.Property(e => e.MessageDeliveryDtm)
.HasComment("A timestamp indicating when the message delivery was initiated")
.HasColumnName("message_delivery_dtm");
entity.Property(e => e.MessageReasonId).HasColumnName("message_reason_id");
entity.Property(e => e.MessageReasonId)
.HasComment("Foreign key")
.HasColumnName("message_reason_id");
entity.Property(e => e.MessageTemplateDsc)
.HasMaxLength(4000)
.HasComment("The full text or template for the message that is sent")
.HasColumnName("message_template_dsc");
entity.Property(e => e.RequestingOrganizationId)
.HasComment("Foreign key")
.HasColumnName("requesting_organization_id");
entity.Property(e => e.UnreportedListingNo)
.HasMaxLength(25)
.HasMaxLength(50)
.HasComment("The platform issued identification number for the listing (if not included in a rental listing report)")
.HasColumnName("unreported_listing_no");
entity.Property(e => e.UnreportedListingUrl)
.HasMaxLength(4000)
.HasComment("User-provided URL for a short-term rental platform listing that is the subject of the message")
.HasColumnName("unreported_listing_url");
entity.Property(e => e.UpdDtm)
.HasComment("Trigger-updated timestamp of last change")
.HasColumnName("upd_dtm");
entity.Property(e => e.UpdUserGuid)
.HasComment("The globally unique identifier (assigned by the identity provider) for the most recent user to record a change")
.HasColumnName("upd_user_guid");

entity.HasOne(d => d.AffectedByUserIdentity).WithMany(p => p.DssEmailMessageAffectedByUserIdentities)
.HasForeignKey(d => d.AffectedByUserIdentityId)
.HasConstraintName("dss_email_message_fk_affecting");

entity.HasOne(d => d.BatchingEmailMessage).WithMany(p => p.InverseBatchingEmailMessage)
.HasForeignKey(d => d.BatchingEmailMessageId)
.HasConstraintName("dss_email_message_fk_batched_in");

entity.HasOne(d => d.EmailMessageTypeNavigation).WithMany(p => p.DssEmailMessages)
.HasForeignKey(d => d.EmailMessageType)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("dss_email_message_fk_communicating");

entity.HasOne(d => d.InitiatingUserIdentity).WithMany(p => p.DssEmailMessageInitiatingUserIdentities)
.HasForeignKey(d => d.InitiatingUserIdentityId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("dss_email_message_fk_initiated_by");

entity.HasOne(d => d.InvolvedInOrganization).WithMany(p => p.DssEmailMessages)
entity.HasOne(d => d.InvolvedInOrganization).WithMany(p => p.DssEmailMessageInvolvedInOrganizations)
.HasForeignKey(d => d.InvolvedInOrganizationId)
.HasConstraintName("dss_email_message_fk_involving");

entity.HasOne(d => d.MessageReason).WithMany(p => p.DssEmailMessages)
.HasForeignKey(d => d.MessageReasonId)
.HasConstraintName("dss_email_message_fk_justified_by");

entity.HasOne(d => d.RequestingOrganization).WithMany(p => p.DssEmailMessageRequestingOrganizations)
.HasForeignKey(d => d.RequestingOrganizationId)
.HasConstraintName("dss_email_message_fk_requested_by");
});

modelBuilder.Entity<DssEmailMessageType>(entity =>
{
entity.HasKey(e => e.EmailMessageType).HasName("dss_email_message_type_pk");

entity.ToTable("dss_email_message_type");
entity.ToTable("dss_email_message_type", tb => tb.HasComment("The type or purpose of a system generated message (e.g. Notice of Takedown, Takedown Request, Delisting Warning, Delisting Request, Access Granted Notification, Access Denied Notification)"));

entity.Property(e => e.EmailMessageType)
.HasMaxLength(50)
.HasComment("System-consistent code for the type or purpose of the message (e.g. Notice of Takedown, Takedown Request, Delisting Warning, Delisting Request, Access Granted Notification, Access Denied Notification)")
.HasColumnName("email_message_type");
entity.Property(e => e.EmailMessageTypeNm)
.HasMaxLength(250)
.HasComment("Business term for the type or purpose of the message (e.g. Notice of Takedown, Takedown Request, Delisting Warning, Delisting Request, Access Granted Notification, Access Denied Notification)")
.HasColumnName("email_message_type_nm");
});

modelBuilder.Entity<DssMessageReason>(entity =>
{
entity.HasKey(e => e.MessageReasonId).HasName("dss_message_reason_pk");

entity.ToTable("dss_message_reason");
entity.ToTable("dss_message_reason", tb => tb.HasComment("A description of the justification for initiating a message"));

entity.Property(e => e.MessageReasonId)
.HasComment("Unique generated key")
.UseIdentityAlwaysColumn()
.HasColumnName("message_reason_id");
entity.Property(e => e.EmailMessageType)
.HasMaxLength(50)
.HasComment("Foreign key")
.HasColumnName("email_message_type");
entity.Property(e => e.MessageReasonDsc)
.HasMaxLength(250)
Expand Down Expand Up @@ -205,7 +244,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
.HasColumnName("organization_nm");
entity.Property(e => e.OrganizationType)
.HasMaxLength(25)
.HasComment("a level of government or business category")
.HasComment("Foreign key")
.HasColumnName("organization_type");
entity.Property(e => e.UpdDtm)
.HasComment("Trigger-updated timestamp of last change")
Expand Down Expand Up @@ -241,6 +280,10 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
.HasMaxLength(320)
.HasComment("E-mail address given for the contact by the organization")
.HasColumnName("email_address_dsc");
entity.Property(e => e.EmailMessageType)
.HasMaxLength(50)
.HasComment("Foreign key")
.HasColumnName("email_message_type");
entity.Property(e => e.FamilyNm)
.HasMaxLength(25)
.HasComment("A name that is often shared amongst members of the same family (commonly known as a surname within some cultures)")
Expand All @@ -267,19 +310,25 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
.HasForeignKey(d => d.ContactedThroughOrganizationId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("dss_organization_contact_person_fk_contacted_for");

entity.HasOne(d => d.EmailMessageTypeNavigation).WithMany(p => p.DssOrganizationContactPeople)
.HasForeignKey(d => d.EmailMessageType)
.HasConstraintName("dss_organization_contact_person_fk_subscribed_to");
});

modelBuilder.Entity<DssOrganizationType>(entity =>
{
entity.HasKey(e => e.OrganizationType).HasName("dss_organization_type_pk");

entity.ToTable("dss_organization_type");
entity.ToTable("dss_organization_type", tb => tb.HasComment("A level of government or business category"));

entity.Property(e => e.OrganizationType)
.HasMaxLength(25)
.HasComment("System-consistent code for a level of government or business category")
.HasColumnName("organization_type");
entity.Property(e => e.OrganizationTypeNm)
.HasMaxLength(250)
.HasComment("Business term for a level of government or business category")
.HasColumnName("organization_type_nm");
});

Expand Down
58 changes: 55 additions & 3 deletions server/StrDss.Data/Entities/DssEmailMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public partial class DssEmailMessage
public long EmailMessageId { get; set; }

/// <summary>
/// Business term for the type or purpose of the message (e.g. Notice of Takedown, Takedown Request, Delisting Warning, Delisting Request, Access Granted Notification, Access Denied Notification)
/// Foreign key
/// </summary>
public string EmailMessageType { get; set; } = null!;

Expand All @@ -28,21 +28,39 @@ public partial class DssEmailMessage
/// </summary>
public string MessageTemplateDsc { get; set; } = null!;

/// <summary>
/// Indicates whether the the property host has already been contacted by external means
/// </summary>
public bool IsHostContactedExternally { get; set; }

/// <summary>
/// Indicates whether the user initiating the message should receive a copy of the email
/// </summary>
public bool IsSubmitterCcRequired { get; set; }

/// <summary>
/// Foreign key
/// </summary>
public long? MessageReasonId { get; set; }

/// <summary>
/// A phone number associated with a Local Government contact
/// </summary>
public string? LgPhoneNo { get; set; }

/// <summary>
/// The platform issued identification number for the listing (if not included in a rental listing report)
/// </summary>
public string? UnreportedListingNo { get; set; }

/// <summary>
/// E-mail address of a short term rental host (directly entered by the user as a message recipient)
/// </summary>
public string? HostEmailAddressDsc { get; set; }

/// <summary>
/// E-mail address of a local government contact (directly entered by the user as a message recipient)
/// </summary>
public string? LgEmailAddressDsc { get; set; }

/// <summary>
Expand All @@ -55,12 +73,15 @@ public partial class DssEmailMessage
/// </summary>
public string? UnreportedListingUrl { get; set; }

/// <summary>
/// User-provided URL for a local government bylaw that is the subject of the message
/// </summary>
public string? LgStrBylawUrl { get; set; }

/// <summary>
/// Foreign key
/// </summary>
public long InitiatingUserIdentityId { get; set; }
public long? InitiatingUserIdentityId { get; set; }

/// <summary>
/// Foreign key
Expand All @@ -72,13 +93,44 @@ public partial class DssEmailMessage
/// </summary>
public long? InvolvedInOrganizationId { get; set; }

/// <summary>
/// Foreign key
/// </summary>
public long? BatchingEmailMessageId { get; set; }

/// <summary>
/// Foreign key
/// </summary>
public long? RequestingOrganizationId { get; set; }

/// <summary>
/// External identifier for tracking the message delivery progress
/// </summary>
public string? ExternalMessageNo { get; set; }

/// <summary>
/// Trigger-updated timestamp of last change
/// </summary>
public DateTime? UpdDtm { get; set; }

/// <summary>
/// The globally unique identifier (assigned by the identity provider) for the most recent user to record a change
/// </summary>
public Guid? UpdUserGuid { get; set; }

public virtual DssUserIdentity? AffectedByUserIdentity { get; set; }

public virtual DssEmailMessage? BatchingEmailMessage { get; set; }

public virtual DssEmailMessageType EmailMessageTypeNavigation { get; set; } = null!;

public virtual DssUserIdentity InitiatingUserIdentity { get; set; } = null!;
public virtual DssUserIdentity? InitiatingUserIdentity { get; set; }

public virtual ICollection<DssEmailMessage> InverseBatchingEmailMessage { get; set; } = new List<DssEmailMessage>();

public virtual DssOrganization? InvolvedInOrganization { get; set; }

public virtual DssMessageReason? MessageReason { get; set; }

public virtual DssOrganization? RequestingOrganization { get; set; }
}
Loading

0 comments on commit 06c45ba

Please sign in to comment.