Last active
May 24, 2021 15:51
-
-
Save Romakita/77c2eeaedd0ede85fded9112288016bb to your computer and use it in GitHub Desktop.
Prisma - Ts.ED UserModel
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
import { User } from "@prisma/client"; | |
import { Integer, Required, Property, Groups, Format, Email, Description, Allow, Enum, CollectionOf } from "@tsed/schema"; | |
import { Role, PostModel } from "@tsedio/prisma"; | |
export class UserModel implements User { | |
@Property(Number) | |
@Integer() | |
@Required() | |
@Groups("!creation") | |
id: number; | |
@Property(Date) | |
@Format("date-time") | |
@Required() | |
createdAt: Date; | |
@Property(String) | |
@Required() | |
@Email() | |
@Description("User email. This email must be unique!") | |
email: string; | |
@Property(Number) | |
@Allow(null) | |
weight: number | null; | |
// etc.... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment