Skip to content

Commit

Permalink
Merge pull request #30 from LifePoop/feat/auth
Browse files Browse the repository at this point in the history
sex, birth optional
  • Loading branch information
Yaminyam authored Dec 13, 2023
2 parents bf4a559 + 437e616 commit fc1e298
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
8 changes: 4 additions & 4 deletions libs/entity/user/user.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@ export class User {
@Column({ length: 20 })
nickname!: string;

@ApiProperty()
@ApiProperty({ nullable: true })
@IsDate()
@Column()
birth!: Date;
birth?: Date;

@ApiProperty({ enum: SexEnum })
@ApiProperty({ enum: SexEnum, nullable: true })
@IsEnum(SexEnum)
@Column({
type: 'enum',
enum: SexEnum,
})
sex!: SexEnum;
sex?: SexEnum;

@ApiProperty()
@Column({ nullable: true })
Expand Down
16 changes: 10 additions & 6 deletions src/auth/dto/register.dto.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import { User } from '@app/entity/user/user.entity';
import { ApiProperty, PickType } from '@nestjs/swagger';
import {
ApiProperty,
IntersectionType,
PartialType,
PickType,
} from '@nestjs/swagger';
import { IsString } from 'class-validator';

export class RegisterRequestParamDto extends PickType(User, ['provider']) {}

export class RegisterRequestBodyDto extends PickType(User, [
'nickname',
'birth',
'sex',
]) {
export class RegisterRequestBodyDto extends IntersectionType(
PickType(User, ['nickname']),
PartialType(PickType(User, ['birth', 'sex'])),
) {
@ApiProperty()
@IsString()
oAuthAccessToken: string;
Expand Down

0 comments on commit fc1e298

Please sign in to comment.