Skip to content

Commit 6c6373c

Browse files
authored
Merge pull request #1300 from bcgov/dev
Dev
2 parents 46185cd + 1b1670c commit 6c6373c

11 files changed

Lines changed: 4122 additions & 205 deletions

File tree

applications/Unity.GrantManager/src/Unity.GrantManager.Application.Contracts/ApplicationForms/ApplicationFormVersionDto.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.ComponentModel.DataAnnotations.Schema;
23
using Volo.Abp.Application.Dtos;
34

45
namespace Unity.GrantManager.ApplicationForms
@@ -15,5 +16,7 @@ public class ApplicationFormVersionDto : EntityDto<Guid>
1516
public string ReportColumns { get; set; } = string.Empty;
1617
public string ReportKeys { get; set; } = string.Empty;
1718
public string ReportViewName { get; set; } = string.Empty;
19+
[Column(TypeName = "jsonb")]
20+
public string? FormSchema { get; set; } = string.Empty;
1821
}
1922
}

applications/Unity.GrantManager/src/Unity.GrantManager.Application/ApplicationForms/ApplicationFormVersionAppService.cs

Lines changed: 141 additions & 190 deletions
Large diffs are not rendered by default.

applications/Unity.GrantManager/src/Unity.GrantManager.Application/Intakes/IntakeFormSubmissionManager.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Microsoft.Extensions.Logging;
22
using Microsoft.Extensions.Logging.Abstractions;
33
using Newtonsoft.Json;
4+
using Newtonsoft.Json.Linq;
45
using System;
56
using System.Linq;
67
using System.Threading.Tasks;
@@ -59,19 +60,22 @@ public async Task<Guid> ProcessFormSubmissionAsync(ApplicationForm applicationFo
5960
var application = await CreateNewApplicationAsync(intakeMap, applicationForm);
6061
await _intakeFormSubmissionMapper.SaveChefsFiles(formSubmission, application.Id);
6162

63+
JObject submission = JObject.Parse(formSubmission.ToString());
64+
JToken? dataNode = submission.SelectToken("submission");
65+
6266
var newSubmission = new ApplicationFormSubmission
6367
{
6468
OidcSub = Guid.Empty.ToString(),
6569
ApplicantId = application.ApplicantId,
6670
ApplicationFormId = applicationForm.Id,
6771
ChefsSubmissionGuid = intakeMap.SubmissionId ?? $"{Guid.Empty}",
6872
ApplicationId = application.Id,
69-
Submission = ChefsFormIOReplacement.ReplaceAdvancedFormIoControls(formSubmission)
73+
Submission = dataNode?.ToString() ?? string.Empty
7074
};
7175

7276
_ = await _applicationFormSubmissionRepository.InsertAsync(newSubmission);
7377

74-
var localFormVersion = await _applicationFormVersionRepository.GetByChefsFormVersionAsync(Guid.Parse(formVersionId));
78+
ApplicationFormVersion? localFormVersion = await _applicationFormVersionRepository.GetByChefsFormVersionAsync(Guid.Parse(formVersionId));
7579
await _customFieldsIntakeSubmissionMapper.MapAndPersistCustomFields(application.Id,
7680
localFormVersion?.Id ?? Guid.Empty,
7781
formSubmission,

applications/Unity.GrantManager/src/Unity.GrantManager.Domain/Applications/ApplicationFormSubmission.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,20 @@ public class ApplicationFormSubmission : AuditedAggregateRoot<Guid>, IMultiTenan
1010
public string OidcSub { get; set; } = string.Empty;
1111
public Guid ApplicantId { get; set; }
1212
public Guid ApplicationFormId { get; set; }
13-
public Guid ApplicationId { get; set; } = Guid.Empty; // TODO : harden this contraint
13+
private Guid _applicationId = Guid.Empty;
14+
public Guid ApplicationId
15+
{
16+
get => _applicationId;
17+
set
18+
{
19+
if (value == Guid.Empty)
20+
{
21+
throw new ArgumentException("ApplicationId cannot be an empty GUID.");
22+
}
23+
_applicationId = value;
24+
}
25+
}
26+
1427
public string ChefsSubmissionGuid { get; set; } = string.Empty;
1528
[Column(TypeName = "jsonb")]
1629
public string Submission { get; set; } = string.Empty;

applications/Unity.GrantManager/src/Unity.GrantManager.Domain/Applications/ApplicationFormVersion.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.ComponentModel.DataAnnotations.Schema;
23
using Volo.Abp.Domain.Entities.Auditing;
34
using Volo.Abp.MultiTenancy;
45

@@ -17,4 +18,6 @@ public class ApplicationFormVersion : AuditedAggregateRoot<Guid>, IMultiTenant
1718
public string ReportColumns { get; set; } = string.Empty;
1819
public string ReportKeys { get; set; } = string.Empty;
1920
public string ReportViewName { get; set; } = string.Empty;
21+
[Column(TypeName = "jsonb")]
22+
public string? FormSchema { get; set; } = string.Empty;
2023
}

applications/Unity.GrantManager/src/Unity.GrantManager.EntityFrameworkCore/EntityFrameworkCore/GrantTenantDbContext.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
103103

104104
b.ConfigureByConvention(); //auto configure for the base class props
105105
b.HasOne<ApplicationForm>().WithMany().HasForeignKey(x => x.ApplicationFormId).IsRequired();
106+
b.Property(x => x.FormSchema).HasColumnType("jsonb");
106107
});
107108

108109
modelBuilder.Entity<ApplicationStatus>(b =>

0 commit comments

Comments
 (0)