Skip to content

Commit

Permalink
[BE#232] 이미지 유해성 검사 url -> 이미지 데이터
Browse files Browse the repository at this point in the history
  • Loading branch information
victolee0 authored Nov 28, 2023
1 parent b3ebc29 commit 89ef465
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion BE/src/users/users.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ export class UsersController {
async validateNickname(@Query('nickname') nickname: string): Promise<object> {
return this.usersService.isUniqueNickname(nickname);
}
}
}
8 changes: 4 additions & 4 deletions BE/src/users/users.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ export class UsersService {
return selectedUser;
}

async isNormalImage(image_url: string): Promise<boolean> {
async isNormalImage(image: Express.Multer.File): Promise<boolean> {
const THRESHOLD = 0.5;
const response = await this.requestClovaGreenEye(image_url);
const response = await this.requestClovaGreenEye(image);
const result = response.images[0].result;
const message = response.images[0].message;
if (message !== 'SUCCESS') {
Expand All @@ -92,7 +92,7 @@ export class UsersService {
return isNormal;
}

async requestClovaGreenEye(image_url: string): Promise<GreenEyeResponse> {
async requestClovaGreenEye(image: Express.Multer.File): Promise<GreenEyeResponse> {
const APIURL = this.config.get<string>('GREENEYE_URL');
const CLIENT_SECRET = this.config.get<string>('GREENEYE_SECRET');
const UUID = v4();
Expand All @@ -110,7 +110,7 @@ export class UsersService {
images: [
{
name: `${UUID}_profile`,
url: image_url,
data: image.buffer.toString('base64'),
},
],
}),
Expand Down

0 comments on commit 89ef465

Please sign in to comment.