mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
add new endpoint to save and get draft
This commit is contained in:
@@ -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<IGetDraftListByProcessIdOutput>(`${this.baseUrl}/Contents/FolderId/${input.processId}`);
|
||||
}
|
||||
|
||||
async draftSaveById(input: IDraftSaveByIdInput) {
|
||||
return await this.httpService.put<IGetDraftListByProcessIdOutput>(`${this.baseUrl}/Contents/${input.id}`, input);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user