• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

khu-khlug / sight-backend / 14190117854

01 Apr 2025 07:47AM UTC coverage: 51.423%. Remained the same
14190117854

push

github

web-flow
refactor: 메시지 전송 클래스 구현을 위해 기존 클래스 및 파일 이름 변경 (#115)

796 of 2513 branches covered (31.68%)

Branch coverage included in aggregate %.

29 of 34 new or added lines in 18 files covered. (85.29%)

36 existing lines in 6 files now uncovered.

2222 of 3356 relevant lines covered (66.21%)

13.1 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

78.82
/src/app/application/group/command/removeBookmark/RemoveBookmarkCommandHandler.ts
1
import {
2
  Inject,
1✔
3
  NotFoundException,
4
  UnprocessableEntityException,
5
} from '@nestjs/common';
1✔
6
import { CommandHandler, ICommandHandler } from '@nestjs/cqrs';
7

8
import { MessageBuilder } from '@khlug/core/message/MessageBuilder';
10✔
9
import { Transactional } from '@khlug/core/persistence/transaction/Transactional';
10

11
import { RemoveBookmarkCommand } from '@khlug/app/application/group/command/removeBookmark/RemoveBookmarkCommand';
1✔
12

1✔
13
import { INotifier, NotifierToken } from '@khlug/app/domain/adapter/INotifier';
1✔
14
import {
1✔
15
  GroupBookmarkRepository,
1✔
16
  IGroupBookmarkRepository,
1✔
17
} from '@khlug/app/domain/group/IGroupBookmarkRepository';
1✔
18
import {
1✔
19
  GroupRepository,
1✔
20
  IGroupRepository,
1✔
21
} from '@khlug/app/domain/group/IGroupRepository';
1✔
22
import { NotificationCategory } from '@khlug/constant/notification';
23

15!
NEW
24
import { Message } from '@khlug/constant/error';
×
25
import { Template } from '@khlug/constant/template';
26

27
@CommandHandler(RemoveBookmarkCommand)
28
export class RemoveBookmarkCommandHandler
29
  implements ICommandHandler<RemoveBookmarkCommand>
30
{
31
  constructor(
15✔
32
    @Inject(GroupRepository)
33
    private readonly groupRepository: IGroupRepository,
15✔
34
    @Inject(GroupBookmarkRepository)
35
    private readonly groupBookmarkRepository: IGroupBookmarkRepository,
36
    @Inject(NotifierToken)
2!
37
    private readonly slackSender: INotifier,
2!
UNCOV
38
  ) {}
×
39

2✔
40
  @Transactional()
41
  async execute(command: RemoveBookmarkCommand): Promise<void> {
42
    const { groupId, userId } = command;
5!
43

44
    const group = await this.groupRepository.findById(groupId);
45
    if (!group) {
3✔
46
      throw new NotFoundException(Message.GROUP_NOT_FOUND);
3✔
47
    }
48

49
    if (group.isCustomerServiceGroup() || group.isPracticeGroup()) {
50
      throw new UnprocessableEntityException(Message.DEFAULT_BOOKMARKED_GROUP);
51
    }
5✔
52

5✔
53
    const prevBookmark =
5✔
54
      await this.groupBookmarkRepository.findByGroupIdAndUserId(
1✔
55
        groupId,
56
        userId,
4✔
57
      );
2✔
58
    if (!prevBookmark) {
59
      return;
2✔
60
    }
2✔
61
    await this.groupBookmarkRepository.remove(prevBookmark);
1✔
62

63
    this.slackSender.send({
1✔
64
      category: NotificationCategory.GROUP_ACTIVITY_FOR_ME,
1✔
65
      targetUserId: userId,
66
      message: MessageBuilder.build(
67
        Template.REMOVE_GROUP_BOOKMARK.notification,
68
        { groupId, groupTitle: group.title },
69
      ),
70
    });
71
  }
72
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc