Skip to content

Commit

Permalink
chore: changed image url prefix (#218)
Browse files Browse the repository at this point in the history
* chore: changed image url prefix

* chore: message
  • Loading branch information
kyY00n committed Apr 25, 2024
1 parent 6cba715 commit dfd5bce
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ jobs:
GITHUB_TOKEN: ${{ secrets.TOKEN_FOR_PR }}
FROM_BRANCH: "main"
TO_BRANCH: "develop"
PULL_REQUEST_TITLE: "sync: ${{ github.ref_name || github.ref }} -> main -> develop"
PULL_REQUEST_TITLE: "sync: main -> develop"
3 changes: 2 additions & 1 deletion src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,6 @@ export default {
/**
* piickle service application url
*/
webAppUrl: WEB_APP_URL as string
webAppUrl: WEB_APP_URL as string,
imageServerUrl: process.env.IMAGE_SERVER_URL as string
};
7 changes: 5 additions & 2 deletions src/controllers/userController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,12 +363,15 @@ const updateUserProfileImage = async (
throw new IllegalArgumentException('필요한 값이 없습니다.');
}
const image = req.file as Express.MulterS3.File;
const { location } = image;
const { key } = image;
const userId = req.user?.id;
if (!userId) {
throw new IllegalArgumentException('로그인이 필요합니다.');
}
const data = await UserService.updateUserProfileImage(userId, location);
const data = await UserService.updateUserProfileImage(
userId,
`${config.imageServerUrl}/${key}`
);
return res
.status(statusCode.OK)
.send(
Expand Down
5 changes: 4 additions & 1 deletion src/intefaces/createUserCommand.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import config from '../config';
import { AgeGroup, AgeGroupKey } from '../models/user/ageGroup';
import { Gender, GenderKey } from '../models/user/gender';
import { TypedRequest } from '../types/TypedRequest';
Expand Down Expand Up @@ -28,7 +29,9 @@ const toCommand = (req: TypedRequest<CreateUserReq>) => {
? AgeGroup[req.body.ageGroup]
: AgeGroup.UNDEFINED,
gender: req.body.gender ? Gender[req.body.gender] : Gender.ETC,
profileImgUrl: (req?.file as Express.MulterS3.File)?.location
profileImgUrl: `${config.imageServerUrl}/${
(req?.file as Express.MulterS3.File)?.key
}`
};
return createUserCommand;
};
Expand Down

0 comments on commit dfd5bce

Please sign in to comment.