Skip to content

Commit

Permalink
refactor: 태스크/프로젝트 모듈 병합
Browse files Browse the repository at this point in the history
  • Loading branch information
jjeonghak committed Dec 3, 2024
1 parent c7a9228 commit 7fffddb
Show file tree
Hide file tree
Showing 61 changed files with 152 additions and 188 deletions.
10 changes: 5 additions & 5 deletions apps/server/config/typeorm.config.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { TypeOrmModuleOptions, TypeOrmOptionsFactory } from '@nestjs/typeorm';
import { Task } from '@/task/domain/task.entity';
import { Section } from '@/task/domain/section.entity';
import { Task } from '@/project/entity/task.entity';
import { Section } from '@/project/entity/section.entity';
import { Account } from '@/account/entity/account.entity';
import { Project } from '@/project/entity/project.entity';
import { Contributor } from '@/project/entity/contributor.entity';
import { SubTask } from '@/task/domain/subTask.entity';
import { SubTask } from '@/project/entity/subTask.entity';
import { Sprint } from '@/project/entity/sprint.entity';
import { Label } from '@/project/entity/label.entity';
import { TaskLabel } from '@/task/domain/task-label.entity';
import { TaskAssignee } from '@/task/domain/task-assignee.entity';
import { TaskLabel } from '@/project/entity/task-label.entity';
import { TaskAssignee } from '@/project/entity/task-assignee.entity';

