Skip to content

Commit

Permalink
refactor: 대시보드 통계 dto 구조 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
jjeonghak committed Nov 27, 2024
1 parent 8c38eb7 commit e5a8a55
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions apps/server/src/task/service/task.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -462,16 +462,21 @@ export class TaskService {
.andWhere('section.name = :name', { name: 'Done' })
.getCount();

const contributorStatistic = await this.contributorRepository
const contributorStatisticRecord = await this.contributorRepository
.createQueryBuilder('c')
.leftJoin('account', 'a', 'c.userId = a.id')
.leftJoin('task_assignee', 'ta', 'c.userId = ta.accountId')
.where('c.projectId = :projectId OR ta.projectId IS NULL', { projectId })
.andWhere('ta.projectId = :projectId', { projectId })
.select(['c.userId AS id', 'a.username AS username', 'COUNT(ta.id) AS count'])
.select([
'c.userId AS id',
'a.username AS username',
'a.profileImage AS profileImage',
'COUNT(ta.id) AS count',
])
.groupBy('c.userId')
.getRawMany();
contributorStatistic.map((statistic) => ({
const contributorStatistic = contributorStatisticRecord.map((statistic) => ({
...statistic,
count: parseInt(statistic.count, 10),
}));
Expand Down

0 comments on commit e5a8a55

Please sign in to comment.