move to storage service

This commit is contained in:
2024-03-15 13:37:07 +01:00
parent b2a971fd30
commit 22bc42f635
11 changed files with 132 additions and 1295 deletions

View File

@@ -35,32 +35,20 @@ export class UpdateCardHandler implements ICommandHandler<UpdateCardCommand> {
let questionImg, answerImg
if (command.questionImg && command.answerImg) {
const addQuestionImagePromise = this.fileUploadService.uploadFile(
command.questionImg?.buffer,
command.questionImg?.originalname
)
const addAnswerImagePromise = this.fileUploadService.uploadFile(
command.answerImg?.buffer,
command.answerImg?.originalname
)
const addQuestionImagePromise = this.fileUploadService.uploadFile(command.questionImg)
const addAnswerImagePromise = this.fileUploadService.uploadFile(command.answerImg)
const result = await Promise.all([addQuestionImagePromise, addAnswerImagePromise])
questionImg = result[0].fileUrl
answerImg = result[1].fileUrl
} else if (command.answerImg) {
const addAnswerImagePromise = this.fileUploadService.uploadFile(
command.answerImg?.buffer,
command.answerImg?.originalname
)
const addAnswerImagePromise = this.fileUploadService.uploadFile(command.answerImg)
const result = await addAnswerImagePromise
answerImg = result.fileUrl
} else if (command.questionImg) {
const addQuestionImagePromise = this.fileUploadService.uploadFile(
command.questionImg?.buffer,
command.questionImg?.originalname
)
const addQuestionImagePromise = this.fileUploadService.uploadFile(command.questionImg)
const result = await addQuestionImagePromise
questionImg = result.fileUrl