Skip to content

Commit 3845cc7

Browse files
authored
Merge pull request #891 from bcgov/feature/registration-validation
DSS-1129 Registration Validation - Through Monthly Upload
2 parents 18646bc + fa977db commit 3845cc7

20 files changed

+166
-114
lines changed

database/ddl/STR_DSS_Incremental_DB_DDL_Sprint_21.sql

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ ALTER TABLE dss_upload_delivery ADD registration_status varchar(20);
1717
ALTER TABLE dss_upload_delivery ADD registration_lines_failure smallint;
1818
ALTER TABLE dss_upload_delivery ADD registration_lines_success smallint;
1919
ALTER TABLE dss_upload_delivery ADD upload_user_guid uuid;
20+
ALTER TABLE dss_upload_delivery ADD upload_date timestamptz;
2021

2122
COMMENT ON COLUMN dss_upload_delivery.upload_status IS 'The current processing status of the uploaded file: Pending, Processed, or Failed';
2223
COMMENT ON COLUMN dss_upload_delivery.upload_lines_total IS 'The total number of lines in the uploaded file';
@@ -27,6 +28,7 @@ COMMENT ON COLUMN dss_upload_delivery.registration_status IS 'The current proces
2728
COMMENT ON COLUMN dss_upload_delivery.registration_lines_failure IS 'The number of lines in the uploaded file that failed to validate the registration number';
2829
COMMENT ON COLUMN dss_upload_delivery.registration_lines_success IS 'The number of lines in the uploaded file that successfully validated the registration number';
2930
COMMENT ON COLUMN dss_upload_delivery.upload_user_guid IS 'The globally unique identifier (assigned by the identity provider) for the user who uploaded the file';
31+
COMMENT ON COLUMN dss_upload_delivery.upload_date IS 'Date and time the file was uploaded';
3032

3133
-- Create new columns in the upload line for holding registration validation status and text
3234
ALTER TABLE dss_upload_line ADD is_registration_failure boolean DEFAULT false;
@@ -41,8 +43,8 @@ ALTER TABLE dss_upload_delivery DISABLE TRIGGER ALL;
4143

4244
-- Populate the upload_user_guid column with the current value of upd_user_guid
4345
UPDATE dss_upload_delivery
44-
SET upload_user_guid = upd_user_guid
45-
WHERE upload_user_guid IS NULL;
46+
SET upload_user_guid = upd_user_guid,
47+
upload_date = upd_dtm;
4648

