add type inference

This commit is contained in:
Daniel Roth 2026-01-27 17:28:05 +00:00
parent 30ea9a6488
commit 1bd3ac4266
4 changed files with 21 additions and 2 deletions

View file

@ -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>;

View file

@ -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>;

View file

@ -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];

View file

@ -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>;