-
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.
feat(laws): law 상세 조회 시 저장(북마크) 여부 데이터 전송
- Loading branch information
Showing
8 changed files
with
264 additions
and
7 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
src/apis/auth/security/guards/only-get-access-token-value.guard.ts
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,18 @@ | ||
import { Observable } from 'rxjs'; | ||
import { ExecutionContext, Injectable, CanActivate } from '@nestjs/common'; | ||
import { AuthGuard } from '@nestjs/passport'; | ||
|
||
@Injectable() | ||
export class OnlyGetAccessTokenValueGuard extends AuthGuard('jwt-access') implements CanActivate { | ||
canActivate(context: ExecutionContext): boolean | Promise<boolean> | Observable<boolean> { | ||
return super.canActivate(context); | ||
} | ||
|
||
// Override the handleRequest method to not throw an error | ||
handleRequest(err, user, info) { | ||
if (err || info || !user) { | ||
return {}; | ||
} | ||
return user; | ||
} | ||
} |
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,41 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { PrecDetailData } from 'src/common/types'; | ||
import * as v from 'class-validator'; | ||
|
||
export class ResponsePrecDto implements PrecDetailData { | ||
@ApiProperty() | ||
@v.IsNumber() | ||
판례정보일련번호: number; | ||
|
||
@ApiProperty() | ||
@v.IsString() | ||
사건번호: string; | ||
|
||
@ApiProperty() | ||
@v.IsString() | ||
사건종류명: string; | ||
|
||
@ApiProperty() | ||
@v.IsString() | ||
판결유형: string; | ||
|
||
@ApiProperty() | ||
@v.IsString() | ||
선고: string; | ||
|
||
@ApiProperty() | ||
@v.IsString() | ||
법원명: string; | ||
|
||
@ApiProperty() | ||
@v.IsString() | ||
선고일자: string; | ||
|
||
@ApiProperty() | ||
@v.IsString() | ||
사건명: string; | ||
|
||
@ApiProperty() | ||
@v.IsString() | ||
판례내용: 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
import { | ||
StatuteDetailData, | ||
StatuteArticle, | ||
StatuteAddendum, | ||
StatuteParagraph, | ||
StatuteSubparagraph, | ||
Statuteitem, | ||
} from 'src/common/types'; | ||
import { ApiExtraModels, ApiProperty, ApiPropertyOptional, getSchemaPath } from '@nestjs/swagger'; | ||
import * as v from 'class-validator'; | ||
|
||
export class StatuteItemDTO implements Statuteitem { | ||
@ApiProperty() | ||
@v.IsString() | ||
목번호: string; | ||
|
||
@ApiProperty() | ||
@v.IsString() | ||
목내용: string; | ||
} | ||
|
||
export class StatuteSubparagraphDTO implements StatuteSubparagraph { | ||
@ApiProperty() | ||
@v.IsString() | ||
호번호: string; | ||
|
||
@ApiProperty() | ||
@v.IsString() | ||
호내용: string; | ||
|
||
@ApiPropertyOptional({ type: [StatuteItemDTO] }) | ||
@v.IsOptional() | ||
목?: StatuteItemDTO | StatuteItemDTO[]; | ||
} | ||
|
||
export class StatuteParagraphDTO implements StatuteParagraph { | ||
@ApiProperty() | ||
항번호: string; | ||
|
||
@ApiProperty() | ||
항내용: string; | ||
|
||
@ApiPropertyOptional({ type: [StatuteSubparagraphDTO] }) | ||
호?: StatuteSubparagraphDTO | StatuteSubparagraphDTO[]; | ||
} | ||
|
||
export class StatuteArticleDTO implements StatuteArticle { | ||
@ApiProperty() | ||
조문키: string; | ||
|
||
@ApiProperty() | ||
조문번호: number; | ||
|
||
@ApiProperty() | ||
조문여부: string; | ||
|
||
@ApiPropertyOptional() | ||
조문제목?: string; | ||
|
||
@ApiProperty() | ||
조문시행일자: number; | ||
|
||
@ApiProperty() | ||
조문내용: string; | ||
|
||
@ApiPropertyOptional({ type: [StatuteParagraphDTO] }) | ||
항?: StatuteParagraphDTO | StatuteParagraphDTO[]; | ||
|
||
@ApiPropertyOptional({ type: [String] }) | ||
조문참고자료?: string | string[]; | ||
} | ||
|
||
export class StatuteAddendumDTO implements StatuteAddendum { | ||
@ApiProperty() | ||
부칙키: string; | ||
|
||
@ApiProperty() | ||
부칙공포일자: number; | ||
|
||
@ApiProperty() | ||
부칙공포번호: number; | ||
|
||
@ApiProperty({ type: [String] }) | ||
부칙내용: string[]; | ||
} | ||
|
||
@ApiExtraModels(StatuteAddendumDTO, StatuteArticleDTO) | ||
export class ResponseStatuteDto implements StatuteDetailData { | ||
@ApiProperty({ | ||
properties: { | ||
법령ID: { | ||
type: 'number', | ||
}, | ||
법령명: { | ||
type: 'string', | ||
}, | ||
시행일자: { | ||
type: 'number', | ||
}, | ||
}, | ||
}) | ||
기본정보: { | ||
법령ID: number; | ||
법령명: string; | ||
시행일자: number; | ||
}; | ||
|
||
@ApiProperty({ | ||
oneOf: [ | ||
{ | ||
$ref: getSchemaPath(StatuteArticleDTO), | ||
}, | ||
{ | ||
type: 'array', | ||
items: { | ||
$ref: getSchemaPath(StatuteArticleDTO), | ||
}, | ||
}, | ||
], | ||
}) | ||
조문: { | ||
조문단위: StatuteArticleDTO | StatuteArticleDTO[]; | ||
}; | ||
|
||
@ApiProperty({ | ||
oneOf: [ | ||
{ | ||
$ref: getSchemaPath(StatuteAddendumDTO), | ||
}, | ||
{ | ||
type: 'array', | ||
items: { | ||
$ref: getSchemaPath(StatuteAddendumDTO), | ||
}, | ||
}, | ||
], | ||
}) | ||
부칙: { | ||
부칙단위: StatuteAddendumDTO | StatuteAddendumDTO[]; | ||
}; | ||
} |
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