chore(payload): register ticket schema and migration
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
parent
ad34854ce8
commit
b4bb328acd
6 changed files with 21041 additions and 2 deletions
20521
src/migrations/20260901_213108_add_ticket_votes_and_edit_history.json
Normal file
20521
src/migrations/20260901_213108_add_ticket_votes_and_edit_history.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,50 @@
|
|||
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
|
||||
|
||||
export async function up({ db }: MigrateUpArgs): Promise<void> {
|
||||
await db.execute(sql`
|
||||
CREATE TABLE "tickets_edit_history" (
|
||||
"_order" integer NOT NULL,
|
||||
"_parent_id" integer NOT NULL,
|
||||
"id" varchar PRIMARY KEY NOT NULL,
|
||||
"before" jsonb NOT NULL,
|
||||
"after" jsonb NOT NULL,
|
||||
"edited_by_id" integer NOT NULL,
|
||||
"edited_at" timestamp(3) with time zone NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE "ticket_votes" (
|
||||
"id" serial PRIMARY KEY NOT NULL,
|
||||
"ticket_id" integer NOT NULL,
|
||||
"user_id" integer NOT NULL,
|
||||
"updated_at" timestamp(3) with time zone DEFAULT now() NOT NULL,
|
||||
"created_at" timestamp(3) with time zone DEFAULT now() NOT NULL
|
||||
);
|
||||
|
||||
ALTER TABLE "payload_locked_documents_rels" ADD COLUMN "ticket_votes_id" integer;
|
||||
ALTER TABLE "tickets_edit_history" ADD CONSTRAINT "tickets_edit_history_edited_by_id_users_id_fk" FOREIGN KEY ("edited_by_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;
|
||||
ALTER TABLE "tickets_edit_history" ADD CONSTRAINT "tickets_edit_history_parent_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "public"."tickets"("id") ON DELETE cascade ON UPDATE no action;
|
||||
ALTER TABLE "ticket_votes" ADD CONSTRAINT "ticket_votes_ticket_id_tickets_id_fk" FOREIGN KEY ("ticket_id") REFERENCES "public"."tickets"("id") ON DELETE set null ON UPDATE no action;
|
||||
ALTER TABLE "ticket_votes" ADD CONSTRAINT "ticket_votes_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;
|
||||
CREATE INDEX "tickets_edit_history_order_idx" ON "tickets_edit_history" USING btree ("_order");
|
||||
CREATE INDEX "tickets_edit_history_parent_id_idx" ON "tickets_edit_history" USING btree ("_parent_id");
|
||||
CREATE INDEX "tickets_edit_history_edited_by_idx" ON "tickets_edit_history" USING btree ("edited_by_id");
|
||||
CREATE INDEX "ticket_votes_ticket_idx" ON "ticket_votes" USING btree ("ticket_id");
|
||||
CREATE INDEX "ticket_votes_user_idx" ON "ticket_votes" USING btree ("user_id");
|
||||
CREATE INDEX "ticket_votes_updated_at_idx" ON "ticket_votes" USING btree ("updated_at");
|
||||
CREATE INDEX "ticket_votes_created_at_idx" ON "ticket_votes" USING btree ("created_at");
|
||||
CREATE UNIQUE INDEX "ticket_user_idx" ON "ticket_votes" USING btree ("ticket_id","user_id");
|
||||
ALTER TABLE "payload_locked_documents_rels" ADD CONSTRAINT "payload_locked_documents_rels_ticket_votes_fk" FOREIGN KEY ("ticket_votes_id") REFERENCES "public"."ticket_votes"("id") ON DELETE cascade ON UPDATE no action;
|
||||
CREATE INDEX "payload_locked_documents_rels_ticket_votes_id_idx" ON "payload_locked_documents_rels" USING btree ("ticket_votes_id");`)
|
||||
}
|
||||
|
||||
export async function down({ db }: MigrateDownArgs): Promise<void> {
|
||||
await db.execute(sql`
|
||||
ALTER TABLE "tickets_edit_history" DISABLE ROW LEVEL SECURITY;
|
||||
ALTER TABLE "ticket_votes" DISABLE ROW LEVEL SECURITY;
|
||||
DROP TABLE "tickets_edit_history" CASCADE;
|
||||
DROP TABLE "ticket_votes" CASCADE;
|
||||
ALTER TABLE "payload_locked_documents_rels" DROP CONSTRAINT "payload_locked_documents_rels_ticket_votes_fk";
|
||||
|
||||
DROP INDEX "payload_locked_documents_rels_ticket_votes_id_idx";
|
||||
ALTER TABLE "payload_locked_documents_rels" DROP COLUMN "ticket_votes_id";`)
|
||||
}
|
||||
|
|
@ -12,6 +12,7 @@ import * as migration_20260828_044506 from './20260828_044506';
|
|||
import * as migration_20260831_142503 from './20260831_142503';
|
||||
import * as migration_20260831_180233_assignment_transfers from './20260831_180233_assignment_transfers';
|
||||
import * as migration_20260901_014006_add_assignment_transfer_event_target from './20260901_014006_add_assignment_transfer_event_target';
|
||||
import * as migration_20260901_213108_add_ticket_votes_and_edit_history from './20260901_213108_add_ticket_votes_and_edit_history';
|
||||
|
||||
export const migrations = [
|
||||
{
|
||||
|
|
@ -82,6 +83,11 @@ export const migrations = [
|
|||
{
|
||||
up: migration_20260901_014006_add_assignment_transfer_event_target.up,
|
||||
down: migration_20260901_014006_add_assignment_transfer_event_target.down,
|
||||
name: '20260901_014006_add_assignment_transfer_event_target'
|
||||
name: '20260901_014006_add_assignment_transfer_event_target',
|
||||
},
|
||||
{
|
||||
up: migration_20260901_213108_add_ticket_votes_and_edit_history.up,
|
||||
down: migration_20260901_213108_add_ticket_votes_and_edit_history.down,
|
||||
name: '20260901_213108_add_ticket_votes_and_edit_history'
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ export const enum_game_event_logs_target_collection = pgEnum(
|
|||
"evaluations",
|
||||
"tickets",
|
||||
"game-servers",
|
||||
"assignment-transfers",
|
||||
],
|
||||
);
|
||||
export const enum_users_roles = pgEnum("enum_users_roles", [
|
||||
|
|
@ -295,13 +296,41 @@ export const enum_roles_permissions = pgEnum("enum_roles_permissions", [
|
|||
"discord:staff",
|
||||
"discord:announce",
|
||||
]);
|
||||
export const enum_awards_grant_config_allowed_grantor_assignment_types = pgEnum(
|
||||
"enum_awards_grant_config_allowed_grantor_assignment_types",
|
||||
["division", "squad", "team", "special"],
|
||||
);
|
||||
export const enum_awards_type = pgEnum("enum_awards_type", ["commendation", "ribbon", "medal"]);
|
||||
export const enum_awards_grant_config_recipient_scope = pgEnum(
|
||||
"enum_awards_grant_config_recipient_scope",
|
||||
["same_command", "whitelist", "anyone"],
|
||||
);
|
||||
export const enum_assignments_type = pgEnum("enum_assignments_type", [
|
||||
"division",
|
||||
"squad",
|
||||
"team",
|
||||
"special",
|
||||
]);
|
||||
export const enum_assignment_transfers_status = pgEnum("enum_assignment_transfers_status", [
|
||||
"pending",
|
||||
"rejected",
|
||||
"awaiting_superuser",
|
||||
"completed",
|
||||
"cancelled",
|
||||
"denied",
|
||||
]);
|
||||
export const enum_assignment_transfers_escalation_reason = pgEnum(
|
||||
"enum_assignment_transfers_escalation_reason",
|
||||
["no_leaders", "appeal", "leader_changed"],
|
||||
);
|
||||
export const enum_assignment_transfers_from_leader_decision = pgEnum(
|
||||
"enum_assignment_transfers_from_leader_decision",
|
||||
["pending", "approved", "rejected", "not_required"],
|
||||
);
|
||||
export const enum_assignment_transfers_to_leader_decision = pgEnum(
|
||||
"enum_assignment_transfers_to_leader_decision",
|
||||
["pending", "approved", "rejected", "not_required"],
|
||||
);
|
||||
export const enum_evaluations_kind = pgEnum("enum_evaluations_kind", [
|
||||
"leader-direct",
|
||||
"leader-indirect",
|
||||
|
|
@ -360,6 +389,10 @@ export const enum_campaigns_status = pgEnum("enum_campaigns_status", [
|
|||
"inProgress",
|
||||
"completed",
|
||||
]);
|
||||
export const enum_campaigns_campaign_mode = pgEnum("enum_campaigns_campaign_mode", [
|
||||
"official",
|
||||
"custom",
|
||||
]);
|
||||
export const enum_factions_type = pgEnum("enum_factions_type", [
|
||||
"playerFaction",
|
||||
"majorFaction",
|
||||
|
|
@ -1074,6 +1107,9 @@ export const users = pgTable(
|
|||
preferences_display_xpDisplayMini: boolean("preferences_display_xp_display_mini").default(
|
||||
false,
|
||||
),
|
||||
preferences_display_showBackgroundTexture: boolean(
|
||||
"preferences_display_show_background_texture",
|
||||
).default(true),
|
||||
preferences_discord_enabled: boolean("preferences_discord_enabled").default(false),
|
||||
updatedAt: timestamp("updated_at", { mode: "string", withTimezone: true, precision: 3 })
|
||||
.defaultNow()
|
||||
|
|
@ -1400,6 +1436,25 @@ export const profiles_rels = pgTable(
|
|||
],
|
||||
);
|
||||
|
||||
export const awards_grant_config_allowed_grantor_assignment_types = pgTable(
|
||||
"awards_grant_config_allowed_grantor_assignment_types",
|
||||
{
|
||||
order: integer("order").notNull(),
|
||||
parent: integer("parent_id").notNull(),
|
||||
value: enum_awards_grant_config_allowed_grantor_assignment_types("value"),
|
||||
id: serial("id").primaryKey(),
|
||||
},
|
||||
(columns) => [
|
||||
index("awards_grant_config_allowed_grantor_assignment_types_order_idx").on(columns.order),
|
||||
index("awards_grant_config_allowed_grantor_assignment_types_parent_idx").on(columns.parent),
|
||||
foreignKey({
|
||||
columns: [columns["parent"]],
|
||||
foreignColumns: [awards.id],
|
||||
name: "awards_grant_config_allowed_grantor_assignment_types_parent_fk",
|
||||
}).onDelete("cascade"),
|
||||
],
|
||||
);
|
||||
|
||||
export const awards = pgTable(
|
||||
"awards",
|
||||
{
|
||||
|
|
@ -1407,12 +1462,19 @@ export const awards = pgTable(
|
|||
name: varchar("name").notNull(),
|
||||
description: jsonb("description").notNull(),
|
||||
type: enum_awards_type("type").default("commendation"),
|
||||
commendationColor: varchar("commendation_color").default("#92400e"),
|
||||
image: integer("image_id").references(() => media.id, {
|
||||
onDelete: "set null",
|
||||
}),
|
||||
experiencePoints: numeric("experience_points", { mode: "number" }),
|
||||
ribbonDesign: jsonb("ribbon_design"),
|
||||
medalDesign: jsonb("medal_design"),
|
||||
grantConfig_maxGrantsPerGrantor: numeric("grant_config_max_grants_per_grantor", {
|
||||
mode: "number",
|
||||
}),
|
||||
grantConfig_recipientScope: enum_awards_grant_config_recipient_scope(
|
||||
"grant_config_recipient_scope",
|
||||
).default("same_command"),
|
||||
updatedAt: timestamp("updated_at", { mode: "string", withTimezone: true, precision: 3 })
|
||||
.defaultNow()
|
||||
.notNull(),
|
||||
|
|
@ -1428,6 +1490,33 @@ export const awards = pgTable(
|
|||
],
|
||||
);
|
||||
|
||||
export const awards_rels = pgTable(
|
||||
"awards_rels",
|
||||
{
|
||||
id: serial("id").primaryKey(),
|
||||
order: integer("order"),
|
||||
parent: integer("parent_id").notNull(),
|
||||
path: varchar("path").notNull(),
|
||||
assignmentsID: integer("assignments_id"),
|
||||
},
|
||||
(columns) => [
|
||||
index("awards_rels_order_idx").on(columns.order),
|
||||
index("awards_rels_parent_idx").on(columns.parent),
|
||||
index("awards_rels_path_idx").on(columns.path),
|
||||
index("awards_rels_assignments_id_idx").on(columns.assignmentsID),
|
||||
foreignKey({
|
||||
columns: [columns["parent"]],
|
||||
foreignColumns: [awards.id],
|
||||
name: "awards_rels_parent_fk",
|
||||
}).onDelete("cascade"),
|
||||
foreignKey({
|
||||
columns: [columns["assignmentsID"]],
|
||||
foreignColumns: [assignments.id],
|
||||
name: "awards_rels_assignments_fk",
|
||||
}).onDelete("cascade"),
|
||||
],
|
||||
);
|
||||
|
||||
export const qualifications = pgTable(
|
||||
"qualifications",
|
||||
{
|
||||
|
|
@ -1506,6 +1595,98 @@ export const assignments_rels = pgTable(
|
|||
],
|
||||
);
|
||||
|
||||
export const assignment_transfers = pgTable(
|
||||
"assignment_transfers",
|
||||
{
|
||||
id: serial("id").primaryKey(),
|
||||
requester: integer("requester_id")
|
||||
.notNull()
|
||||
.references(() => users.id, {
|
||||
onDelete: "set null",
|
||||
}),
|
||||
fromAssignment: integer("from_assignment_id")
|
||||
.notNull()
|
||||
.references(() => assignments.id, {
|
||||
onDelete: "set null",
|
||||
}),
|
||||
toAssignment: integer("to_assignment_id")
|
||||
.notNull()
|
||||
.references(() => assignments.id, {
|
||||
onDelete: "set null",
|
||||
}),
|
||||
status: enum_assignment_transfers_status("status").notNull().default("pending"),
|
||||
escalationReason: enum_assignment_transfers_escalation_reason("escalation_reason"),
|
||||
fromLeaderDecision: enum_assignment_transfers_from_leader_decision("from_leader_decision")
|
||||
.notNull()
|
||||
.default("pending"),
|
||||
toLeaderDecision: enum_assignment_transfers_to_leader_decision("to_leader_decision")
|
||||
.notNull()
|
||||
.default("pending"),
|
||||
fromDecisionBy: integer("from_decision_by_id").references(() => users.id, {
|
||||
onDelete: "set null",
|
||||
}),
|
||||
toDecisionBy: integer("to_decision_by_id").references(() => users.id, {
|
||||
onDelete: "set null",
|
||||
}),
|
||||
fromDecidedAt: timestamp("from_decided_at", {
|
||||
mode: "string",
|
||||
withTimezone: true,
|
||||
precision: 3,
|
||||
}),
|
||||
toDecidedAt: timestamp("to_decided_at", { mode: "string", withTimezone: true, precision: 3 }),
|
||||
fromLeaderSnapshot: integer("from_leader_snapshot_id").references(() => users.id, {
|
||||
onDelete: "set null",
|
||||
}),
|
||||
toLeaderSnapshot: integer("to_leader_snapshot_id").references(() => users.id, {
|
||||
onDelete: "set null",
|
||||
}),
|
||||
rejectionReason: varchar("rejection_reason"),
|
||||
requestNote: varchar("request_note"),
|
||||
appealNote: varchar("appeal_note"),
|
||||
resolvedBy: integer("resolved_by_id").references(() => users.id, {
|
||||
onDelete: "set null",
|
||||
}),
|
||||
resolutionNote: varchar("resolution_note"),
|
||||
resolvedAt: timestamp("resolved_at", { mode: "string", withTimezone: true, precision: 3 }),
|
||||
discordFromLeaderMessageId: varchar("discord_from_leader_message_id"),
|
||||
discordToLeaderMessageId: varchar("discord_to_leader_message_id"),
|
||||
discordRequesterMessageId: varchar("discord_requester_message_id"),
|
||||
sourceNotifiedToUserId: integer("source_notified_to_user_id_id").references(() => users.id, {
|
||||
onDelete: "set null",
|
||||
}),
|
||||
destinationNotifiedToUserId: integer("destination_notified_to_user_id_id").references(
|
||||
() => users.id,
|
||||
{
|
||||
onDelete: "set null",
|
||||
},
|
||||
),
|
||||
discordDeliveredKeys: jsonb("discord_delivered_keys").default(sql`'[]'::jsonb`),
|
||||
updatedAt: timestamp("updated_at", { mode: "string", withTimezone: true, precision: 3 })
|
||||
.defaultNow()
|
||||
.notNull(),
|
||||
createdAt: timestamp("created_at", { mode: "string", withTimezone: true, precision: 3 })
|
||||
.defaultNow()
|
||||
.notNull(),
|
||||
},
|
||||
(columns) => [
|
||||
index("assignment_transfers_requester_idx").on(columns.requester),
|
||||
index("assignment_transfers_from_assignment_idx").on(columns.fromAssignment),
|
||||
index("assignment_transfers_to_assignment_idx").on(columns.toAssignment),
|
||||
index("assignment_transfers_status_idx").on(columns.status),
|
||||
index("assignment_transfers_from_decision_by_idx").on(columns.fromDecisionBy),
|
||||
index("assignment_transfers_to_decision_by_idx").on(columns.toDecisionBy),
|
||||
index("assignment_transfers_from_leader_snapshot_idx").on(columns.fromLeaderSnapshot),
|
||||
index("assignment_transfers_to_leader_snapshot_idx").on(columns.toLeaderSnapshot),
|
||||
index("assignment_transfers_resolved_by_idx").on(columns.resolvedBy),
|
||||
index("assignment_transfers_source_notified_to_user_id_idx").on(columns.sourceNotifiedToUserId),
|
||||
index("assignment_transfers_destination_notified_to_user_id_idx").on(
|
||||
columns.destinationNotifiedToUserId,
|
||||
),
|
||||
index("assignment_transfers_updated_at_idx").on(columns.updatedAt),
|
||||
index("assignment_transfers_created_at_idx").on(columns.createdAt),
|
||||
],
|
||||
);
|
||||
|
||||
export const experience = pgTable(
|
||||
"experience",
|
||||
{
|
||||
|
|
@ -1952,6 +2133,7 @@ export const campaigns = pgTable(
|
|||
name: varchar("name").notNull(),
|
||||
summary: varchar("summary").notNull().default("An Arma 3 campaign."),
|
||||
status: enum_campaigns_status("status").notNull().default("concept"),
|
||||
campaignMode: enum_campaigns_campaign_mode("campaign_mode").notNull().default("custom"),
|
||||
description: jsonb("description"),
|
||||
startDate: timestamp("start_date", { mode: "string", withTimezone: true, precision: 3 }),
|
||||
endDate: timestamp("end_date", { mode: "string", withTimezone: true, precision: 3 }),
|
||||
|
|
@ -3409,6 +3591,37 @@ export const tickets_activity = pgTable(
|
|||
],
|
||||
);
|
||||
|
||||
export const tickets_edit_history = pgTable(
|
||||
"tickets_edit_history",
|
||||
{
|
||||
_order: integer("_order").notNull(),
|
||||
_parentID: integer("_parent_id").notNull(),
|
||||
id: varchar("id").primaryKey(),
|
||||
before: jsonb("before").notNull(),
|
||||
after: jsonb("after").notNull(),
|
||||
editedBy: integer("edited_by_id")
|
||||
.notNull()
|
||||
.references(() => users.id, {
|
||||
onDelete: "set null",
|
||||
}),
|
||||
editedAt: timestamp("edited_at", {
|
||||
mode: "string",
|
||||
withTimezone: true,
|
||||
precision: 3,
|
||||
}).notNull(),
|
||||
},
|
||||
(columns) => [
|
||||
index("tickets_edit_history_order_idx").on(columns._order),
|
||||
index("tickets_edit_history_parent_id_idx").on(columns._parentID),
|
||||
index("tickets_edit_history_edited_by_idx").on(columns.editedBy),
|
||||
foreignKey({
|
||||
columns: [columns["_parentID"]],
|
||||
foreignColumns: [tickets.id],
|
||||
name: "tickets_edit_history_parent_id_fk",
|
||||
}).onDelete("cascade"),
|
||||
],
|
||||
);
|
||||
|
||||
export const tickets = pgTable(
|
||||
"tickets",
|
||||
{
|
||||
|
|
@ -3494,6 +3707,36 @@ export const tickets_rels = pgTable(
|
|||
],
|
||||
);
|
||||
|
||||
export const ticket_votes = pgTable(
|
||||
"ticket_votes",
|
||||
{
|
||||
id: serial("id").primaryKey(),
|
||||
ticket: integer("ticket_id")
|
||||
.notNull()
|
||||
.references(() => tickets.id, {
|
||||
onDelete: "set null",
|
||||
}),
|
||||
user: integer("user_id")
|
||||
.notNull()
|
||||
.references(() => users.id, {
|
||||
onDelete: "set null",
|
||||
}),
|
||||
updatedAt: timestamp("updated_at", { mode: "string", withTimezone: true, precision: 3 })
|
||||
.defaultNow()
|
||||
.notNull(),
|
||||
createdAt: timestamp("created_at", { mode: "string", withTimezone: true, precision: 3 })
|
||||
.defaultNow()
|
||||
.notNull(),
|
||||
},
|
||||
(columns) => [
|
||||
index("ticket_votes_ticket_idx").on(columns.ticket),
|
||||
index("ticket_votes_user_idx").on(columns.user),
|
||||
index("ticket_votes_updated_at_idx").on(columns.updatedAt),
|
||||
index("ticket_votes_created_at_idx").on(columns.createdAt),
|
||||
uniqueIndex("ticket_user_idx").on(columns.ticket, columns.user),
|
||||
],
|
||||
);
|
||||
|
||||
export const projects = pgTable(
|
||||
"projects",
|
||||
{
|
||||
|
|
@ -3935,6 +4178,7 @@ export const payload_locked_documents_rels = pgTable(
|
|||
awardsID: integer("awards_id"),
|
||||
qualificationsID: integer("qualifications_id"),
|
||||
assignmentsID: integer("assignments_id"),
|
||||
"assignment-transfersID": integer("assignment_transfers_id"),
|
||||
experienceID: integer("experience_id"),
|
||||
"user-notificationsID": integer("user_notifications_id"),
|
||||
evaluationsID: integer("evaluations_id"),
|
||||
|
|
@ -3956,6 +4200,7 @@ export const payload_locked_documents_rels = pgTable(
|
|||
"market-listingsID": integer("market_listings_id"),
|
||||
"market-negotiationsID": integer("market_negotiations_id"),
|
||||
ticketsID: integer("tickets_id"),
|
||||
"ticket-votesID": integer("ticket_votes_id"),
|
||||
projectsID: integer("projects_id"),
|
||||
sprintsID: integer("sprints_id"),
|
||||
releasesID: integer("releases_id"),
|
||||
|
|
@ -3989,6 +4234,9 @@ export const payload_locked_documents_rels = pgTable(
|
|||
index("payload_locked_documents_rels_awards_id_idx").on(columns.awardsID),
|
||||
index("payload_locked_documents_rels_qualifications_id_idx").on(columns.qualificationsID),
|
||||
index("payload_locked_documents_rels_assignments_id_idx").on(columns.assignmentsID),
|
||||
index("payload_locked_documents_rels_assignment_transfers_id_idx").on(
|
||||
columns["assignment-transfersID"],
|
||||
),
|
||||
index("payload_locked_documents_rels_experience_id_idx").on(columns.experienceID),
|
||||
index("payload_locked_documents_rels_user_notifications_id_idx").on(
|
||||
columns["user-notificationsID"],
|
||||
|
|
@ -4018,6 +4266,7 @@ export const payload_locked_documents_rels = pgTable(
|
|||
columns["market-negotiationsID"],
|
||||
),
|
||||
index("payload_locked_documents_rels_tickets_id_idx").on(columns.ticketsID),
|
||||
index("payload_locked_documents_rels_ticket_votes_id_idx").on(columns["ticket-votesID"]),
|
||||
index("payload_locked_documents_rels_projects_id_idx").on(columns.projectsID),
|
||||
index("payload_locked_documents_rels_sprints_id_idx").on(columns.sprintsID),
|
||||
index("payload_locked_documents_rels_releases_id_idx").on(columns.releasesID),
|
||||
|
|
@ -4109,6 +4358,11 @@ export const payload_locked_documents_rels = pgTable(
|
|||
foreignColumns: [assignments.id],
|
||||
name: "payload_locked_documents_rels_assignments_fk",
|
||||
}).onDelete("cascade"),
|
||||
foreignKey({
|
||||
columns: [columns["assignment-transfersID"]],
|
||||
foreignColumns: [assignment_transfers.id],
|
||||
name: "payload_locked_documents_rels_assignment_transfers_fk",
|
||||
}).onDelete("cascade"),
|
||||
foreignKey({
|
||||
columns: [columns["experienceID"]],
|
||||
foreignColumns: [experience.id],
|
||||
|
|
@ -4214,6 +4468,11 @@ export const payload_locked_documents_rels = pgTable(
|
|||
foreignColumns: [tickets.id],
|
||||
name: "payload_locked_documents_rels_tickets_fk",
|
||||
}).onDelete("cascade"),
|
||||
foreignKey({
|
||||
columns: [columns["ticket-votesID"]],
|
||||
foreignColumns: [ticket_votes.id],
|
||||
name: "payload_locked_documents_rels_ticket_votes_fk",
|
||||
}).onDelete("cascade"),
|
||||
foreignKey({
|
||||
columns: [columns["projectsID"]],
|
||||
foreignColumns: [projects.id],
|
||||
|
|
@ -4792,12 +5051,43 @@ export const relations_profiles = relations(profiles, ({ one, many }) => ({
|
|||
relationName: "_rels",
|
||||
}),
|
||||
}));
|
||||
export const relations_awards = relations(awards, ({ one }) => ({
|
||||
export const relations_awards_grant_config_allowed_grantor_assignment_types = relations(
|
||||
awards_grant_config_allowed_grantor_assignment_types,
|
||||
({ one }) => ({
|
||||
parent: one(awards, {
|
||||
fields: [awards_grant_config_allowed_grantor_assignment_types.parent],
|
||||
references: [awards.id],
|
||||
relationName: "grantConfig_allowedGrantorAssignmentTypes",
|
||||
}),
|
||||
}),
|
||||
);
|
||||
export const relations_awards_rels = relations(awards_rels, ({ one }) => ({
|
||||
parent: one(awards, {
|
||||
fields: [awards_rels.parent],
|
||||
references: [awards.id],
|
||||
relationName: "_rels",
|
||||
}),
|
||||
assignmentsID: one(assignments, {
|
||||
fields: [awards_rels.assignmentsID],
|
||||
references: [assignments.id],
|
||||
relationName: "assignments",
|
||||
}),
|
||||
}));
|
||||
export const relations_awards = relations(awards, ({ one, many }) => ({
|
||||
image: one(media, {
|
||||
fields: [awards.image],
|
||||
references: [media.id],
|
||||
relationName: "image",
|
||||
}),
|
||||
grantConfig_allowedGrantorAssignmentTypes: many(
|
||||
awards_grant_config_allowed_grantor_assignment_types,
|
||||
{
|
||||
relationName: "grantConfig_allowedGrantorAssignmentTypes",
|
||||
},
|
||||
),
|
||||
_rels: many(awards_rels, {
|
||||
relationName: "_rels",
|
||||
}),
|
||||
}));
|
||||
export const relations_qualifications = relations(qualifications, () => ({}));
|
||||
export const relations_assignments_rels = relations(assignments_rels, ({ one }) => ({
|
||||
|
|
@ -4827,6 +5117,58 @@ export const relations_assignments = relations(assignments, ({ one, many }) => (
|
|||
relationName: "_rels",
|
||||
}),
|
||||
}));
|
||||
export const relations_assignment_transfers = relations(assignment_transfers, ({ one }) => ({
|
||||
requester: one(users, {
|
||||
fields: [assignment_transfers.requester],
|
||||
references: [users.id],
|
||||
relationName: "requester",
|
||||
}),
|
||||
fromAssignment: one(assignments, {
|
||||
fields: [assignment_transfers.fromAssignment],
|
||||
references: [assignments.id],
|
||||
relationName: "fromAssignment",
|
||||
}),
|
||||
toAssignment: one(assignments, {
|
||||
fields: [assignment_transfers.toAssignment],
|
||||
references: [assignments.id],
|
||||
relationName: "toAssignment",
|
||||
}),
|
||||
fromDecisionBy: one(users, {
|
||||
fields: [assignment_transfers.fromDecisionBy],
|
||||
references: [users.id],
|
||||
relationName: "fromDecisionBy",
|
||||
}),
|
||||
toDecisionBy: one(users, {
|
||||
fields: [assignment_transfers.toDecisionBy],
|
||||
references: [users.id],
|
||||
relationName: "toDecisionBy",
|
||||
}),
|
||||
fromLeaderSnapshot: one(users, {
|
||||
fields: [assignment_transfers.fromLeaderSnapshot],
|
||||
references: [users.id],
|
||||
relationName: "fromLeaderSnapshot",
|
||||
}),
|
||||
toLeaderSnapshot: one(users, {
|
||||
fields: [assignment_transfers.toLeaderSnapshot],
|
||||
references: [users.id],
|
||||
relationName: "toLeaderSnapshot",
|
||||
}),
|
||||
resolvedBy: one(users, {
|
||||
fields: [assignment_transfers.resolvedBy],
|
||||
references: [users.id],
|
||||
relationName: "resolvedBy",
|
||||
}),
|
||||
sourceNotifiedToUserId: one(users, {
|
||||
fields: [assignment_transfers.sourceNotifiedToUserId],
|
||||
references: [users.id],
|
||||
relationName: "sourceNotifiedToUserId",
|
||||
}),
|
||||
destinationNotifiedToUserId: one(users, {
|
||||
fields: [assignment_transfers.destinationNotifiedToUserId],
|
||||
references: [users.id],
|
||||
relationName: "destinationNotifiedToUserId",
|
||||
}),
|
||||
}));
|
||||
export const relations_experience = relations(experience, () => ({}));
|
||||
export const relations_user_notifications = relations(user_notifications, ({ one }) => ({
|
||||
user: one(users, {
|
||||
|
|
@ -5771,6 +6113,18 @@ export const relations_tickets_activity = relations(tickets_activity, ({ one })
|
|||
relationName: "author",
|
||||
}),
|
||||
}));
|
||||
export const relations_tickets_edit_history = relations(tickets_edit_history, ({ one }) => ({
|
||||
_parentID: one(tickets, {
|
||||
fields: [tickets_edit_history._parentID],
|
||||
references: [tickets.id],
|
||||
relationName: "editHistory",
|
||||
}),
|
||||
editedBy: one(users, {
|
||||
fields: [tickets_edit_history.editedBy],
|
||||
references: [users.id],
|
||||
relationName: "editedBy",
|
||||
}),
|
||||
}));
|
||||
export const relations_tickets_rels = relations(tickets_rels, ({ one }) => ({
|
||||
parent: one(tickets, {
|
||||
fields: [tickets_rels.parent],
|
||||
|
|
@ -5797,6 +6151,9 @@ export const relations_tickets = relations(tickets, ({ one, many }) => ({
|
|||
activity: many(tickets_activity, {
|
||||
relationName: "activity",
|
||||
}),
|
||||
editHistory: many(tickets_edit_history, {
|
||||
relationName: "editHistory",
|
||||
}),
|
||||
project: one(projects, {
|
||||
fields: [tickets.project],
|
||||
references: [projects.id],
|
||||
|
|
@ -5821,6 +6178,18 @@ export const relations_tickets = relations(tickets, ({ one, many }) => ({
|
|||
relationName: "_rels",
|
||||
}),
|
||||
}));
|
||||
export const relations_ticket_votes = relations(ticket_votes, ({ one }) => ({
|
||||
ticket: one(tickets, {
|
||||
fields: [ticket_votes.ticket],
|
||||
references: [tickets.id],
|
||||
relationName: "ticket",
|
||||
}),
|
||||
user: one(users, {
|
||||
fields: [ticket_votes.user],
|
||||
references: [users.id],
|
||||
relationName: "user",
|
||||
}),
|
||||
}));
|
||||
export const relations_projects = relations(projects, ({ one }) => ({
|
||||
lead: one(users, {
|
||||
fields: [projects.lead],
|
||||
|
|
@ -5986,6 +6355,11 @@ export const relations_payload_locked_documents_rels = relations(
|
|||
references: [assignments.id],
|
||||
relationName: "assignments",
|
||||
}),
|
||||
"assignment-transfersID": one(assignment_transfers, {
|
||||
fields: [payload_locked_documents_rels["assignment-transfersID"]],
|
||||
references: [assignment_transfers.id],
|
||||
relationName: "assignment-transfers",
|
||||
}),
|
||||
experienceID: one(experience, {
|
||||
fields: [payload_locked_documents_rels.experienceID],
|
||||
references: [experience.id],
|
||||
|
|
@ -6091,6 +6465,11 @@ export const relations_payload_locked_documents_rels = relations(
|
|||
references: [tickets.id],
|
||||
relationName: "tickets",
|
||||
}),
|
||||
"ticket-votesID": one(ticket_votes, {
|
||||
fields: [payload_locked_documents_rels["ticket-votesID"]],
|
||||
references: [ticket_votes.id],
|
||||
relationName: "ticket-votes",
|
||||
}),
|
||||
projectsID: one(projects, {
|
||||
fields: [payload_locked_documents_rels.projectsID],
|
||||
references: [projects.id],
|
||||
|
|
@ -6273,8 +6652,14 @@ type DatabaseSchema = {
|
|||
enum_users_preferences_discord_muted_types: typeof enum_users_preferences_discord_muted_types;
|
||||
enum_users_preferences_display_lead_or_actual: typeof enum_users_preferences_display_lead_or_actual;
|
||||
enum_roles_permissions: typeof enum_roles_permissions;
|
||||
enum_awards_grant_config_allowed_grantor_assignment_types: typeof enum_awards_grant_config_allowed_grantor_assignment_types;
|
||||
enum_awards_type: typeof enum_awards_type;
|
||||
enum_awards_grant_config_recipient_scope: typeof enum_awards_grant_config_recipient_scope;
|
||||
enum_assignments_type: typeof enum_assignments_type;
|
||||
enum_assignment_transfers_status: typeof enum_assignment_transfers_status;
|
||||
enum_assignment_transfers_escalation_reason: typeof enum_assignment_transfers_escalation_reason;
|
||||
enum_assignment_transfers_from_leader_decision: typeof enum_assignment_transfers_from_leader_decision;
|
||||
enum_assignment_transfers_to_leader_decision: typeof enum_assignment_transfers_to_leader_decision;
|
||||
enum_evaluations_kind: typeof enum_evaluations_kind;
|
||||
enum_evaluations_level: typeof enum_evaluations_level;
|
||||
enum_missions_factions_involved_threat_level: typeof enum_missions_factions_involved_threat_level;
|
||||
|
|
@ -6287,6 +6672,7 @@ type DatabaseSchema = {
|
|||
enum_missions_civilian_presence: typeof enum_missions_civilian_presence;
|
||||
enum_mission_attendances_response: typeof enum_mission_attendances_response;
|
||||
enum_campaigns_status: typeof enum_campaigns_status;
|
||||
enum_campaigns_campaign_mode: typeof enum_campaigns_campaign_mode;
|
||||
enum_factions_type: typeof enum_factions_type;
|
||||
enum_technologies_approval_status: typeof enum_technologies_approval_status;
|
||||
enum_technologies_type: typeof enum_technologies_type;
|
||||
|
|
@ -6359,10 +6745,13 @@ type DatabaseSchema = {
|
|||
profiles_progression_awards: typeof profiles_progression_awards;
|
||||
profiles: typeof profiles;
|
||||
profiles_rels: typeof profiles_rels;
|
||||
awards_grant_config_allowed_grantor_assignment_types: typeof awards_grant_config_allowed_grantor_assignment_types;
|
||||
awards: typeof awards;
|
||||
awards_rels: typeof awards_rels;
|
||||
qualifications: typeof qualifications;
|
||||
assignments: typeof assignments;
|
||||
assignments_rels: typeof assignments_rels;
|
||||
assignment_transfers: typeof assignment_transfers;
|
||||
experience: typeof experience;
|
||||
user_notifications: typeof user_notifications;
|
||||
evaluations: typeof evaluations;
|
||||
|
|
@ -6422,8 +6811,10 @@ type DatabaseSchema = {
|
|||
market_negotiations_history: typeof market_negotiations_history;
|
||||
market_negotiations: typeof market_negotiations;
|
||||
tickets_activity: typeof tickets_activity;
|
||||
tickets_edit_history: typeof tickets_edit_history;
|
||||
tickets: typeof tickets;
|
||||
tickets_rels: typeof tickets_rels;
|
||||
ticket_votes: typeof ticket_votes;
|
||||
projects: typeof projects;
|
||||
sprints: typeof sprints;
|
||||
releases: typeof releases;
|
||||
|
|
@ -6475,10 +6866,13 @@ type DatabaseSchema = {
|
|||
relations_profiles_progression_awards: typeof relations_profiles_progression_awards;
|
||||
relations_profiles_rels: typeof relations_profiles_rels;
|
||||
relations_profiles: typeof relations_profiles;
|
||||
relations_awards_grant_config_allowed_grantor_assignment_types: typeof relations_awards_grant_config_allowed_grantor_assignment_types;
|
||||
relations_awards_rels: typeof relations_awards_rels;
|
||||
relations_awards: typeof relations_awards;
|
||||
relations_qualifications: typeof relations_qualifications;
|
||||
relations_assignments_rels: typeof relations_assignments_rels;
|
||||
relations_assignments: typeof relations_assignments;
|
||||
relations_assignment_transfers: typeof relations_assignment_transfers;
|
||||
relations_experience: typeof relations_experience;
|
||||
relations_user_notifications: typeof relations_user_notifications;
|
||||
relations_evaluations: typeof relations_evaluations;
|
||||
|
|
@ -6538,8 +6932,10 @@ type DatabaseSchema = {
|
|||
relations_market_negotiations_history: typeof relations_market_negotiations_history;
|
||||
relations_market_negotiations: typeof relations_market_negotiations;
|
||||
relations_tickets_activity: typeof relations_tickets_activity;
|
||||
relations_tickets_edit_history: typeof relations_tickets_edit_history;
|
||||
relations_tickets_rels: typeof relations_tickets_rels;
|
||||
relations_tickets: typeof relations_tickets;
|
||||
relations_ticket_votes: typeof relations_ticket_votes;
|
||||
relations_projects: typeof relations_projects;
|
||||
relations_sprints: typeof relations_sprints;
|
||||
relations_releases: typeof relations_releases;
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ export interface Config {
|
|||
'market-listings': MarketListing;
|
||||
'market-negotiations': MarketNegotiation;
|
||||
tickets: Ticket;
|
||||
'ticket-votes': TicketVote;
|
||||
projects: Project;
|
||||
sprints: Sprint;
|
||||
releases: Release;
|
||||
|
|
@ -165,6 +166,7 @@ export interface Config {
|
|||
'market-listings': MarketListingsSelect<false> | MarketListingsSelect<true>;
|
||||
'market-negotiations': MarketNegotiationsSelect<false> | MarketNegotiationsSelect<true>;
|
||||
tickets: TicketsSelect<false> | TicketsSelect<true>;
|
||||
'ticket-votes': TicketVotesSelect<false> | TicketVotesSelect<true>;
|
||||
projects: ProjectsSelect<false> | ProjectsSelect<true>;
|
||||
sprints: SprintsSelect<false> | SprintsSelect<true>;
|
||||
releases: ReleasesSelect<false> | ReleasesSelect<true>;
|
||||
|
|
@ -2776,6 +2778,34 @@ export interface Ticket {
|
|||
id?: string | null;
|
||||
}[]
|
||||
| null;
|
||||
/**
|
||||
* Immutable before/after snapshots captured when the author edits a ticket.
|
||||
*/
|
||||
editHistory?:
|
||||
| {
|
||||
before:
|
||||
| {
|
||||
[k: string]: unknown;
|
||||
}
|
||||
| unknown[]
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| null;
|
||||
after:
|
||||
| {
|
||||
[k: string]: unknown;
|
||||
}
|
||||
| unknown[]
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| null;
|
||||
editedBy: number | User;
|
||||
editedAt: string;
|
||||
id?: string | null;
|
||||
}[]
|
||||
| null;
|
||||
/**
|
||||
* Set automatically when the ticket reaches a closing status.
|
||||
*/
|
||||
|
|
@ -2931,6 +2961,17 @@ export interface Label {
|
|||
updatedAt: string;
|
||||
createdAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "ticket-votes".
|
||||
*/
|
||||
export interface TicketVote {
|
||||
id: number;
|
||||
ticket: number | Ticket;
|
||||
user: number | User;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "narrative-events".
|
||||
|
|
@ -3282,6 +3323,10 @@ export interface PayloadLockedDocument {
|
|||
relationTo: 'tickets';
|
||||
value: number | Ticket;
|
||||
} | null)
|
||||
| ({
|
||||
relationTo: 'ticket-votes';
|
||||
value: number | TicketVote;
|
||||
} | null)
|
||||
| ({
|
||||
relationTo: 'projects';
|
||||
value: number | Project;
|
||||
|
|
@ -4504,6 +4549,15 @@ export interface TicketsSelect<T extends boolean = true> {
|
|||
created_at?: T;
|
||||
id?: T;
|
||||
};
|
||||
editHistory?:
|
||||
| T
|
||||
| {
|
||||
before?: T;
|
||||
after?: T;
|
||||
editedBy?: T;
|
||||
editedAt?: T;
|
||||
id?: T;
|
||||
};
|
||||
closedAt?: T;
|
||||
project?: T;
|
||||
sprint?: T;
|
||||
|
|
@ -4519,6 +4573,16 @@ export interface TicketsSelect<T extends boolean = true> {
|
|||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "ticket-votes_select".
|
||||
*/
|
||||
export interface TicketVotesSelect<T extends boolean = true> {
|
||||
ticket?: T;
|
||||
user?: T;
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "projects_select".
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ import { MarketNegotiations } from "@/collections/market/MarketNegotiations";
|
|||
import { UserNotifications } from "@/collections/users/UserNotifications";
|
||||
import { Evaluations } from "@/collections/users/Evaluations";
|
||||
import { Tickets } from "@/collections/tickets/Tickets";
|
||||
import { TicketVotes } from "@/collections/tickets/TicketVotes";
|
||||
import { Projects } from "@/collections/projects/Projects";
|
||||
import { Sprints } from "@/collections/projects/Sprints";
|
||||
import { Releases } from "@/collections/projects/Releases";
|
||||
|
|
@ -237,6 +238,7 @@ export default buildConfig({
|
|||
|
||||
// Helpdesk
|
||||
Tickets,
|
||||
TicketVotes,
|
||||
|
||||
// Projects
|
||||
Projects,
|
||||
|
|
|
|||
Loading…
Reference in a new issue