diff --git a/.gitignore b/.gitignore index 69b670aa..3dca77e8 100644 --- a/.gitignore +++ b/.gitignore @@ -48,4 +48,4 @@ lerna-debug.log* !.vscode/tasks.json !.vscode/launch.json !.vscode/extensions.json -backend/db.sqlite +apps/backend/db.sqlite diff --git a/apps/backend/src/edge/dtos/createEdge.dto.ts b/apps/backend/src/edge/dtos/createEdge.dto.ts index a62254b6..c60cd810 100644 --- a/apps/backend/src/edge/dtos/createEdge.dto.ts +++ b/apps/backend/src/edge/dtos/createEdge.dto.ts @@ -1,8 +1,5 @@ import { ApiProperty } from '@nestjs/swagger'; -import { IsString, IsNumber, IsIn } from 'class-validator'; -// import { Direction } from '../edge.entity'; - -const Direction = ['N', 'S', 'E', 'W']; +import { IsNumber } from 'class-validator'; export class CreateEdgeDto { @IsNumber() @@ -12,26 +9,10 @@ export class CreateEdgeDto { }) fromNode: number; - @IsString() - @IsIn(Direction) - @ApiProperty({ - example: 'N', - description: '출발 노드 지점 방향 (N, S, E, W 중 하나)', - }) - fromPoint: string; - @IsNumber() @ApiProperty({ example: 1, description: '도착 노드의 ID', }) toNode: number; - - @IsString() - @IsIn(Direction) - @ApiProperty({ - example: 'N', - description: '도착 노드 지점 방향 (N, S, E, W 중 하나)', - }) - toPoint: string; } diff --git a/apps/backend/src/edge/dtos/findEdgesResponse.dto.ts b/apps/backend/src/edge/dtos/findEdgesResponse.dto.ts index 8edfc234..dca101bf 100644 --- a/apps/backend/src/edge/dtos/findEdgesResponse.dto.ts +++ b/apps/backend/src/edge/dtos/findEdgesResponse.dto.ts @@ -15,9 +15,7 @@ export class FindEdgesResponseDto { { id: 1, fromNode: 2, - fromPoint: 'N', toNode: 7, - toPoint: 'W', }, ], description: '모든 Edge 배열', diff --git a/apps/backend/src/edge/edge.entity.ts b/apps/backend/src/edge/edge.entity.ts index 6214b81c..d5049f91 100644 --- a/apps/backend/src/edge/edge.entity.ts +++ b/apps/backend/src/edge/edge.entity.ts @@ -8,14 +8,6 @@ import { } from 'typeorm'; import { Node } from '../node/node.entity'; -// TODO: frontend, backend가 공유하는 shared에 direction.enum.ts로 분리 -// export enum Direction { -// NORTH = 'N', -// SOUTH = 'S', -// EAST = 'E', -// WEST = 'W', -// } - @Entity() export class Edge { @PrimaryGeneratedColumn('increment') @@ -29,12 +21,6 @@ export class Edge { @JoinColumn({ name: 'to_node_id' }) toNode: Node; - @Column() - fromPoint: string; - - @Column() - toPoint: string; - @Column({ nullable: true }) type: string; diff --git a/apps/backend/src/edge/edge.service.ts b/apps/backend/src/edge/edge.service.ts index 245c76cc..f0a0d426 100644 --- a/apps/backend/src/edge/edge.service.ts +++ b/apps/backend/src/edge/edge.service.ts @@ -13,7 +13,7 @@ export class EdgeService { ) {} async createEdge(dto: CreateEdgeDto): Promise { - const { fromNode, fromPoint, toNode, toPoint } = dto; + const { fromNode, toNode } = dto; // 출발 노드를 조회한다. const existingFromNode = await this.nodeRepository.findOneBy({ @@ -25,9 +25,7 @@ export class EdgeService { // 엣지를 생성한다. return await this.edgeRepository.save({ fromNode: existingFromNode, - fromPoint, toNode: existingToNode, - toPoint, }); } @@ -50,11 +48,9 @@ export class EdgeService { fromNode: { id: true, }, - fromPoint: true, toNode: { id: true, }, - toPoint: true, }, }); // 엣지가 없으면 NotFound 에러