diff --git a/src/app/module/agenda/data/data-source/agenda-data.service.ts b/src/app/module/agenda/data/data-source/agenda-data.service.ts index 2a0c6c27b..657e9bc78 100644 --- a/src/app/module/agenda/data/data-source/agenda-data.service.ts +++ b/src/app/module/agenda/data/data-source/agenda-data.service.ts @@ -10,6 +10,7 @@ import { EventListOutputDTO } from '../dto/eventListDTOOutput'; import { HttpService } from 'src/app/services/http.service'; import { TracingType } from 'src/app/services/monitoring/opentelemetry/tracer'; import { IGetDraftListByProcessIdOutput, IGetDraftListByProcessIdSchema } from '../../domain/usecase/getDraft-list-by-process-id.service'; +import { IDraftSaveByIdInput } from '../../domain/usecase/draft-save-by-id-use-case.service'; @Injectable({ providedIn: 'root' @@ -135,4 +136,8 @@ export class AgendaDataService { async getDraftListByProcessId(input: IGetDraftListByProcessIdSchema) { return await this.httpService.get(`${this.baseUrl}/Contents/FolderId/${input.processId}`); } + + async draftSaveById(input: IDraftSaveByIdInput) { + return await this.httpService.put(`${this.baseUrl}/Contents/${input.id}`, input); + } } diff --git a/src/app/module/agenda/domain/agenda.service.ts b/src/app/module/agenda/domain/agenda.service.ts index 5b269bbd7..087c96cf8 100644 --- a/src/app/module/agenda/domain/agenda.service.ts +++ b/src/app/module/agenda/domain/agenda.service.ts @@ -1,5 +1,6 @@ import { Injectable } from '@angular/core'; import { GetDraftListByProcessIdService, IGetDraftListByProcessIdSchema } from './usecase/getDraft-list-by-process-id.service'; +import { DraftSaveByIdInputSchema, DraftSaveByIdUseCaseService, IDraftSaveByIdInput } from './usecase/draft-save-by-id-use-case.service'; @Injectable({ providedIn: 'root' @@ -7,10 +8,15 @@ import { GetDraftListByProcessIdService, IGetDraftListByProcessIdSchema } from ' export class AgendaService { constructor( - private getDraftListByProcessIdService: GetDraftListByProcessIdService + private getDraftListByProcessIdService: GetDraftListByProcessIdService, + private DraftSaveByIdUseCaseService: DraftSaveByIdUseCaseService ) { } getDraftListByProcessId(input: IGetDraftListByProcessIdSchema) { return this.getDraftListByProcessIdService.execute(input) } + + draftSaveById(input: IDraftSaveByIdInput) { + return this.DraftSaveByIdUseCaseService.execute(input) + } } diff --git a/src/app/module/agenda/domain/usecase/draft-save-by-id-use-case.service.ts b/src/app/module/agenda/domain/usecase/draft-save-by-id-use-case.service.ts new file mode 100644 index 000000000..7edc89519 --- /dev/null +++ b/src/app/module/agenda/domain/usecase/draft-save-by-id-use-case.service.ts @@ -0,0 +1,28 @@ +import { Injectable } from '@angular/core'; +import { AgendaDataService } from '../../data/data-source/agenda-data.service'; +import { z } from 'zod'; + +export const DraftSaveByIdInputSchema = z.object({ + description: z.string(), + status: z.boolean(), + content: z.string(), + path: z.string(), + ownerId: z.number(), + id: z.number() +}) + +export type IDraftSaveByIdInput= z.infer< typeof DraftSaveByIdInputSchema> + +@Injectable({ + providedIn: 'root' +}) +export class DraftSaveByIdUseCaseService { + + constructor( + private agendaDataService: AgendaDataService + ) { } + + async execute(input: IDraftSaveByIdInput) { + return await this.agendaDataService.draftSaveById(input) + } +} diff --git a/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts b/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts index f042e6b9f..752fbe553 100644 --- a/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts +++ b/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts @@ -166,7 +166,7 @@ export class DespachoPage implements OnInit { // this.updateProcessOnDB(res); this.fulltask = res; - this.getDocumentPdf(this.fulltask.Documents) + this.getDocumentPdf({FolderID: res.workflowInstanceDataFields.FolderID}) console.log('All', this.mergedArray) @@ -200,53 +200,59 @@ export class DespachoPage implements OnInit { }); } - // getDocumentPdf({FolderID}) { - // this.agendaService.getDraftListByProcessId({ - // processId: FolderID - // }).then(( draftList => { + getDocumentPdf({FolderID}) { + this.agendaService.getDraftListByProcessId({ + processId: FolderID + }).then(( draftList => { - // if(draftList.isOk()) { - // const docObject = draftList.value.data.map((e) => ({ - // "ApplicationId": "", - // "Assunto": e.description, - // "DocDate": e.createdAt, - // "DocId": "", - // "DocNumber": "element.DocNumber", - // "FolderId": e.folderId, - // "Sender": "uuid", - // "SourceDocId": "element.SourceDocId", - // "content": "", - // "path": "", - // "ownerId": "", - // "status": "", - // })) + if(draftList.isOk()) { + const docObject = draftList.value.data.map((e) => ({ + "id": e.id, + "ownerId": e.ownerId, + "path": e.path, + "description":e.description, + "ApplicationId": "", + "Assunto": e.description, + "DocDate": e.createdAt, + "DocId": "", + "DocNumber": "element.DocNumber", + "FolderId": e.folderId, + "content": e.content, + "Sender": "uuid", + "SourceDocId": "element.SourceDocId", + "status": e.status, + })) - // this.mergedArray.push(docObject); - // } - // })); - // } + for(const file of docObject) { + this.mergedArray.push(file); + } - getDocumentPdf(Documents: any) { - Documents.forEach(element => { - let docObject = { - "ApplicationId": element.ApplicationId, - "Assunto": element.Assunto, - "DocDate": element.DocDate, - "DocId": element.DocId, - "DocNumber": element.DocNumber, - "FolderId": element.FolderId, - "Sender": element.Sender, - "SourceDocId": element.SourceDocId, - "content": "", - "path": "", - "ownerId": "", - "status": "", } - this.mergedArray.push(docObject); - }); + })); } + // getDocumentPdf(Documents: any) { + + // Documents.forEach(element => { + // let docObject = { + // "ApplicationId": element.ApplicationId, + // "Assunto": element.Assunto, + // "DocDate": element.DocDate, + // "DocId": element.DocId, + // "DocNumber": element.DocNumber, + // "FolderId": element.FolderId, + // "Sender": element.Sender, + // "SourceDocId": element.SourceDocId, + // "content": "", + // "path": "", + // "ownerId": "", + // "status": "", + // } + // this.mergedArray.push(docObject); + // }); + // } + @XTracerAsync({name:'task/getDraft', bugPrint: true}) getDraft(split_stringDraft: string[], tracing?: TracingType) { split_stringDraft.forEach(element => { diff --git a/src/app/pages/gabinete-digital/viewer-attachment/prop.ts b/src/app/pages/gabinete-digital/viewer-attachment/prop.ts index 3c78d1a7f..0ea3ef3c5 100644 --- a/src/app/pages/gabinete-digital/viewer-attachment/prop.ts +++ b/src/app/pages/gabinete-digital/viewer-attachment/prop.ts @@ -11,8 +11,9 @@ export const ViewerAttachmentParams = z.object({ SourceDocId: z.string(), content: z.string().nonempty(), path: z.string().nonempty(), - ownerId: z.string().nonempty(), + ownerId: z.number(), status: z.string().nonempty(), + id: z.number().optional() }) export type ViewerAttachment = z.infer; diff --git a/src/app/pages/gabinete-digital/viewer-attachment/viewer-attachment.page.html b/src/app/pages/gabinete-digital/viewer-attachment/viewer-attachment.page.html index 71037aef3..6945d751e 100644 --- a/src/app/pages/gabinete-digital/viewer-attachment/viewer-attachment.page.html +++ b/src/app/pages/gabinete-digital/viewer-attachment/viewer-attachment.page.html @@ -23,7 +23,7 @@
{{ attachment.Assunto || "Sem assunto" }}
- {{ attachment.Sender }} + {{ attachment?.Sender }}
@@ -65,10 +65,10 @@
-
+
{ - console.log('Saved tinymce') - - }, (error) => { - this.erroHandler.httpStatusHandle(error) + "ownerId": document.ownerId, + "id": document.id }) + if(saveResult.isOk()) { + console.log('Saved tinymce') + } else { + if(saveResult.error.status) { + this.erroHandler.httpStatusHandle(saveResult.error) + } + + } } onEditorContentChange() { diff --git a/src/app/shared/gabinete-digital/generic/task-details/task-details.page.html b/src/app/shared/gabinete-digital/generic/task-details/task-details.page.html index 97240ab6c..d15af0cfe 100644 --- a/src/app/shared/gabinete-digital/generic/task-details/task-details.page.html +++ b/src/app/shared/gabinete-digital/generic/task-details/task-details.page.html @@ -88,7 +88,7 @@

{{ Document.Assunto || "Sem assunto" }} Rascunho

-

{{ Document.Sender}}{{ Document.DocDate | date: 'dd-MM-yyyy HH:mm' }}

+

{{ Document?.Sender}}{{ Document.DocDate | date: 'dd-MM-yyyy HH:mm' }}

diff --git a/version/git-version.ts b/version/git-version.ts index 6068b52f7..888e68339 100644 --- a/version/git-version.ts +++ b/version/git-version.ts @@ -1,11 +1,11 @@ export let versionData = { - "shortSHA": "f3e09cadf", - "SHA": "f3e09cadf241a72b4a79dbe59ac500ff54e0cea4", + "shortSHA": "38f51bd7e", + "SHA": "38f51bd7e14fe61747947721d048e7674d55ff9d", "branch": "feature/agenda-api-peter", "lastCommitAuthor": "'Peter Maquiran'", - "lastCommitTime": "'Wed Sep 11 16:04:43 2024 +0100'", - "lastCommitMessage": "add endpoint to get document drafts", - "lastCommitNumber": "5901", - "changeStatus": "On branch feature/agenda-api-peter\nYour branch is ahead of 'origin/feature/agenda-api-peter' by 1 commit.\n (use \"git push\" to publish your local commits)\n\nChanges to be committed:\n (use \"git restore --staged ...\" to unstage)\n\tmodified: version/git-version.ts", + "lastCommitTime": "'Wed Sep 11 16:06:47 2024 +0100'", + "lastCommitMessage": "fix images", + "lastCommitNumber": "5902", + "changeStatus": "On branch feature/agenda-api-peter\nYour branch is ahead of 'origin/feature/agenda-api-peter' by 2 commits.\n (use \"git push\" to publish your local commits)\n\nChanges to be committed:\n (use \"git restore --staged ...\" to unstage)\n\tnew file: src/app/module/agenda/domain/usecase/draft-save-by-id-use-case.service.ts\n\nChanges not staged for commit:\n (use \"git add ...\" to update what will be committed)\n (use \"git restore ...\" to discard changes in working directory)\n\tmodified: src/app/module/agenda/data/data-source/agenda-data.service.ts\n\tmodified: src/app/module/agenda/domain/agenda.service.ts\n\tmodified: src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts\n\tmodified: src/app/pages/gabinete-digital/viewer-attachment/prop.ts\n\tmodified: src/app/pages/gabinete-digital/viewer-attachment/viewer-attachment.page.html\n\tmodified: src/app/pages/gabinete-digital/viewer-attachment/viewer-attachment.page.scss\n\tmodified: src/app/pages/gabinete-digital/viewer-attachment/viewer-attachment.page.ts\n\tmodified: src/app/shared/gabinete-digital/generic/task-details/task-details.page.html", "changeAuthor": "peter.maquiran" } \ No newline at end of file