add contact page

This commit is contained in:
Peter Maquiran
2024-08-16 17:17:32 +01:00
parent 6072a2456b
commit 9d441a3e5b
10 changed files with 241 additions and 252 deletions
@@ -4,6 +4,7 @@ import { AttachmentRemoteDataSourceService } from 'src/app/module/chat/data/data
import { AttachmentLocalDataSource } from 'src/app/module/chat/data/data-source/attachment/attachment-local-data-source.service'
import { convertBlobToDataURL } from 'src/app/utils/ToBase64';
import { Result } from 'neverthrow';
import { Logger } from 'src/app/services/logger/main/service';
const MessageAttachmentByMessageIdSchema = z.object({
$messageId: z.number(),
@@ -33,10 +34,13 @@ export class MessageAttachmentByMessageIdUseCase {
return getLocalAttachment.map(e => e.file)
}
} else {
const result = await this.AttachmentRemoteDataSourceService.getAttachment(input)
const result = await this.AttachmentRemoteDataSourceService.getAttachment(input.id)
return result.asyncMap(async (e) => {
const dataUrl = await convertBlobToDataURL(e)
Logger.info('downloaded file', {
data: dataUrl.slice(0, 100)+'...'
})
this.AttachmentLocalDataSource.insert({
$messageId: input.$messageId,