4749
-- Re-enable the trigger
4850
ALTER TABLE dss_upload_delivery ENABLE TRIGGER ALL;
@@ -194,7 +196,7 @@ FROM (
194196
WHERE dud.upload_delivery_id = subquery.upload_delivery_id;
195197

196198
UPDATE dss_upload_delivery dud
197-
SET registration_status = dud.upload_status,
199+
SET registration_status = 'Not Applicable',
198200
registration_lines_failure = dud.upload_lines_error,
199201
registration_lines_success = dud.upload_lines_success;
200202

@@ -218,6 +220,7 @@ CREATE OR REPLACE VIEW public.dss_rental_upload_history_view
218220
AS SELECT dud.upload_delivery_id,
219221
dud.upload_delivery_type,
220222
dud.report_period_ym,
223+
dud.upload_date,
221224
dud.providing_organization_id,
222225
dud.upload_status AS status,
223226
dud.registration_status AS registration_status,

frontend/src/app/common/listing-upload-history-table/listing-upload-history-table.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ <h2>Platform Upload History</h2>
114114
<i class="pi pi-download" *ngIf="row.errors>0"></i></button>
115115
<ng-template #zero>{{0}}</ng-template>
116116
</td>
117-
<td>{{ row.updDtm |date:'yyyy-MM-dd' }}</td>
117+
<td>{{ row.uploadDate |date:'yyyy-MM-dd' }}</td>
118118
<td>{{ row.uploadedBy }}</td>
119119
</tr>
120120
</ng-template>

frontend/src/app/common/models/listing-upload-history-record.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ export interface ListingUploadHistoryRecord {
1414
updDtm: string;
1515
uploadDeliveryId: number;
1616
uploadDeliveryType?: string;
17+
uploadDate: string;
1718
}

frontend/src/app/features/components/registration-validation-history/registration-validation-history.component.html

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ <h2>Registration Validation History</h2>
2222
*ngIf="this.sort && this.sort.prop === 'organizationNm' && this.sort.dir === 'asc'"></i>
2323
</th>
2424

25+
<th class="sortable-header" id="uploadDeliveryType_header"
26+
[class.sorted]="this.sort && this.sort.prop === 'uploadDeliveryType'"
27+
(click)="onSort('uploadDeliveryType')">Report
28+
Type
29+
<i class="pi pi-angle-down"
30+
*ngIf="this.sort && this.sort.prop === 'uploadDeliveryType' && this.sort.dir === 'desc'"></i>
31+
<i class="pi pi-angle-up"
32+
*ngIf="this.sort && this.sort.prop === 'uploadDeliveryType' && this.sort.dir === 'asc'"></i>
33+
</th>
34+
2535
<th class="sortable-header" id="status_header" [class.sorted]="this.sort && this.sort.prop === 'status'"
2636
(click)="onSort('status')">Status
2737
<i class="pi pi-angle-down"
@@ -78,21 +88,22 @@ <h2>Registration Validation History</h2>
7888
<ng-template pTemplate="body" let-row>
7989
<tr>
8090
<td>{{ row.organizationNm }}</td>
91+
<td>{{ row.uploadDeliveryType }}</td>
8192
<td>
82-
<span *ngIf="row.status==='Processed'; then processed; else pending"></span>
83-
<ng-template #processed> <span class="state-processed">{{row.status}}</span></ng-template>
84-
<ng-template #pending><span class="state-pending">{{row.status}}</span></ng-template>
93+
<span *ngIf="row.registrationStatus==='Processed'; then processed; else pending"></span>
94+
<ng-template #processed> <span class="state-processed">{{row.registrationStatus}}</span></ng-template>
95+
<ng-template #pending><span class="state-pending">{{row.registrationStatus}}</span></ng-template>
8596
</td>
8697
<td>
8798
{{row.total}}
8899
</td>
89100
<td>
90-
{{row.success}}
101+
{{row.registrationSuccess}}
91102
</td>
92103
<td>
93-
{{row.errors}}
104+
{{row.registrationErrors}}
94105
</td>
95-
<td>{{ row.updDtm |date:'yyyy-MM-dd' }}</td>
106+
<td>{{ row.uploadDate |date:'yyyy-MM-dd' }}</td>
96107
<td>{{ row.givenNm }} {{ row.familyNm }}</td>
97108
<td>
98109
<button [id]="'downloadReport_'+row.uploadDeliveryId" pButton

frontend/src/app/features/components/registration-validation-history/registration-validation-history.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ export class RegistrationValidationHistoryComponent {
108108
this.selectedPlatformId).subscribe({
109109
next: (records) => {
110110
this.currentPage = records.pageInfo;
111-
this.registrationValidationHistory = records.sourceList;
111+
this.registrationValidationHistory = records.sourceList.filter(
112+
(item: any) => item.registrationStatus !== 'Not Applicable'
113+
);
112114
},
113115
complete: () => {
114116
this.loaderService.loadingEnd();

frontend/src/app/features/components/upload-business-license/upload-business-license.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
</button>
126126
<ng-template #zero>{{ 0 }}</ng-template>
127127
</td>
128-
<td>{{ uploadHistory.updDtm | date : 'yyyy-MM-dd' }}</td>
128+
<td>{{ uploadHistory.uploadDate | date : 'yyyy-MM-dd' }}</td>
129129
<td>{{ uploadHistory.givenNm }} {{ uploadHistory.familyNm }}</td>
130130
</tr>
131131
</ng-template>

server/StrDss.Api/Controllers/RegistrationController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public async Task<ActionResult> UploadValidateRegistration([FromForm] ValidateRe
6565
public async Task<ActionResult> GetRegistrationValidationHistory(long? platformId, int pageSize, int pageNumber, string orderBy = "UpdDtm", string direction = "desc")
6666
{
6767
var history = await _uploadService.GetUploadHistory(platformId, pageSize, pageNumber, orderBy, direction,
68-
[UploadDeliveryTypes.RegistrationData]);
68+
[UploadDeliveryTypes.RegistrationData, UploadDeliveryTypes.ListingData]);
6969

7070
return Ok(history);
7171
}

server/StrDss.Data/Entities/DssDbContext.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,6 +1266,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
12661266
entity.Property(e => e.UploadDeliveryType)
12671267
.HasMaxLength(25)
12681268
.HasColumnName("upload_delivery_type");
1269+
entity.Property(e => e.UploadDate).HasColumnName("upload_date");
12691270
});
12701271

12711272
modelBuilder.Entity<DssUploadDelivery>(entity =>
@@ -1337,6 +1338,9 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
13371338
entity.Property(e => e.UploadUserGuid)
13381339
.HasComment("The globally unique identifier (assigned by the identity provider) for the user who uploaded the file")
13391340
.HasColumnName("upload_user_guid");
1341+
entity.Property(e => e.UploadDate)
1342+
.HasComment("Date and time the file was uploaded")
1343+
.HasColumnName("upload_date");
13401344

13411345
entity.HasOne(d => d.ProvidingOrganization).WithMany(p => p.DssUploadDeliveries)
13421346
.HasForeignKey(d => d.ProvidingOrganizationId)

server/StrDss.Data/Entities/DssRentalUploadHistoryView.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,6 @@ public partial class DssRentalUploadHistoryView
3636
public string? Status { get; set; }
3737

3838
public string? RegistrationStatus { get; set; }
39+
40+
public DateTime? UploadDate { get; set; }
3941
}

server/StrDss.Data/Entities/DssUploadDelivery.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ public partial class DssUploadDelivery
9999
/// </summary>
100100
public string? SourceHeaderTxt { get; set; }
101101

102+
/// <summary>
103+
/// Date and time the file was uploaded
104+
/// </summary>
105+
public DateTime UploadDate { get; set; }
106+
102107
public virtual ICollection<DssUploadLine> DssUploadLines { get; set; } = new List<DssUploadLine>();
103108

104109
public virtual DssOrganization ProvidingOrganization { get; set; } = null!;

0 commit comments

Comments
 (0)