Skip to content

Class generation fails for Int type with @default(1) #76

@anthonysette

Description

@anthonysette

When you run the generator for a table with a column of type Int and @default(1) the class is set with a default of new Date('1');. Hoping to take a look at this some time soon and maybe open a PR, but for now just wanted to raise the issue.

For example the following table

model Test {
  count          Int      @default(1) @map("count")
}

produces the following class

import { ApiProperty } from '@nestjs/swagger';

export class Test {
  @ApiProperty({ type: Number })
  count: number = new Date('1');
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions