Skip to content

Commit

Permalink
fixing log entity
Browse files Browse the repository at this point in the history
  • Loading branch information
mgtennant committed Mar 19, 2024
1 parent aea7c06 commit b3b1450
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 4 deletions.
4 changes: 3 additions & 1 deletion backend/src/document_data_log/document_data_log.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export class DocumentDataLogService {
async create(documentDataLog: CreateDocumentDataLogDto): Promise<DocumentDataLog> {
const newItem = new DocumentDataLog();
newItem.document_template_id = documentDataLog.document_template_id;
newItem.document_data_id = documentDataLog.document_data_id;
newItem.document_type_id = documentDataLog.document_type_id;
newItem.dtid = documentDataLog.dtid;
newItem.request_app_user = documentDataLog.request_app_user;
newItem.request_json = documentDataLog.request_json;
Expand All @@ -29,7 +31,7 @@ export class DocumentDataLogService {
async findByDtid(dtid: number): Promise<DocumentDataLog[]> {
return this.documentDataLogRepository.find({
where: {
document_template_id: dtid,
dtid: dtid,
},
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { DocumentDataLogDto } from './document_data_log.dto';
export class CreateDocumentDataLogDto extends PickType(DocumentDataLogDto, [
'dtid',
'document_type_id',
'document_data_id',
'document_template_id',
'request_app_user',
'request_json',
Expand Down
1 change: 1 addition & 0 deletions backend/src/document_data_log/dto/document_data_log.dto.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export class DocumentDataLogDto {
dtid: number;
document_type_id: number;
document_data_id: number;
document_template_id: number;
request_app_user: string;
request_json: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { DocumentDataLogDto } from './document_data_log.dto';
export class UpdateDocumentDataLogDto extends PickType(DocumentDataLogDto, [
'dtid',
'document_type_id',
'document_data_id',
'document_template_id',
'request_app_user',
'request_json',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export class DocumentDataLog {
@Column({ nullable: true })
document_type_id: number;
@Column({ nullable: true })
document_data_id: number;
@Column({ nullable: true })
document_template_id: number;
@Column({ nullable: true })
request_app_user: string;
Expand All @@ -26,6 +28,7 @@ export class DocumentDataLog {
constructor(
dtid?: number,
document_type_id?: number,
document_data_id?: number,
document_template_id?: number,
request_app_user?: string,
request_json?: string,
Expand All @@ -34,6 +37,7 @@ export class DocumentDataLog {
) {
this.dtid = dtid || null;
this.document_type_id = document_type_id || null;
this.document_data_id = document_data_id || null;
this.document_template_id = document_template_id || null;
this.request_app_user = request_app_user || '';
this.request_json = request_json || '';
Expand Down
14 changes: 11 additions & 3 deletions backend/src/report/report.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -679,19 +679,27 @@ export class ReportService {
// combine the formatted TTLS data, variables, and provision sections
const data = Object.assign({}, ttlsData, variables, showProvisionSections);

// Save the NFR Data
const documentData = await this.saveDocument(
dtid,
document_type_id,
'Complete',
provisionJson,
variableJson,
idirUsername
);

// Log the request
await this.documentDataLogService.create({
dtid: dtid,
document_type_id: document_type_id,
document_data_id: documentData.id,
document_template_id: documentTemplateObject?.id,
request_app_user: idirUsername,
request_json: JSON.stringify(data),
create_userid: idirUsername,
});

// Save the NFR Data
await this.saveDocument(dtid, document_type_id, 'Complete', provisionJson, variableJson, idirUsername);

// Generate the report
const cdogsToken = await this.ttlsService.callGetToken();
let bufferBase64 = documentTemplateObject.the_file;
Expand Down

0 comments on commit b3b1450

Please sign in to comment.