Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: changed image url prefix #218

Merged
merged 3 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading