Dokumentenvorlagen im Ausgangsbeleg-Editor ergänzen
All checks were successful
Build and Push Docker Images / build-frontend (push) Successful in 1m22s
Build and Push Docker Images / build-website (push) Successful in 23s
Build and Push Docker Images / build-central-services-api (push) Successful in 22s
Build and Push Docker Images / build-backend (push) Successful in 43s
Build and Push Docker Images / build-central-services-admin (push) Successful in 21s
Build and Push Docker Images / build-docs (push) Successful in 21s
All checks were successful
Build and Push Docker Images / build-frontend (push) Successful in 1m22s
Build and Push Docker Images / build-website (push) Successful in 23s
Build and Push Docker Images / build-central-services-api (push) Successful in 22s
Build and Push Docker Images / build-backend (push) Successful in 43s
Build and Push Docker Images / build-central-services-admin (push) Successful in 21s
Build and Push Docker Images / build-docs (push) Successful in 21s
This commit is contained in:
16
backend/db/migrations/0065_document_templates.sql
Normal file
16
backend/db/migrations/0065_document_templates.sql
Normal file
@@ -0,0 +1,16 @@
|
||||
CREATE TABLE IF NOT EXISTS "documenttemplates" (
|
||||
"id" bigint GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
||||
"created_at" timestamptz NOT NULL DEFAULT now(),
|
||||
"tenant" bigint NOT NULL REFERENCES "tenants"("id"),
|
||||
"name" text NOT NULL,
|
||||
"document_type" text NOT NULL,
|
||||
"template_data" jsonb NOT NULL DEFAULT '{}'::jsonb,
|
||||
"default" boolean NOT NULL DEFAULT false,
|
||||
"archived" boolean NOT NULL DEFAULT false,
|
||||
"updated_at" timestamptz,
|
||||
"updated_by" uuid REFERENCES "auth_users"("id"),
|
||||
"created_by" uuid REFERENCES "auth_users"("id")
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS "documenttemplates_tenant_type_idx"
|
||||
ON "documenttemplates" ("tenant", "document_type");
|
||||
39
backend/db/schema/documenttemplates.ts
Normal file
39
backend/db/schema/documenttemplates.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import {
|
||||
pgTable,
|
||||
bigint,
|
||||
text,
|
||||
timestamp,
|
||||
boolean,
|
||||
jsonb,
|
||||
uuid,
|
||||
} from "drizzle-orm/pg-core"
|
||||
|
||||
import { tenants } from "./tenants"
|
||||
import { authUsers } from "./auth_users"
|
||||
|
||||
export const documenttemplates = pgTable("documenttemplates", {
|
||||
id: bigint("id", { mode: "number" })
|
||||
.primaryKey()
|
||||
.generatedByDefaultAsIdentity(),
|
||||
|
||||
createdAt: timestamp("created_at", { withTimezone: true })
|
||||
.notNull()
|
||||
.defaultNow(),
|
||||
|
||||
tenant: bigint("tenant", { mode: "number" })
|
||||
.notNull()
|
||||
.references(() => tenants.id),
|
||||
|
||||
name: text("name").notNull(),
|
||||
documentType: text("document_type").notNull(),
|
||||
templateData: jsonb("template_data").notNull().default({}),
|
||||
default: boolean("default").notNull().default(false),
|
||||
archived: boolean("archived").notNull().default(false),
|
||||
|
||||
updatedAt: timestamp("updated_at", { withTimezone: true }),
|
||||
updatedBy: uuid("updated_by").references(() => authUsers.id),
|
||||
createdBy: uuid("created_by").references(() => authUsers.id),
|
||||
})
|
||||
|
||||
export type DocumentTemplate = typeof documenttemplates.$inferSelect
|
||||
export type NewDocumentTemplate = typeof documenttemplates.$inferInsert
|
||||
@@ -22,6 +22,7 @@ export * from "./contracttypes"
|
||||
export * from "./costcentres"
|
||||
export * from "./countrys"
|
||||
export * from "./createddocuments"
|
||||
export * from "./documenttemplates"
|
||||
export * from "./createdletters"
|
||||
export * from "./customers"
|
||||
export * from "./customerspaces"
|
||||
|
||||
Reference in New Issue
Block a user