mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-30 12:55:02 +00:00
add type inference
This commit is contained in:
parent
30ea9a6488
commit
1bd3ac4266
4 changed files with 21 additions and 2 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import { bigint, bigserial, date, integer, pgTable, text } from "drizzle-orm/pg-core";
|
||||
import { element } from "./element";
|
||||
import { aspectType } from "./aspect_type";
|
||||
import { InferInsertModel, InferSelectModel } from "drizzle-orm";
|
||||
|
||||
export const aspectCondition = pgTable("aspect_condition", {
|
||||
id: bigserial("id", { mode: "bigint" }).primaryKey(),
|
||||
|
|
@ -18,3 +19,10 @@ export const aspectCondition = pgTable("aspect_condition", {
|
|||
renewalYear: integer("renewal_year"),
|
||||
comments: text("comments"),
|
||||
});
|
||||
|
||||
export type AspectConditionRow =
|
||||
InferSelectModel<typeof aspectCondition>;
|
||||
|
||||
export type NewAspectConditionRow =
|
||||
InferInsertModel<typeof aspectCondition>;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { bigint, bigserial, integer, pgTable } from "drizzle-orm/pg-core";
|
||||
import { propertyConditionSurvey } from "./property_condition_survey";
|
||||
import { elementType } from "./element_type";
|
||||
import { InferInsertModel, InferSelectModel } from "drizzle-orm";
|
||||
|
||||
export const element = pgTable("element", {
|
||||
id: bigserial("id", { mode: "bigint" }).primaryKey(),
|
||||
|
|
@ -12,3 +13,7 @@ export const element = pgTable("element", {
|
|||
elementType: elementType("element_type").notNull(),
|
||||
elementInstance: integer("element_instance").notNull(),
|
||||
});
|
||||
|
||||
export type ElementRow = InferSelectModel<typeof element>;
|
||||
export type NewElementRow = InferInsertModel<typeof element>;
|
||||
|
||||
|
|
|
|||
|
|
@ -203,4 +203,4 @@ export const elementType = pgEnum("element_type", [
|
|||
"hhsrs_amenities",
|
||||
]);
|
||||
|
||||
export type Element = typeof elementType.enumValues[number];
|
||||
export type ElementType = typeof elementType.enumValues[number];
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import { InferInsertModel, InferSelectModel } from "drizzle-orm";
|
||||
import {
|
||||
pgTable,
|
||||
bigserial,
|
||||
bigint,
|
||||
date,
|
||||
text,
|
||||
integer,
|
||||
} from "drizzle-orm/pg-core";
|
||||
|
||||
export const propertyConditionSurvey = pgTable("property_condition_survey", {
|
||||
|
|
@ -15,3 +15,9 @@ export const propertyConditionSurvey = pgTable("property_condition_survey", {
|
|||
date: date("date").notNull(),
|
||||
source: text("source").notNull(),
|
||||
});
|
||||
|
||||
export type PropertyConditionSurveyRow =
|
||||
InferSelectModel<typeof propertyConditionSurvey>;
|
||||
|
||||
export type NewPropertyConditionSurveyRow =
|
||||
InferInsertModel<typeof propertyConditionSurvey>;
|
||||
Loading…
Add table
Reference in a new issue