Skip to content

Commit

Permalink
chore : 파일 저장할 경로 지정해주는 핸들러 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
sk000801 committed Nov 22, 2023
1 parent edb4249 commit f0a1d14
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions server/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const fileSize: Record<string, number> = {
MUSIC_FILE_LIMIT_SIZE: 1024 * 1024 * 50,
IMAGE_FILE_LIMIT_SIZE: 1024 * 1024 * 5,
MUSIC_SIZE: 1024 * 1024 * 50,
IMAGE_SIZE: 1024 * 1024 * 5,
};

export enum Genres {
Expand All @@ -14,10 +14,12 @@ export enum Genres {
'etc' = 'etc',
}

export const fileExt = ['jpeg', 'jpg', 'png', 'mp3'];
export const keyFlags = ['user', 'music', 'cover'];

export const pathPattern = [
/^image\/user\/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
/^image\/cover\/\d+$/,
/^music\/\d+$/,
];
export const keyHandler: {
[key: string]: (uuid: string) => string;
} = {
user: (uuid) => `image/user/${uuid}/user.png`,
music: (uuid) => `music/${uuid}/music.mp3`,
cover: (uuid) => `image/cover/${uuid}/cover.png`,
};

0 comments on commit f0a1d14

Please sign in to comment.