Skip to content

Conversation

@kbs1027
Copy link
Collaborator

@kbs1027 kbs1027 commented Mar 31, 2024

관련이슈

  • 추후 storage와 연계가 필요

요약

뱃지 관련 기능 생성

상세

  • 뱃지 생성
  • 뱃지 조회(전체, 유저)
  • 뱃지 뱍탈
  • 뱃지 부여

리뷰안내

  • 10분
  • storage와 연동이 아직 안되었습니다

kbs1027 added 2 commits March 31, 2024 15:45
- auth에 필요없는 import 제거
- 뱃지 등록
- 뱃지 조회(전체, 유저)
- 뱃지 부여 기능
- 뱃지 박탈 기능
- #56
@kbs1027 kbs1027 self-assigned this Mar 31, 2024
@kbs1027 kbs1027 added the Feat 새로운 기능을 추가한 경우 label Mar 31, 2024
@kbs1027 kbs1027 linked an issue Mar 31, 2024 that may be closed by this pull request
3 tasks
hdh4952
hdh4952 previously approved these changes Mar 31, 2024
Copy link
Member

@hdh4952 hdh4952 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@jasper200207 jasper200207 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

뱃지 부여 및 삭제 통합하도록 코멘트 확인해주세요

Comment on lines 82 to 84
async getBadges(): Promise<Badge[]> {
return this.badgeService.getBadges();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이건 어드민 권한으로 해야할 듯 합니다

Comment on lines 1 to 4
export class GrantRequestBadgeDto {
userId: string;
badgeId: string;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이거 형식을

export class GrantRequestBadgeDto {
    userId:string;
    grantedBadges:string[];
    deprivedBadges:string[];
}

Comment on lines +86 to +96
@Get('/:userId')
@ApiOperation({
summary: 'Get Badges By UserId',
description: 'Get Badges By UserId',
})
@ApiCreatedResponse({
description: 'Badges',
})
async getBadgesByUserId(userId: string): Promise<Badge[]> {
return this.badgeService.getBadgesByUserId(userId);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 부분은 유저 프로필 조호와 합칩시다

Comment on lines 69 to 73
const badgeLog = new BadgeLog();
badgeLog.badge = badge;
badgeLog.user = user;
badgeLog.isGiven = true;
return await this.badgeLogRepository.save(badgeLog);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이건 없어도 됩니다. 디비에서 남길거에요

Comment on lines +19 to +20
@InjectRepository(BadgeLog)
private readonly badgeLogRepository: Repository<BadgeLog>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

뱃지 로그 관련은 다 빼도 됩니다

Comment on lines 114 to 118
const badgeLog = new BadgeLog();
badgeLog.badge = badge;
badgeLog.user = user;
badgeLog.isGiven = false;
await this.badgeLogRepository.save(badgeLog);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

위와 같습니다

Comment on lines +108 to +112
await this.userRepository
.createQueryBuilder()
.relation(User, 'badges')
.of(user)
.remove(badge);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

부여 안된 뱃지만 삭제하는걸로 합시다

// await this.badgeRepository.delete({ id: badgeId });
// }

async depriveBadgeFromUser(badgeId: string, userId: string): Promise<void> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

초기 생성 뱃지는 삭제안되도록 해주세요
basic 컬럼 추가해서 확인하면 될듯 합니다

kbs1027 added 2 commits April 3, 2024 01:07
- key가 nullable이 불가능하게 설정
- badge 매개변수를 badgeId[]로 받게함
- 리스트를 받아서 한번에 저장, 박탈
- 리스트로 dto도 변환
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feat 새로운 기능을 추가한 경우

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Badge 기능 구현

4 participants