rizaldiariif
rizaldiariif
DTDrizzle Team
Created by rizaldiariif on 7/31/2023 in #help
Implementation of Drizzle and tsoa
right now here is my code, how do I give descriptions for the Model and each of the columns?
// src\api\auth\sub-api\user\model\entity\user.entity.ts
import { pgTable, serial, varchar, pgEnum } from "drizzle-orm/pg-core";
import { InferModel } from "drizzle-orm";

const statusEnum = pgEnum("status", ["Happy", "Sad"]);

const users = pgTable("users", {
id: serial("id").primaryKey(),
name: varchar("name", { length: 256 }),
email: varchar("email", { length: 256 }),
status: statusEnum("status"),
phone_number: varchar("phone_number", { length: 256 }),
});

/**
* User objects allow you to associate actions performed
* in the system with the user that performed them.
* The User object contains common information across
* every user in the system regardless of status and role.
*/
export type User = InferModel<typeof users>;
export type NewUser = InferModel<typeof users, "insert">;
export type SelectUser = InferModel<typeof users, "select">;
// src\api\auth\sub-api\user\model\entity\user.entity.ts
import { pgTable, serial, varchar, pgEnum } from "drizzle-orm/pg-core";
import { InferModel } from "drizzle-orm";

const statusEnum = pgEnum("status", ["Happy", "Sad"]);

const users = pgTable("users", {
id: serial("id").primaryKey(),
name: varchar("name", { length: 256 }),
email: varchar("email", { length: 256 }),
status: statusEnum("status"),
phone_number: varchar("phone_number", { length: 256 }),
});

/**
* User objects allow you to associate actions performed
* in the system with the user that performed them.
* The User object contains common information across
* every user in the system regardless of status and role.
*/
export type User = InferModel<typeof users>;
export type NewUser = InferModel<typeof users, "insert">;
export type SelectUser = InferModel<typeof users, "select">;
5 replies