lasseklovstad / gata

0 stars 0 forks source link

bug: Report type kan være enum #139

Open lasseklovstad opened 3 months ago

lasseklovstad commented 3 months ago
const reportTypeEnum = pgEnum("type", ["DOCUMENT", "NEWS"]);

export const gataReport = pgTable("gata_report", {
   id: uuid("id").primaryKey().notNull(),
   content: text("content"),
   createdDate: timestamp("created_date", { mode: "string" }),
   description: varchar("description", { length: 255 }),
   lastModifiedBy: varchar("last_modified_by", { length: 255 }),
   lastModifiedDate: timestamp("last_modified_date", { mode: "string" }),
   title: varchar("title", { length: 255 }).notNull(),
   type: reportTypeEnum("type").notNull(),
   createdBy: uuid("created_by").references(() => user.id),
});

da kan jeg fjerne mapping: { ...result, type: ReportType[result.type] };