-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* swagger 설정 * gitaction test * cancle 로직 구현(아직 완성x) * ✨ 삭제 api 구현 * ✨ Object id 예외 처리 Object id 에 맞지 않는 형식에 대한 decorator 제작 * ♻️ IsObjectId 데코레이터에 따른 dto 수정 * ♻️ Journey 관련 swagger 수정
- Loading branch information
Showing
11 changed files
with
168 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { | ||
registerDecorator, | ||
ValidationOptions, | ||
ValidationArguments, | ||
} from 'class-validator'; | ||
import { is1DArray, is2DArray } from '../util/coordinate.util'; | ||
import mongoose from 'mongoose'; | ||
|
||
export function IsObjectId(validationOptions?: ValidationOptions) { | ||
return function (object: Object, propertyName: string) { | ||
registerDecorator({ | ||
name: 'isObjectId', | ||
target: object.constructor, | ||
propertyName: propertyName, | ||
options: validationOptions, | ||
validator: { | ||
validate(receiveValue: string, args: ValidationArguments) { | ||
if (!mongoose.Types.ObjectId.isValid(receiveValue)) { | ||
return false; | ||
} | ||
return true; | ||
}, | ||
}, | ||
}); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { IsString, IsDateString } from 'class-validator'; | ||
import { UUID } from 'crypto'; | ||
export class DeleteJourneyReqDTO { | ||
@ApiProperty({ | ||
example: 'ab4068ef-95ed-40c3-be6d-3db35df866b9', | ||
description: '사용자 id', | ||
required: true, | ||
}) | ||
@IsString() | ||
readonly userId: UUID; | ||
|
||
@ApiProperty({ | ||
example: '6574c8adb08b3d712827385f', | ||
description: '여정 id', | ||
required: true, | ||
}) | ||
@IsString() | ||
readonly journeyId: string; | ||
} | ||
|
||
export class DeleteJourneyResDTO { | ||
@ApiProperty({ | ||
example: [37.555946, 126.972384], | ||
description: '위치 좌표', | ||
required: true, | ||
}) | ||
readonly coordinate: number[]; | ||
|
||
@ApiProperty({ | ||
example: '2023-11-22T12:00:00Z', | ||
description: 'timestamp', | ||
required: true, | ||
}) | ||
@IsDateString() | ||
readonly startTimestamp: string; | ||
|
||
@ApiProperty({ | ||
example: '656f4b55b11c27334d1fd347', | ||
description: '저장한 journey id', | ||
required: true, | ||
}) | ||
@IsString() | ||
readonly journeyId: string; | ||
|
||
// @ApiProperty({ | ||
// example: '[email protected]', | ||
// description: '이메일', | ||
// required: true, | ||
// }) | ||
// @IsString() | ||
// readonly email: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters