reorganizde file path

This commit is contained in:
Peter Maquiran
2024-08-27 09:14:59 +01:00
parent 98975856c1
commit e80082f9e8
54 changed files with 236 additions and 454 deletions
@@ -0,0 +1,33 @@
import { Injectable } from '@angular/core';
import { MessageAttachmentByMessageIdInput } from './message-attachment-by-message-id.service';
import { AttachmentRemoteDataSourceService } from 'src/app/module/chat/data/repository/attachment/attachment-remote-repository.service'
import { AttachmentLocalDataSource } from 'src/app/module/chat/data/repository/attachment/attachment-local-repository.service'
import { err, Result } from 'neverthrow';
@Injectable({
providedIn: 'root'
})
export class GetMessageAttachmentLocallyUseCaseService {
constructor(
private AttachmentRemoteDataSourceService: AttachmentRemoteDataSourceService,
private AttachmentLocalDataSource: AttachmentLocalDataSource
) { }
async execute(input: MessageAttachmentByMessageIdInput): Promise<Result<string, any>> {
const getLocalAttachment = await this.AttachmentLocalDataSource.findOne({
$messageId: input.$messageId
})
if(getLocalAttachment.isOk()) {
if(getLocalAttachment.value) {
return getLocalAttachment.map(e => e.file)
}
} else {
return err(getLocalAttachment.error)
}
}
}