mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
add atribute to message
This commit is contained in:
@@ -4,7 +4,6 @@ import { MessageInputDTO, MessageInputDTOSchema } from '../../dto/message/messag
|
||||
import { ValidateSchema } from 'src/app/services/decorators/validate-schema.decorator';
|
||||
import { APIReturn } from 'src/app/services/decorators/api-validate-schema.decorator';
|
||||
import { MessageOutPutDTO, MessageOutPutDTOSchema } from '../../dto/message/messageOutputDTO';
|
||||
import { MessageListOutput } from '../../dto/message/messageListOutputDTO';
|
||||
import { DataSourceReturn } from 'src/app/services/Repositorys/type';
|
||||
|
||||
@Injectable({
|
||||
@@ -26,7 +25,7 @@ export class MessageRemoteDataSourceService {
|
||||
return await this.httpService.post<any>(`${this.baseUrl}/Messages/${id}/React`, reaction);
|
||||
}
|
||||
|
||||
async getMessagesFromRoom(id: string): DataSourceReturn<MessageListOutput> {
|
||||
async getMessagesFromRoom(id: string): DataSourceReturn<MessageOutPutDTO> {
|
||||
return await this.httpService.get(`${this.baseUrl}/Room/${id}/Messages`);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
import { z } from "zod"
|
||||
|
||||
const SenderSchema = z.object({
|
||||
wxUserId: z.number(),
|
||||
wxFullName: z.string(),
|
||||
wxeMail: z.string(),
|
||||
userPhoto: z.string()
|
||||
});
|
||||
|
||||
const DataSchema = z.object({
|
||||
id: z.string(),
|
||||
sender: SenderSchema,
|
||||
message: z.string(),
|
||||
messageType: z.number(),
|
||||
sentAt: z.string().datetime(),
|
||||
deliverAt: z.string().datetime().nullable(),
|
||||
canEdit: z.boolean(),
|
||||
oneShot: z.boolean(),
|
||||
requireUnlock: z.boolean()
|
||||
});
|
||||
|
||||
const MessageListOutputSchema = z.object({
|
||||
success: z.boolean(),
|
||||
message: z.string().nullable(),
|
||||
data: z.array(DataSchema)
|
||||
});
|
||||
|
||||
|
||||
export type MessageListOutput = z.infer<typeof MessageListOutputSchema>
|
||||
@@ -2,7 +2,7 @@ import { z } from "zod"
|
||||
|
||||
const DataSchema = z.object({
|
||||
id: z.string(),
|
||||
chatRoomId: z.string(),
|
||||
roomId: z.string(),
|
||||
wxUserId: z.number(),
|
||||
sender: z.object({
|
||||
wxUserId: z.number(),
|
||||
@@ -17,14 +17,17 @@ const DataSchema = z.object({
|
||||
canEdit: z.boolean(),
|
||||
oneShot: z.boolean(),
|
||||
requireUnlock: z.boolean(),
|
||||
requestId: z.string()
|
||||
requestId: z.string(),
|
||||
reactions: z.array(z.object({})),
|
||||
info: z.array(z.object({})),
|
||||
attachments: z.array(z.object({}))
|
||||
});
|
||||
|
||||
|
||||
export const MessageOutPutDTOSchema = z.object({
|
||||
success: z.boolean(),
|
||||
message: z.string(),
|
||||
data: DataSchema
|
||||
data: DataSchema.array()
|
||||
});
|
||||
|
||||
export type MessageOutPutDataDTO = z.infer<typeof DataSchema>
|
||||
|
||||
Reference in New Issue
Block a user