@Injectable()
export class TypeormConfig implements TypeOrmOptionsFactory {
Expand Down
2 changes: 0 additions & 2 deletions apps/server/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { ConfigModule } from '@nestjs/config';
import { APP_FILTER, APP_INTERCEPTOR, APP_PIPE } from '@nestjs/core';
import { EventEmitterModule } from '@nestjs/event-emitter';
import * as cookieParser from 'cookie-parser';
import { TaskModule } from '@/task/task.module';
import { TypeormConfig } from '../config/typeorm.config';
import { AppService } from '@/app.service';
import { AppController } from '@/app.controller';
Expand All @@ -29,7 +28,6 @@ import { ImageModule } from './image/image.module';
},
}),
EventEmitterModule.forRoot(),
TaskModule,
AccountModule,
ProjectModule,
PlanningPokerModule,
Expand Down
4 changes: 2 additions & 2 deletions apps/server/src/image/controller/image.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ export class ImageController {

@Post('presigned-url')
@ResponseMessage('Presigned URL이 성공적으로 생성되었습니다.')
async getUploadUrl(@Body() fileNameRequest: FileNameRequest) {
getUploadUrl(@Body() fileNameRequest: FileNameRequest) {
return this.imageService.getUploadUrl(fileNameRequest.fileName);
}

@Get('access-url/:key')
@ResponseMessage('이미지의 접근 URL이 성공적으로 조회되었습니다.')
async getPublicUrl(@AuthUser() user: Account, @Param('key') key: string) {
getPublicUrl(@AuthUser() user: Account, @Param('key') key: string) {
return this.imageService.getAccessUrl(user.id, key);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { Response } from 'express';
import { AccessTokenGuard } from '@/account/guard/accessToken.guard';
import { AuthUser } from '@/account/decorator/authUser.decorator';
import { Account } from '@/account/entity/account.entity';
import { CustomResponse } from '@/task/domain/custom-response.interface';
import { BroadcastService } from '@/task/service/broadcast.service';
import { CustomResponse } from '@/project/interface/custom-response.interface';
import { BroadcastService } from '@/project/service/broadcast.service';

@UseGuards(AccessTokenGuard)
@Controller('event')
Expand Down
10 changes: 3 additions & 7 deletions apps/server/src/project/controller/label.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { AccessTokenGuard } from '@/account/guard/accessToken.guard';
import { LabelService } from '@/project/service/label.service';
import { AuthUser } from '@/account/decorator/authUser.decorator';
import { Account } from '@/account/entity/account.entity';
import { LabelDetailsRequest } from '@/project/dto/label-details-request.dto';
import { LabelDetailsRequest } from '@/project/dto/label/label-details-request.dto';
import { ResponseMessage } from '@/common/decorator/response-message.decorator';

@UseGuards(AccessTokenGuard)
Expand All @@ -13,17 +13,13 @@ export class LabelController {

@Patch(':id')
@ResponseMessage('라벨 상세 정보 수정 완료했습니다.')
async update(
@AuthUser() user: Account,
@Param('id') id: number,
@Body() body: LabelDetailsRequest
) {
update(@AuthUser() user: Account, @Param('id') id: number, @Body() body: LabelDetailsRequest) {
return this.labelService.update(user.id, id, body.name, body.description, body.color);
}

@Delete(':id')
@ResponseMessage('라벨 삭제 완료했습니다.')
async delete(@AuthUser() user: Account, @Param('id') id: number) {
delete(@AuthUser() user: Account, @Param('id') id: number) {
return this.labelService.delete(user.id, id);
}
}
44 changes: 18 additions & 26 deletions apps/server/src/project/controller/project.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ import {
} from '@nestjs/common';
import { ProjectService } from '@/project/service/project.service';
import { AccessTokenGuard } from '@/account/guard/accessToken.guard';
import { CreateProjectRequest } from '@/project/dto/create-project-request.dto';
import { CreateProjectRequest } from '@/project/dto/project/create-project-request.dto';
import { AuthUser } from '@/account/decorator/authUser.decorator';
import { Account } from '@/account/entity/account.entity';
import { InviteUserRequest } from '@/project/dto/invite-user-request.dto';
import { UpdateContributorRequest } from '@/project/dto/update-contributor-request.dts';
import { TaskEvent } from '@/task/dto/task-event.dto';
import { TaskService } from '@/task/service/task.service';
import { EventType } from '@/task/enum/eventType.enum';
import { InviteUserRequest } from '@/project/dto/contributor/invite-user-request.dto';
import { UpdateContributorRequest } from '@/project/dto/contributor/update-contributor-request.dts';
import { TaskEvent } from '@/project/dto/task/task-event.dto';
import { TaskService } from '@/project/service/task.service';
import { EventType } from '@/project/enum/eventType.enum';
import { ResponseMessage } from '@/common/decorator/response-message.decorator';
import { SprintService } from '@/project/service/sprint.service';
import { SprintDetailsRequest } from '@/project/dto/sprint-details-request.dto';
import { SprintDetailsRequest } from '@/project/dto/sprint/sprint-details-request.dto';
import { LabelService } from '@/project/service/label.service';
import { LabelDetailsRequest } from '@/project/dto/label-details-request.dto';
import { LabelDetailsRequest } from '@/project/dto/label/label-details-request.dto';
import { ResponseStatus } from '@/common/decorator/response-status.decorator';

@UseGuards(AccessTokenGuard)
Expand All @@ -37,26 +37,26 @@ export class ProjectController {

@Get('invitations')
@ResponseMessage('프로젝트 멤버 초대 목록 조회에 성공했습니다.')
async getInvitations(@AuthUser() user: Account) {
getInvitations(@AuthUser() user: Account) {
return this.projectService.getInvitations(user.id);
}

@Get(':id')
@ResponseMessage('프로젝트 상세 조회에 성공했습니다.')
async getProject(@AuthUser() user: Account, @Param('id') projectId: number) {
getProject(@AuthUser() user: Account, @Param('id') projectId: number) {
return this.projectService.getProject(user.id, projectId);
}

@Get(':id/members')
@ResponseMessage('프로젝트 멤버 목록 조회에 성공했습니다.')
async getMembers(@AuthUser() user: Account, @Param('id') projectId: number) {
getMembers(@AuthUser() user: Account, @Param('id') projectId: number) {
return this.projectService.getContributors(user.id, projectId);
}

@Post()
@ResponseStatus(201)
@ResponseMessage('프로젝트 생성이 성공했습니다.')
async create(@AuthUser() user: Account, @Body() body: CreateProjectRequest) {
create(@AuthUser() user: Account, @Body() body: CreateProjectRequest) {
return this.projectService.create(user.id, body.title);
}

Expand All @@ -68,10 +68,6 @@ export class ProjectController {
@Body() body: InviteUserRequest
) {
await this.projectService.invite(user.id, projectId, body.username);
return {
message: 'Successfully invite user',
success: true,
};
}

@Patch(':id/invite')
Expand All @@ -82,10 +78,6 @@ export class ProjectController {
@Body() body: UpdateContributorRequest
) {
await this.projectService.updateInvitation(user.id, projectId, body.contributorId, body.status);
return {
message: 'Successfully update invitation',
success: true,
};
}

@Post(':id/update')
Expand Down Expand Up @@ -119,7 +111,7 @@ export class ProjectController {

@Post(':id/sprint')
@ResponseMessage('스프린트 생성 완료했습니다.')
async createSprint(
createSprint(
@AuthUser() user: Account,
@Param('id') id: number,
@Body() body: SprintDetailsRequest
Expand All @@ -137,7 +129,7 @@ export class ProjectController {
@Post(':id/label')
@ResponseStatus(201)
@ResponseMessage('라벨 생성 완료했습니다.')
async createLabel(
createLabel(
@AuthUser() user: Account,
@Param('id') id: number,
@Body() body: LabelDetailsRequest
Expand All @@ -148,25 +140,25 @@ export class ProjectController {

@Get(':id/labels')
@ResponseMessage('라벨 목록 조회에 성공했습니다.')
async getLabels(@AuthUser() user: Account, @Param('id') id: number) {
getLabels(@AuthUser() user: Account, @Param('id') id: number) {
return this.labelService.getAll(user.id, id);
}

@Get(':id/workload')
@ResponseMessage('프로젝트 워크로드 조회에 성공했습니다.')
async getWorkload(@AuthUser() user: Account, @Param('id') id: number) {
getWorkload(@AuthUser() user: Account, @Param('id') id: number) {
return this.taskService.getWorkload(user.id, id);
}

@Get(':id/overview')
@ResponseMessage('프로젝트 오버뷰 조회에 성공했습니다.')
async getOverview(@AuthUser() user: Account, @Param('id') id: number) {
getOverview(@AuthUser() user: Account, @Param('id') id: number) {
return this.taskService.getOverview(user.id, id);
}

@Get(':id/priority')
@ResponseMessage('프로젝트 우선순위 통계 조회에 성공했습니다.')
async getPriority(@AuthUser() user: Account, @Param('id') id: number) {
getPriority(@AuthUser() user: Account, @Param('id') id: number) {
return this.taskService.getPriority(user.id, id);
}
}
2 changes: 1 addition & 1 deletion apps/server/src/project/controller/projects.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class ProjectsController {

@Get()
@ResponseMessage('프로젝트 목록 조회에 성공했습니다.')
async getProjects(@AuthUser() user: Account) {
getProjects(@AuthUser() user: Account) {
return this.projectService.getUserProjects(user.id);
}
}
10 changes: 3 additions & 7 deletions apps/server/src/project/controller/sprint.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { AccessTokenGuard } from '@/account/guard/accessToken.guard';
import { SprintService } from '@/project/service/sprint.service';
import { AuthUser } from '@/account/decorator/authUser.decorator';
import { Account } from '@/account/entity/account.entity';
import { SprintDetailsRequest } from '@/project/dto/sprint-details-request.dto';
import { SprintDetailsRequest } from '@/project/dto/sprint/sprint-details-request.dto';
import { ResponseMessage } from '@/common/decorator/response-message.decorator';

@UseGuards(AccessTokenGuard)
Expand All @@ -13,18 +13,14 @@ export class SprintController {

@Patch(':id')
@ResponseMessage('스프린트 상세 정보 수정 완료했습니다.')
async update(
@AuthUser() user: Account,
@Param('id') id: number,
@Body() body: SprintDetailsRequest
) {
update(@AuthUser() user: Account, @Param('id') id: number, @Body() body: SprintDetailsRequest) {
body.validateDuration();
return this.sprintService.update(user.id, id, body.name, body.startDate, body.endDate);
}

@Delete(':id')
@ResponseMessage('스프린트 삭제 완료했습니다.')
async delete(@AuthUser() user: Account, @Param('id') id: number) {
delete(@AuthUser() user: Account, @Param('id') id: number) {
return this.sprintService.delete(user.id, id);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { Body, Controller, Delete, Param, Patch, UseGuards } from '@nestjs/commo
import { AuthUser } from '@/account/decorator/authUser.decorator';
import { Account } from '@/account/entity/account.entity';
import { AccessTokenGuard } from '@/account/guard/accessToken.guard';
import { SubTaskService } from '@/task/service/subTask.service';
import { UpdateSubTaskRequest } from '@/task/dto/update-subTask-request.dto';
import { SubTaskService } from '@/project/service/subTask.service';
import { UpdateSubTaskRequest } from '@/project/dto/subtask/update-subTask-request.dto';
import { ResponseMessage } from '@/common/decorator/response-message.decorator';

@UseGuards(AccessTokenGuard)
Expand All @@ -13,7 +13,7 @@ export class SubTaskController {

@Patch(':id')
@ResponseMessage('서브 태스크 수정 완료했습니다.')
async update(
update(
@AuthUser() user: Account,
@Param('id') subTaskId: number,
@Body() body: UpdateSubTaskRequest
Expand All @@ -23,7 +23,7 @@ export class SubTaskController {

@Delete(':id')
@ResponseMessage('서브 태스크 삭제 완료했습니다.')
async delete(@AuthUser() user: Account, @Param('id') subTaskId: number) {
delete(@AuthUser() user: Account, @Param('id') subTaskId: number) {
return this.subTaskService.delete(user.id, subTaskId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ import {
Query,
UseGuards,
} from '@nestjs/common';
import { TaskService } from '@/task/service/task.service';
import { TaskService } from '@/project/service/task.service';
import { AuthUser } from '@/account/decorator/authUser.decorator';
import { Account } from '@/account/entity/account.entity';
import { AccessTokenGuard } from '@/account/guard/accessToken.guard';
import { ResponseMessage } from '@/common/decorator/response-message.decorator';
import { UpdateTaskDetailsRequest } from '@/task/dto/update-task-details-request.dto';
import { SubTaskService } from '@/task/service/subTask.service';
import { CreateSubTaskRequest } from '@/task/dto/create-subTask-request.dto';
import { UpdateLabelsRequest } from '@/task/dto/update-labels-request.dto';
import { UpdateAssigneesRequest } from '@/task/dto/update-assignees-request.dto';
import { UpdateTaskDetailsRequest } from '@/project/dto/task/update-task-details-request.dto';
import { SubTaskService } from '@/project/service/subTask.service';
import { CreateSubTaskRequest } from '@/project/dto/subtask/create-subTask-request.dto';
import { UpdateLabelsRequest } from '@/project/dto/label/update-labels-request.dto';
import { UpdateAssigneesRequest } from '@/project/dto/assignee/update-assignees-request.dto';
import { ResponseStatus } from '@/common/decorator/response-status.decorator';

@UseGuards(AccessTokenGuard)
Expand All @@ -32,25 +32,25 @@ export class TaskController {

@Get()
@ResponseMessage('태스크 목록이 정상적으로 조회되었습니다.')
async getAll(@AuthUser() user: Account, @Query('projectId') projectId: number) {
getAll(@AuthUser() user: Account, @Query('projectId') projectId: number) {
return this.taskService.getAll(user.id, projectId);
}

@Get(':id')
@ResponseMessage('태스크가 정상적으로 조회되었습니다.')
async get(@AuthUser() user: Account, @Param('id') id: number) {
get(@AuthUser() user: Account, @Param('id') id: number) {
return this.taskService.get(user.id, id);
}

@Get(':id/detail')
@ResponseMessage('태스크 상세 정보 조회 완료했습니다.')
async getTaskDetail(@AuthUser() user: Account, @Param('id') id: number) {
getTaskDetail(@AuthUser() user: Account, @Param('id') id: number) {
return this.taskService.getTaskDetail(user.id, id);
}

@Patch(':id')
@ResponseMessage('태스크 상세 정보 수정 완료했습니다.')
async updateDetails(
updateDetails(
@AuthUser() user: Account,
@Param('id') id: number,
@Body() body: UpdateTaskDetailsRequest
Expand All @@ -61,17 +61,13 @@ export class TaskController {
@Post(':id/subtask')
@ResponseStatus(201)
@ResponseMessage('서브 태스크 생성 완료했습니다.')
async create(
@AuthUser() user: Account,
@Param('id') id: number,
@Body() body: CreateSubTaskRequest
) {
create(@AuthUser() user: Account, @Param('id') id: number, @Body() body: CreateSubTaskRequest) {
return this.subTaskService.create(user.id, id, body.content, body.completed);
}

@Put(':id/labels')
@ResponseMessage('태스크 라벨 수정 완료했습니다.')
async updateLabels(
updateLabels(
@AuthUser() user: Account,
@Param('id') id: number,
@Body() body: UpdateLabelsRequest
Expand All @@ -81,7 +77,7 @@ export class TaskController {

@Put(':id/assignees')
@ResponseMessage('태스크 담당자 수정 완료했습니다.')
async updateAssignees(
updateAssignees(
@AuthUser() user: Account,
@Param('id') id: number,
@Body() body: UpdateAssigneesRequest
Expand All @@ -91,7 +87,7 @@ export class TaskController {

@Delete(':id')
@ResponseMessage('태스크 삭제 완료했습니다.')
async delete(@AuthUser() user: Account, @Param('id') id: number) {
delete(@AuthUser() user: Account, @Param('id') id: number) {
return this.taskService.deleteWithoutEvent(user.id, id);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SubTask } from '@/task/domain/subTask.entity';
import { SubTaskStatus } from '@/task/enum/subTaskStatus.enum';
import { SubTask } from '@/project/entity/subTask.entity';
import { SubTaskStatus } from '@/project/enum/subTaskStatus.enum';

export class CreateSubTaskResponse {
constructor(subTask: SubTask) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Task } from '@/task/domain/task.entity';
import { Task } from '@/project/entity/task.entity';

export class CreateTaskResponse {
constructor(task: Task) {
Expand Down
Loading

0 comments on commit 7fffddb

Please sign in to comment.