-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
티켓모듈 중간배포
- Loading branch information
Showing
41 changed files
with
1,289 additions
and
184 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -11,4 +11,4 @@ services: | |
ports: | ||
- '5432:5432' | ||
env_file: | ||
- .env.local | ||
- .env |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,19 @@ | ||
import { ApiProperty, PartialType, PickType } from '@nestjs/swagger'; | ||
import { Expose } from 'class-transformer'; | ||
import { Ticket } from 'src/database/entities/ticket.entity'; | ||
import { UserProfileDto } from './user-profile.dto'; | ||
|
||
export class CreateTicketDto extends PickType(PartialType(Ticket), [ | ||
'date', | ||
'order', | ||
'user', | ||
'createdAt', | ||
'updatedAt' | ||
] as const) { | ||
// @ApiProperty({ | ||
// description: '주문한 유저에 대한 정보입니다.', | ||
// type: () => UserProfileDto | ||
// }) | ||
// @Expose() | ||
// user: UserProfileDto; | ||
} |
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,6 @@ | ||
import { PageOptionsDto } from './page-options.dto'; | ||
|
||
export interface PageMetaDtoParameters { | ||
pageOptionsDto: PageOptionsDto; | ||
itemCount: number; | ||
} |
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,38 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { Expose } from 'class-transformer'; | ||
import { PageMetaDtoParameters } from './page-meta-dto.interface'; | ||
|
||
export class PageMetaDto { | ||
@ApiProperty() | ||
@Expose() | ||
readonly page: number; | ||
|
||
@ApiProperty() | ||
@Expose() | ||
readonly take: number; | ||
|
||
@ApiProperty() | ||
@Expose() | ||
readonly itemCount: number; | ||
|
||
@ApiProperty() | ||
@Expose() | ||
readonly pageCount: number; | ||
|
||
@ApiProperty() | ||
@Expose() | ||
readonly hasPreviousPage: boolean; | ||
|
||
@ApiProperty() | ||
@Expose() | ||
readonly hasNextPage: boolean; | ||
|
||
constructor({ pageOptionsDto, itemCount }: PageMetaDtoParameters) { | ||
this.page = pageOptionsDto.page; | ||
this.take = pageOptionsDto.take; | ||
this.itemCount = itemCount; | ||
this.pageCount = Math.ceil(this.itemCount / this.take); | ||
this.hasPreviousPage = this.page > 1; | ||
this.hasNextPage = this.page < this.pageCount; | ||
} | ||
} |
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,40 @@ | ||
import { ApiPropertyOptional } from '@nestjs/swagger'; | ||
import { Expose, Type } from 'class-transformer'; | ||
import { IsEnum, IsInt, IsOptional, Max, Min } from 'class-validator'; | ||
import { PageOrder } from 'src/common/consts/enum'; | ||
|
||
export class PageOptionsDto { | ||
@ApiPropertyOptional({ enum: PageOrder, default: PageOrder.ASC }) | ||
@IsEnum(PageOrder) | ||
@IsOptional() | ||
@Expose() | ||
readonly order: PageOrder = PageOrder.ASC; | ||
|
||
@ApiPropertyOptional({ | ||
minimum: 1, | ||
default: 1 | ||
}) | ||
@Type(() => Number) | ||
@IsInt() | ||
@Min(1) | ||
@IsOptional() | ||
@Expose() | ||
readonly page: number = 1; | ||
|
||
@ApiPropertyOptional({ | ||
minimum: 1, | ||
maximum: 50, | ||
default: 10 | ||
}) | ||
@Type(() => Number) | ||
@IsInt() | ||
@Min(1) | ||
@Max(50) | ||
@IsOptional() | ||
@Expose() | ||
readonly take: number = 10; | ||
|
||
get skip(): number { | ||
return (this.page - 1) * this.take; | ||
} | ||
} |
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,21 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { Expose, Type } from 'class-transformer'; | ||
import { IsArray } from 'class-validator'; | ||
import { PageMetaDto } from './page-meta.dto'; | ||
|
||
export class PageDto<T> { | ||
@IsArray() | ||
@ApiProperty({ isArray: true }) | ||
@Expose() | ||
readonly data: T[]; | ||
|
||
@ApiProperty({ type: () => PageMetaDto }) | ||
@Type(() => PageMetaDto) | ||
@Expose() | ||
readonly meta: PageMetaDto; | ||
|
||
constructor(data: T[], meta: PageMetaDto) { | ||
this.data = data; | ||
this.meta = meta; | ||
} | ||
} |
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 { ApiProperty } from '@nestjs/swagger'; | ||
import { Expose } from 'class-transformer'; | ||
import { IsEnum, IsOptional } from 'class-validator'; | ||
import { PerformanceDate, TicketStatus } from '../consts/enum'; | ||
|
||
export class TicketFindDto { | ||
@ApiProperty({ | ||
description: '티켓 상태', | ||
enum: TicketStatus, | ||
required: false | ||
}) | ||
@IsEnum(TicketStatus) | ||
@IsOptional() | ||
@Expose() | ||
readonly status: TicketStatus; | ||
|
||
@ApiProperty({ | ||
description: '공연 날짜', | ||
enum: PerformanceDate, | ||
required: false | ||
}) | ||
@IsEnum(PerformanceDate) | ||
@IsOptional() | ||
@Expose() | ||
readonly date: PerformanceDate; | ||
} |
Oops, something went wrong.