Skip to content

Instantly share code, notes, and snippets.

@Romakita
Last active May 24, 2021 15:51
Show Gist options
  • Save Romakita/77c2eeaedd0ede85fded9112288016bb to your computer and use it in GitHub Desktop.
Save Romakita/77c2eeaedd0ede85fded9112288016bb to your computer and use it in GitHub Desktop.
Prisma - Ts.ED UserModel
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