mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
add audio
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user