reafactored data mart and added better job monitor
This commit is contained in:
28
backend/db/schema/auditLog.schema.ts
Normal file
28
backend/db/schema/auditLog.schema.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import {
|
||||
integer,
|
||||
jsonb,
|
||||
pgTable,
|
||||
text,
|
||||
timestamp,
|
||||
uuid,
|
||||
} from "drizzle-orm/pg-core";
|
||||
import { createInsertSchema, createSelectSchema } from "drizzle-zod";
|
||||
import type { z } from "zod";
|
||||
|
||||
export const jobAuditLog = pgTable("job_audit_log", {
|
||||
id: uuid("id").defaultRandom().primaryKey(),
|
||||
jobName: text("job_name"),
|
||||
startedAt: timestamp("start_at"),
|
||||
finishedAt: timestamp("finished_at"),
|
||||
durationMs: integer("duration_ms"),
|
||||
status: text("status"), //success | error
|
||||
errorMessage: text("error_message"),
|
||||
errorStack: text("error_stack"),
|
||||
metadata: jsonb("meta_data"),
|
||||
});
|
||||
|
||||
export const jobAuditLogSchema = createSelectSchema(jobAuditLog);
|
||||
export const newJobAuditLogSchema = createInsertSchema(jobAuditLog);
|
||||
|
||||
export type JobAuditLog = z.infer<typeof jobAuditLogSchema>;
|
||||
export type NewJobAuditLog = z.infer<typeof newJobAuditLogSchema>;
|
||||
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
boolean,
|
||||
jsonb,
|
||||
pgEnum,
|
||||
pgTable,
|
||||
text,
|
||||
timestamp,
|
||||
@@ -11,6 +12,12 @@ import { createInsertSchema, createSelectSchema } from "drizzle-zod";
|
||||
|
||||
import { z } from "zod";
|
||||
|
||||
export const settingType = pgEnum("setting_type", [
|
||||
"feature",
|
||||
"system",
|
||||
"standard",
|
||||
]);
|
||||
|
||||
export const settings = pgTable(
|
||||
"settings",
|
||||
{
|
||||
@@ -21,6 +28,7 @@ export const settings = pgTable(
|
||||
moduleName: text("moduleName"), // what part of lst dose it belong to this is used to split the settings out later
|
||||
active: boolean("active").default(true),
|
||||
roles: jsonb("roles").notNull().default(["systemAdmin"]), // role or roles to see this goes along with the moduleName, need to have a x role in module to see this setting.
|
||||
settingType: settingType(),
|
||||
add_User: text("add_User").default("LST_System").notNull(),
|
||||
add_Date: timestamp("add_Date").defaultNow(),
|
||||
upd_user: text("upd_User").default("LST_System").notNull(),
|
||||
|
||||
Reference in New Issue
Block a user