add endpoint to get document drafts

This commit is contained in:
Peter Maquiran
2024-09-11 16:04:43 +01:00
parent 899b3ec3c0
commit f3e09cadf2
222 changed files with 799 additions and 8 deletions
+9
View File
@@ -0,0 +1,9 @@
import { NgModule, LOCALE_ID } from '@angular/core';
@NgModule({
imports: [],
declarations: [],
schemas: [],
providers: []
})
export class AgendaModule {}
@@ -9,6 +9,7 @@ import { AttendeesRemoveInputDTO } from '../dto/attendeeRemoveInputDTO';
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';
@Injectable({
providedIn: 'root'
@@ -130,4 +131,8 @@ export class AgendaDataService {
async getSharedCalendar() {
return await this.httpService.get<SharedCalendarListOutputDTO>(`${this.baseUrl}/Users/${SessionStore.user.UserId}/ShareCalendar`);
}
async getDraftListByProcessId(input: IGetDraftListByProcessIdSchema) {
return await this.httpService.get<IGetDraftListByProcessIdOutput>(`${this.baseUrl}/Contents/FolderId/${input.processId}`);
}
}
@@ -0,0 +1,16 @@
import { Injectable } from '@angular/core';
import { GetDraftListByProcessIdService, IGetDraftListByProcessIdSchema } from './usecase/getDraft-list-by-process-id.service';
@Injectable({
providedIn: 'root'
})
export class AgendaService {
constructor(
private getDraftListByProcessIdService: GetDraftListByProcessIdService
) { }
getDraftListByProcessId(input: IGetDraftListByProcessIdSchema) {
return this.getDraftListByProcessIdService.execute(input)
}
}
@@ -0,0 +1,60 @@
import { Injectable } from '@angular/core';
import { z } from 'zod';
import { AgendaDataService } from '../../data/data-source/agenda-data.service';
export const GetDraftListByProcessIdSchema = z.object({
processId: z.number()
});
export type IGetDraftListByProcessIdSchema = z.infer<typeof GetDraftListByProcessIdSchema>
//=======================================
const UserSchema = z.object({
wxUserId: z.number(),
createdAt: z.string(),
});
const VersionSchema = z.object({
versionID: z.number(),
versionNumber: z.number(),
createdBy: z.number(),
editDuration: z.number(),
content: z.string(),
createdDate: z.string(),
updatedDate: z.string(),
});
export const GetDraftListByProcessIdOutputSchema = z.object({
success: z.boolean(),
message: z.string().nullable(),
data: z.array(z.object({
id: z.number(),
description: z.string(),
path: z.string(),
nnc: z.string().nullable(),
status: z.boolean(),
content: z.string(),
wxDoctypeId: z.string().nullable(),
ownerId: z.number(),
createdAt: z.string(),
updatedAt: z.string(),
serialNumber: z.string().nullable(),
folderId: z.number(),
users: z.array(UserSchema),
version: z.array(VersionSchema),
})),
});
export type IGetDraftListByProcessIdOutput = z.infer<typeof GetDraftListByProcessIdOutputSchema>
@Injectable({
providedIn: 'root'
})
export class GetDraftListByProcessIdService {
constructor(
private agendaDataService: AgendaDataService
) { }
async execute(input: IGetDraftListByProcessIdSchema) {
return await this.agendaDataService.getDraftListByProcessId(input)
}
}