Skip to content

Commit

Permalink
Merge branch 'dev' into dev-admin-imgUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
hanyiseo2 committed Aug 15, 2023
2 parents 4c57226 + 5390f4e commit 638ac68
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/service/ImageService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import {
DuplicatedEntryError,
FailedToCreateError,
} from '@src/utils/errors/errors';

import storage from '../config/s3Config';

class ImageService {
s3FileDao: S3FileDao;

Expand Down Expand Up @@ -34,8 +36,8 @@ class ImageService {
): Promise<string> {
try {
const fileContent: Buffer = fs.readFileSync(fileData.path);

const keyWithPrefix = `perfumes/${fileData.originalname}`;

const params: {
Bucket: string;
Key: string;
Expand All @@ -47,6 +49,7 @@ class ImageService {
};

const result = await storage.upload(params).promise();

return result.Location;
} catch (err: Error | any) {
if (err.parent?.errno === 1062) {
Expand Down

0 comments on commit 638ac68

Please sign in to comment.