mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
add audio
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { z } from "zod";
|
||||
import { MessageAttachmentFileType, MessageAttachmentSource } from "./messageOutputDTO";
|
||||
import { base64Schema } from "src/app/utils/zod";
|
||||
|
||||
export const MessageInputDTOSchema = z.object({
|
||||
roomId: z.string().uuid(),
|
||||
@@ -13,10 +14,10 @@ export const MessageInputDTOSchema = z.object({
|
||||
attachment: z.object({
|
||||
fileType: z.nativeEnum(MessageAttachmentFileType),
|
||||
source: z.nativeEnum(MessageAttachmentSource),
|
||||
file: z.string(),
|
||||
fileName: z.string(),
|
||||
applicationId: z.string(),
|
||||
docId: z.string(),
|
||||
file: base64Schema.optional(),
|
||||
fileName: z.string().optional(),
|
||||
applicationId: z.string().optional(),
|
||||
docId: z.string().optional(),
|
||||
mimeType: z.string().optional()
|
||||
}).optional()
|
||||
});
|
||||
|
||||
@@ -42,7 +42,7 @@ export const MessageOutPutDataDTOSchema = z.object({
|
||||
fileName: z.string().optional(),
|
||||
applicationId: z.string().optional(),
|
||||
docId: z.string().optional(),
|
||||
id: z.string()
|
||||
id: z.string().optional()
|
||||
}))
|
||||
});
|
||||
|
||||
|
||||
@@ -227,11 +227,11 @@ export class RoomRepositoryService {
|
||||
@captureAndReraiseAsync('RoomRepositoryService/addMemberToRoom')
|
||||
async addMemberToRoom(data: AddMemberToRoomInputDTO) {
|
||||
|
||||
//return this.roomLiveSignalRDataSourceService.addMemberToRoom(data)
|
||||
return this.roomLiveSignalRDataSourceService.addMemberToRoom(data)
|
||||
|
||||
const result = await this.roomRemoteDataSourceService.addMemberToRoom(data)
|
||||
// const result = await this.roomRemoteDataSourceService.addMemberToRoom(data)
|
||||
|
||||
return result
|
||||
// return result
|
||||
}
|
||||
|
||||
async updateMemberStatus(data: MemberListUPdateStatusInputDTO) {
|
||||
|
||||
@@ -26,8 +26,10 @@ export const MessageEntitySchema = z.object({
|
||||
file: base64Schema.optional(),
|
||||
fileName: z.string().optional(),
|
||||
applicationId: z.string().optional(),
|
||||
docId: z.string().optional()
|
||||
})),
|
||||
docId: z.string().optional(),
|
||||
id: z.string().optional(),
|
||||
mimeType: z.string().optional()
|
||||
})).optional()
|
||||
})
|
||||
|
||||
type Message = z.infer<typeof MessageEntitySchema>;
|
||||
|
||||
@@ -9,7 +9,7 @@ export class MessageMapper {
|
||||
}
|
||||
|
||||
static fromDomain(entity:MessageEntity, requestId): MessageInputDTO {
|
||||
return{
|
||||
return {
|
||||
canEdit: entity.canEdit,
|
||||
message: entity.message,
|
||||
messageType: entity.messageType,
|
||||
@@ -18,7 +18,16 @@ export class MessageMapper {
|
||||
roomId: entity.roomId,
|
||||
senderId: entity.sender.wxUserId,
|
||||
requestId: requestId,
|
||||
attachment: entity.attachments[0]
|
||||
attachment: entity.attachments.map((e)=>({
|
||||
fileType:e.fileType,
|
||||
source: e.source,
|
||||
file: e.file,
|
||||
fileName: e.fileName,
|
||||
applicationId: e.applicationId,
|
||||
docId: e.docId,
|
||||
mimeType: e.mimeType
|
||||
}))[0]
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,9 +47,13 @@ export class MessageCreateUseCaseService {
|
||||
|
||||
for (const attachment of message.attachments) {
|
||||
|
||||
const createAttachmentLocally = this.AttachmentRepositoryService.create({
|
||||
this.AttachmentRepositoryService.create({
|
||||
$messageId: createMessageLocally.value.$id,
|
||||
file: createDataURL(attachment.file, attachment.mimeType)
|
||||
}).then((e) => {
|
||||
if(e.isErr()) {
|
||||
console.log('e', e.error, createDataURL(attachment.file, attachment.mimeType))
|
||||
}
|
||||
})
|
||||
|
||||
attachment.safeFile = createDataURL(attachment.file, attachment.mimeType)
|
||||
|
||||
@@ -31,7 +31,9 @@ export const MessageTableSchema = z.object({
|
||||
source: z.nativeEnum(MessageAttachmentSource),
|
||||
fileName: z.string().optional(),
|
||||
applicationId: z.string().optional(),
|
||||
docId: z.string().optional()
|
||||
docId: z.string().optional(),
|
||||
id: z.string().optional(),
|
||||
mimeType: z.string().optional()
|
||||
})).optional()
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user