Skip to content
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace Unity.GrantManager.ApplicantProfile.ProfileData;

/// <summary>
/// Represents a link to be used within the Applicant Portal, including the URL, title, and description.
/// </summary>
public class ExternalLinkDto
{
public required string Uri { get; set; }
public ExternalLinkType ExternalLinkType { get; set; }
public bool Publish { get; set; } = false;
public int Order { get; set; } = -1;
public string Title { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
using System;
using System.Collections.Generic;

namespace Unity.GrantManager.ApplicantProfile.ProfileData
namespace Unity.GrantManager.ApplicantProfile.ProfileData;

public class SubmissionInfoItemDto
{
public class SubmissionInfoItemDto
{
public Guid Id { get; set; }
public string LinkId { get; set; } = string.Empty;
public DateTime ReceivedTime { get; set; }
public DateTime SubmissionTime { get; set; }
public string ReferenceNo { get; set; } = string.Empty;
public string Type { get; set; } = string.Empty;
public string Status { get; set; } = string.Empty;
}
public Guid Id { get; set; }
public string LinkId { get; set; } = string.Empty;
public DateTime ReceivedTime { get; set; }
public DateTime SubmissionTime { get; set; }
public string ReferenceNo { get; set; } = string.Empty;
public string Type { get; set; } = string.Empty;
public string Status { get; set; } = string.Empty;
public ExternalLinkDto? RenewalLink { get; set; }
public List<ExternalLinkDto> RelatedLinks { get; set; } = [];
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@ join status in statusesQuery on application.ApplicationStatusId equals status.Id
FormName = form.ApplicationFormName ?? string.Empty,
Status = application.ExternalStatusVisibility
? status.NotifiedStatus ?? status.ExternalStatus
: status.ExternalStatus
: status.ExternalStatus,
RenewalLink = form.ExternalLinks
.FirstOrDefault(x => x.Publish && x.ExternalLinkType == ExternalLinkType.Renewal),
RelatedLinks = form.ExternalLinks
.Where(x => x.Publish && x.ExternalLinkType == ExternalLinkType.Related)
.OrderBy(x => x.Order)
.ThenBy(x => x.Title)
}).ToListAsync();

dto.Submissions.AddRange(results.Select(s => new SubmissionInfoItemDto
Expand All @@ -80,13 +86,27 @@ join status in statusesQuery on application.ApplicationStatusId equals status.Id
SubmissionTime = ResolveSubmissionTime(s.Submission, s.CreationTime),
ReferenceNo = s.ReferenceNo,
Type = s.FormName,
Status = s.Status
Status = s.Status,
RenewalLink = s.RenewalLink is null ? null : MapExternalLink(s.RenewalLink),
RelatedLinks = [.. s.RelatedLinks.Select(MapExternalLink)]
}));
}

return dto;
}

private static ExternalLinkDto MapExternalLink(ExternalLink link)
{
return new ExternalLinkDto
{
Uri = link.Uri,
ExternalLinkType = link.ExternalLinkType,
Order = link.Order,
Title = link.Title,
Description = link.Description
};
}

/// <summary>
/// Derives the CHEFS form view URL from the INTAKE_API_BASE dynamic URL setting.
/// e.g. https://chefs-dev.apps.silver.devops.gov.bc.ca/app/api/v1
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Unity.GrantManager.ApplicantProfile;

/// <summary>
/// Represents a link to be used within the Applicant Portal, including the URL, title, and description.
/// </summary>
[ComplexType]
public class ExternalLink
{
/// <summary>
/// Gets or sets the URL of the external link.
/// </summary>
[MaxLength(2048)]
public required string Uri { get; set; }

/// <summary>
/// Gets or sets the type of the external link.
/// </summary>
public ExternalLinkType ExternalLinkType { get; set; } = ExternalLinkType.Related;
public bool Publish { get; set; } = false;
public int Order { get; set; } = -1;

/// <summary>
/// Gets or sets the title of the external link.
/// </summary>
[MaxLength(255)]
public string Title { get; set; } = string.Empty;

/// <summary>
/// Gets or sets the description of the external link.
/// </summary>
[MaxLength(512)]
public string Description { get; set; } = string.Empty;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Unity.GrantManager.ApplicantProfile;

public enum ExternalLinkType
{
Related = 1,
Renewal = 2
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Unity.GrantManager.ApplicantProfile;
using Unity.GrantManager.ApplicationForms;
using Unity.GrantManager.GrantApplications;
using Volo.Abp.Domain.Entities.Auditing;
Expand Down Expand Up @@ -32,6 +33,8 @@ public class ApplicationForm : FullAuditedAggregateRoot<Guid>, IMultiTenant
public FormHierarchyType? FormHierarchy { get; set; }
public Guid? ParentFormId { get; set; }
public bool IsDirectApproval { get; set; } = false;
public List<ExternalLink> ExternalLinks { get; set; } = [];

public bool AutomaticallyGenerateAIAnalysis { get; set; } = false;
public bool ManuallyInitiateAIAnalysis { get; set; } = false;
[MaxLength(100)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using System.Linq;
using Unity.Flex.EntityFrameworkCore;
using Unity.GrantManager.Applications;
using Unity.GrantManager.Intakes;
using Unity.GrantManager.Assessments;
using Unity.GrantManager.Comments;
using Unity.GrantManager.Contacts;
using Unity.GrantManager.GlobalTag;
using Unity.GrantManager.GrantApplications;
using Unity.GrantManager.Identity;
using Unity.GrantManager.Intakes;
using Unity.GrantManager.Notifications;
using Unity.Notifications.EntityFrameworkCore;
using Unity.Payments.EntityFrameworkCore;
using Unity.Reporting.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.Modeling;
using Unity.GrantManager.Identity;
using Unity.Payments.EntityFrameworkCore;
using Unity.Flex.EntityFrameworkCore;
using Unity.Notifications.EntityFrameworkCore;
using Unity.Reporting.EntityFrameworkCore;
using Unity.GrantManager.GlobalTag;
using Unity.GrantManager.Contacts;

namespace Unity.GrantManager.EntityFrameworkCore
{
Expand Down Expand Up @@ -121,6 +121,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)

b.ConfigureByConvention(); //auto configure for the base class props
b.Property(x => x.ApplicationFormName).IsRequired().HasMaxLength(255);
b.ComplexCollection(x => x.ExternalLinks, e => e.ToJson());

b.HasOne<Intake>().WithMany().HasForeignKey(x => x.IntakeId).IsRequired();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3114,10 +3114,6 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property<bool>("IsActive")
.HasColumnType("boolean");

b.Property<string>("Module")
.HasMaxLength(64)
.HasColumnType("character varying(64)");

b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
Expand All @@ -3132,6 +3128,10 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasColumnType("uuid")
.HasColumnName("LastModifierId");

b.Property<string>("Module")
.HasMaxLength(64)
.HasColumnType("character varying(64)");

b.Property<string>("RecipientCategory")
.HasColumnType("text");

Expand Down
Loading