style(scripts): format tick scripts, seed tools, and migrations
This commit is contained in:
parent
2acf52788f
commit
50f964cdf9
14 changed files with 67 additions and 97 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
|
import { MigrateDownArgs, MigrateUpArgs, sql } from "@payloadcms/db-postgres";
|
||||||
|
|
||||||
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
||||||
await db.execute(sql`
|
await db.execute(sql`
|
||||||
|
|
@ -980,7 +980,7 @@ export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
||||||
CREATE INDEX "payload_preferences_rels_users_id_idx" ON "payload_preferences_rels" USING btree ("users_id");
|
CREATE INDEX "payload_preferences_rels_users_id_idx" ON "payload_preferences_rels" USING btree ("users_id");
|
||||||
CREATE INDEX "payload_migrations_updated_at_idx" ON "payload_migrations" USING btree ("updated_at");
|
CREATE INDEX "payload_migrations_updated_at_idx" ON "payload_migrations" USING btree ("updated_at");
|
||||||
CREATE INDEX "payload_migrations_created_at_idx" ON "payload_migrations" USING btree ("created_at");
|
CREATE INDEX "payload_migrations_created_at_idx" ON "payload_migrations" USING btree ("created_at");
|
||||||
CREATE INDEX "game_rules_main_currency_idx" ON "game_rules" USING btree ("main_currency_id");`)
|
CREATE INDEX "game_rules_main_currency_idx" ON "game_rules" USING btree ("main_currency_id");`);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
||||||
|
|
@ -1069,5 +1069,5 @@ export async function down({ db, payload, req }: MigrateDownArgs): Promise<void>
|
||||||
DROP TYPE "public"."enum_vehicles_armor_rating";
|
DROP TYPE "public"."enum_vehicles_armor_rating";
|
||||||
DROP TYPE "public"."enum_structures_category";
|
DROP TYPE "public"."enum_structures_category";
|
||||||
DROP TYPE "public"."enum_structures_terrain_type";
|
DROP TYPE "public"."enum_structures_terrain_type";
|
||||||
DROP TYPE "public"."enum_structures_function_type";`)
|
DROP TYPE "public"."enum_structures_function_type";`);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
|
import { MigrateDownArgs, MigrateUpArgs, sql } from "@payloadcms/db-postgres";
|
||||||
|
|
||||||
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
||||||
await db.execute(sql`
|
await db.execute(sql`
|
||||||
ALTER TABLE "media" ALTER COLUMN "alt" DROP NOT NULL;`)
|
ALTER TABLE "media" ALTER COLUMN "alt" DROP NOT NULL;`);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
||||||
await db.execute(sql`
|
await db.execute(sql`
|
||||||
ALTER TABLE "media" ALTER COLUMN "alt" SET NOT NULL;`)
|
ALTER TABLE "media" ALTER COLUMN "alt" SET NOT NULL;`);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
|
import { MigrateDownArgs, MigrateUpArgs, sql } from "@payloadcms/db-postgres";
|
||||||
|
|
||||||
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
||||||
await db.execute(sql`
|
await db.execute(sql`
|
||||||
|
|
@ -43,7 +43,7 @@ export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
||||||
CREATE INDEX "game_structures_created_at_idx" ON "game_structures" USING btree ("created_at");
|
CREATE INDEX "game_structures_created_at_idx" ON "game_structures" USING btree ("created_at");
|
||||||
CREATE UNIQUE INDEX "payload_kv_key_idx" ON "payload_kv" USING btree ("key");
|
CREATE UNIQUE INDEX "payload_kv_key_idx" ON "payload_kv" USING btree ("key");
|
||||||
ALTER TABLE "payload_locked_documents_rels" ADD CONSTRAINT "payload_locked_documents_rels_game_structures_fk" FOREIGN KEY ("game_structures_id") REFERENCES "public"."game_structures"("id") ON DELETE cascade ON UPDATE no action;
|
ALTER TABLE "payload_locked_documents_rels" ADD CONSTRAINT "payload_locked_documents_rels_game_structures_fk" FOREIGN KEY ("game_structures_id") REFERENCES "public"."game_structures"("id") ON DELETE cascade ON UPDATE no action;
|
||||||
CREATE INDEX "payload_locked_documents_rels_game_structures_id_idx" ON "payload_locked_documents_rels" USING btree ("game_structures_id");`)
|
CREATE INDEX "payload_locked_documents_rels_game_structures_id_idx" ON "payload_locked_documents_rels" USING btree ("game_structures_id");`);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
||||||
|
|
@ -65,5 +65,5 @@ export async function down({ db, payload, req }: MigrateDownArgs): Promise<void>
|
||||||
ALTER TABLE "structures_auto_generated_resources" DROP COLUMN "min_frequency";
|
ALTER TABLE "structures_auto_generated_resources" DROP COLUMN "min_frequency";
|
||||||
ALTER TABLE "structures_auto_generated_resources" DROP COLUMN "max_frequency";
|
ALTER TABLE "structures_auto_generated_resources" DROP COLUMN "max_frequency";
|
||||||
ALTER TABLE "structures_auto_generated_resources" DROP COLUMN "produce_chance";
|
ALTER TABLE "structures_auto_generated_resources" DROP COLUMN "produce_chance";
|
||||||
ALTER TABLE "payload_locked_documents_rels" DROP COLUMN "game_structures_id";`)
|
ALTER TABLE "payload_locked_documents_rels" DROP COLUMN "game_structures_id";`);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
|
import { MigrateDownArgs, MigrateUpArgs, sql } from "@payloadcms/db-postgres";
|
||||||
|
|
||||||
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
||||||
await db.execute(sql`
|
await db.execute(sql`
|
||||||
|
|
@ -16,7 +16,7 @@ export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
||||||
CREATE INDEX "game_hard_resources_updated_at_idx" ON "game_hard_resources" USING btree ("updated_at");
|
CREATE INDEX "game_hard_resources_updated_at_idx" ON "game_hard_resources" USING btree ("updated_at");
|
||||||
CREATE INDEX "game_hard_resources_created_at_idx" ON "game_hard_resources" USING btree ("created_at");
|
CREATE INDEX "game_hard_resources_created_at_idx" ON "game_hard_resources" USING btree ("created_at");
|
||||||
ALTER TABLE "payload_locked_documents_rels" ADD CONSTRAINT "payload_locked_documents_rels_game_hard_resources_fk" FOREIGN KEY ("game_hard_resources_id") REFERENCES "public"."game_hard_resources"("id") ON DELETE cascade ON UPDATE no action;
|
ALTER TABLE "payload_locked_documents_rels" ADD CONSTRAINT "payload_locked_documents_rels_game_hard_resources_fk" FOREIGN KEY ("game_hard_resources_id") REFERENCES "public"."game_hard_resources"("id") ON DELETE cascade ON UPDATE no action;
|
||||||
CREATE INDEX "payload_locked_documents_rels_game_hard_resources_id_idx" ON "payload_locked_documents_rels" USING btree ("game_hard_resources_id");`)
|
CREATE INDEX "payload_locked_documents_rels_game_hard_resources_id_idx" ON "payload_locked_documents_rels" USING btree ("game_hard_resources_id");`);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
||||||
|
|
@ -26,5 +26,5 @@ export async function down({ db, payload, req }: MigrateDownArgs): Promise<void>
|
||||||
ALTER TABLE "payload_locked_documents_rels" DROP CONSTRAINT "payload_locked_documents_rels_game_hard_resources_fk";
|
ALTER TABLE "payload_locked_documents_rels" DROP CONSTRAINT "payload_locked_documents_rels_game_hard_resources_fk";
|
||||||
|
|
||||||
DROP INDEX "payload_locked_documents_rels_game_hard_resources_id_idx";
|
DROP INDEX "payload_locked_documents_rels_game_hard_resources_id_idx";
|
||||||
ALTER TABLE "payload_locked_documents_rels" DROP COLUMN "game_hard_resources_id";`)
|
ALTER TABLE "payload_locked_documents_rels" DROP COLUMN "game_hard_resources_id";`);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
|
import { MigrateDownArgs, MigrateUpArgs, sql } from "@payloadcms/db-postgres";
|
||||||
|
|
||||||
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
||||||
await db.execute(sql`
|
await db.execute(sql`
|
||||||
|
|
@ -15,11 +15,11 @@ export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
||||||
CREATE INDEX "technologies_research_costs_resources_order_idx" ON "technologies_research_costs_resources" USING btree ("_order");
|
CREATE INDEX "technologies_research_costs_resources_order_idx" ON "technologies_research_costs_resources" USING btree ("_order");
|
||||||
CREATE INDEX "technologies_research_costs_resources_parent_id_idx" ON "technologies_research_costs_resources" USING btree ("_parent_id");
|
CREATE INDEX "technologies_research_costs_resources_parent_id_idx" ON "technologies_research_costs_resources" USING btree ("_parent_id");
|
||||||
CREATE INDEX "technologies_research_costs_resources_resource_idx" ON "technologies_research_costs_resources" USING btree ("resource_id");
|
CREATE INDEX "technologies_research_costs_resources_resource_idx" ON "technologies_research_costs_resources" USING btree ("resource_id");
|
||||||
ALTER TABLE "technologies" DROP COLUMN "requirements_intelligence_points";`)
|
ALTER TABLE "technologies" DROP COLUMN "requirements_intelligence_points";`);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
||||||
await db.execute(sql`
|
await db.execute(sql`
|
||||||
DROP TABLE "technologies_research_costs_resources" CASCADE;
|
DROP TABLE "technologies_research_costs_resources" CASCADE;
|
||||||
ALTER TABLE "technologies" ADD COLUMN "requirements_intelligence_points" numeric;`)
|
ALTER TABLE "technologies" ADD COLUMN "requirements_intelligence_points" numeric;`);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
|
import { MigrateDownArgs, MigrateUpArgs, sql } from "@payloadcms/db-postgres";
|
||||||
|
|
||||||
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
||||||
await db.execute(sql`
|
await db.execute(sql`
|
||||||
|
|
@ -16,7 +16,7 @@ export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
||||||
CREATE INDEX "experience_updated_at_idx" ON "experience" USING btree ("updated_at");
|
CREATE INDEX "experience_updated_at_idx" ON "experience" USING btree ("updated_at");
|
||||||
CREATE INDEX "experience_created_at_idx" ON "experience" USING btree ("created_at");
|
CREATE INDEX "experience_created_at_idx" ON "experience" USING btree ("created_at");
|
||||||
ALTER TABLE "payload_locked_documents_rels" ADD CONSTRAINT "payload_locked_documents_rels_experience_fk" FOREIGN KEY ("experience_id") REFERENCES "public"."experience"("id") ON DELETE cascade ON UPDATE no action;
|
ALTER TABLE "payload_locked_documents_rels" ADD CONSTRAINT "payload_locked_documents_rels_experience_fk" FOREIGN KEY ("experience_id") REFERENCES "public"."experience"("id") ON DELETE cascade ON UPDATE no action;
|
||||||
CREATE INDEX "payload_locked_documents_rels_experience_id_idx" ON "payload_locked_documents_rels" USING btree ("experience_id");`)
|
CREATE INDEX "payload_locked_documents_rels_experience_id_idx" ON "payload_locked_documents_rels" USING btree ("experience_id");`);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
||||||
|
|
@ -26,5 +26,5 @@ export async function down({ db, payload, req }: MigrateDownArgs): Promise<void>
|
||||||
ALTER TABLE "payload_locked_documents_rels" DROP CONSTRAINT "payload_locked_documents_rels_experience_fk";
|
ALTER TABLE "payload_locked_documents_rels" DROP CONSTRAINT "payload_locked_documents_rels_experience_fk";
|
||||||
|
|
||||||
DROP INDEX "payload_locked_documents_rels_experience_id_idx";
|
DROP INDEX "payload_locked_documents_rels_experience_id_idx";
|
||||||
ALTER TABLE "payload_locked_documents_rels" DROP COLUMN "experience_id";`)
|
ALTER TABLE "payload_locked_documents_rels" DROP COLUMN "experience_id";`);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
|
import { MigrateDownArgs, MigrateUpArgs, sql } from "@payloadcms/db-postgres";
|
||||||
|
|
||||||
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
||||||
await db.execute(sql`
|
await db.execute(sql`
|
||||||
|
|
@ -641,7 +641,7 @@ export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
||||||
CREATE INDEX "payload_locked_documents_rels_loadouts_id_idx" ON "payload_locked_documents_rels" USING btree ("loadouts_id");
|
CREATE INDEX "payload_locked_documents_rels_loadouts_id_idx" ON "payload_locked_documents_rels" USING btree ("loadouts_id");
|
||||||
CREATE INDEX "payload_locked_documents_rels_market_listings_id_idx" ON "payload_locked_documents_rels" USING btree ("market_listings_id");
|
CREATE INDEX "payload_locked_documents_rels_market_listings_id_idx" ON "payload_locked_documents_rels" USING btree ("market_listings_id");
|
||||||
CREATE INDEX "payload_locked_documents_rels_market_negotiations_id_idx" ON "payload_locked_documents_rels" USING btree ("market_negotiations_id");
|
CREATE INDEX "payload_locked_documents_rels_market_negotiations_id_idx" ON "payload_locked_documents_rels" USING btree ("market_negotiations_id");
|
||||||
ALTER TABLE "missions_factions_involved" DROP COLUMN "faction_name";`)
|
ALTER TABLE "missions_factions_involved" DROP COLUMN "faction_name";`);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
||||||
|
|
@ -862,5 +862,5 @@ export async function down({ db, payload, req }: MigrateDownArgs): Promise<void>
|
||||||
DROP TYPE "public"."enum_market_negotiations_history_from";
|
DROP TYPE "public"."enum_market_negotiations_history_from";
|
||||||
DROP TYPE "public"."enum_market_negotiations_status";
|
DROP TYPE "public"."enum_market_negotiations_status";
|
||||||
DROP TYPE "public"."enum_market_negotiations_proposed_by";
|
DROP TYPE "public"."enum_market_negotiations_proposed_by";
|
||||||
DROP TYPE "public"."enum_narrative_events_triggers_type";`)
|
DROP TYPE "public"."enum_narrative_events_triggers_type";`);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
|
import { MigrateDownArgs, MigrateUpArgs, sql } from "@payloadcms/db-postgres";
|
||||||
|
|
||||||
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
||||||
await db.execute(sql`
|
await db.execute(sql`
|
||||||
|
|
@ -65,7 +65,7 @@ export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
||||||
CREATE INDEX "payload_locked_documents_rels_tickets_id_idx" ON "payload_locked_documents_rels" USING btree ("tickets_id");
|
CREATE INDEX "payload_locked_documents_rels_tickets_id_idx" ON "payload_locked_documents_rels" USING btree ("tickets_id");
|
||||||
|
|
||||||
ALTER TABLE "tickets_activity" DISABLE ROW LEVEL SECURITY;
|
ALTER TABLE "tickets_activity" DISABLE ROW LEVEL SECURITY;
|
||||||
ALTER TABLE "tickets" DISABLE ROW LEVEL SECURITY;`)
|
ALTER TABLE "tickets" DISABLE ROW LEVEL SECURITY;`);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
||||||
|
|
@ -101,5 +101,5 @@ export async function down({ db, payload, req }: MigrateDownArgs): Promise<void>
|
||||||
|
|
||||||
-- Note: the enum values added via ALTER TYPE ... ADD VALUE in up()
|
-- Note: the enum values added via ALTER TYPE ... ADD VALUE in up()
|
||||||
-- ('tickets', 'ticket:created', 'ticket:assigned', 'ticket:reply', 'ticket:status')
|
-- ('tickets', 'ticket:created', 'ticket:assigned', 'ticket:reply', 'ticket:status')
|
||||||
-- cannot be removed here: PostgreSQL does not support DROP VALUE.`)
|
-- cannot be removed here: PostgreSQL does not support DROP VALUE.`);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,51 +1,51 @@
|
||||||
import * as migration_20251206_065831 from './20251206_065831';
|
import * as migration_20251206_065831 from "./20251206_065831";
|
||||||
import * as migration_20251212_183607 from './20251212_183607';
|
import * as migration_20251212_183607 from "./20251212_183607";
|
||||||
import * as migration_20251219_061127 from './20251219_061127';
|
import * as migration_20251219_061127 from "./20251219_061127";
|
||||||
import * as migration_20251222_200320 from './20251222_200320';
|
import * as migration_20251222_200320 from "./20251222_200320";
|
||||||
import * as migration_20251223_055859 from './20251223_055859';
|
import * as migration_20251223_055859 from "./20251223_055859";
|
||||||
import * as migration_20260109_065519 from './20260109_065519';
|
import * as migration_20260109_065519 from "./20260109_065519";
|
||||||
import * as migration_20260816_213455 from './20260816_213455';
|
import * as migration_20260816_213455 from "./20260816_213455";
|
||||||
import * as migration_20260816_220000 from './20260816_220000';
|
import * as migration_20260816_220000 from "./20260816_220000";
|
||||||
|
|
||||||
export const migrations = [
|
export const migrations = [
|
||||||
{
|
{
|
||||||
up: migration_20251206_065831.up,
|
up: migration_20251206_065831.up,
|
||||||
down: migration_20251206_065831.down,
|
down: migration_20251206_065831.down,
|
||||||
name: '20251206_065831',
|
name: "20251206_065831",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
up: migration_20251212_183607.up,
|
up: migration_20251212_183607.up,
|
||||||
down: migration_20251212_183607.down,
|
down: migration_20251212_183607.down,
|
||||||
name: '20251212_183607',
|
name: "20251212_183607",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
up: migration_20251219_061127.up,
|
up: migration_20251219_061127.up,
|
||||||
down: migration_20251219_061127.down,
|
down: migration_20251219_061127.down,
|
||||||
name: '20251219_061127',
|
name: "20251219_061127",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
up: migration_20251222_200320.up,
|
up: migration_20251222_200320.up,
|
||||||
down: migration_20251222_200320.down,
|
down: migration_20251222_200320.down,
|
||||||
name: '20251222_200320',
|
name: "20251222_200320",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
up: migration_20251223_055859.up,
|
up: migration_20251223_055859.up,
|
||||||
down: migration_20251223_055859.down,
|
down: migration_20251223_055859.down,
|
||||||
name: '20251223_055859',
|
name: "20251223_055859",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
up: migration_20260109_065519.up,
|
up: migration_20260109_065519.up,
|
||||||
down: migration_20260109_065519.down,
|
down: migration_20260109_065519.down,
|
||||||
name: '20260109_065519',
|
name: "20260109_065519",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
up: migration_20260816_213455.up,
|
up: migration_20260816_213455.up,
|
||||||
down: migration_20260816_213455.down,
|
down: migration_20260816_213455.down,
|
||||||
name: '20260816_213455',
|
name: "20260816_213455",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
up: migration_20260816_220000.up,
|
up: migration_20260816_220000.up,
|
||||||
down: migration_20260816_220000.down,
|
down: migration_20260816_220000.down,
|
||||||
name: '20260816_220000',
|
name: "20260816_220000",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import type { SanitizedConfig } from "payload";
|
import type { SanitizedConfig } from "payload";
|
||||||
import { getPayload } from "payload";
|
import { getPayload } from "payload";
|
||||||
import type { Shipment, GameVehicle, GameStructure, Vehicle } from "@/payload-types";
|
import type { GameStructure, GameVehicle, Shipment, Vehicle } from "@/payload-types";
|
||||||
import { processShipmentTick } from "./processShipmentTick";
|
import { processShipmentTick } from "./processShipmentTick";
|
||||||
import { emitGameEvent } from "@/utils/event-log/emit";
|
import { emitGameEvent } from "@/utils/event-log/emit";
|
||||||
import { EventTypes } from "@/utils/event-log/eventTypes";
|
import { EventTypes } from "@/utils/event-log/eventTypes";
|
||||||
|
|
@ -32,11 +32,8 @@ export const script = async (config: SanitizedConfig) => {
|
||||||
);
|
);
|
||||||
processedCount++;
|
processedCount++;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const message =
|
const message = error instanceof Error ? error.message : "Unknown error";
|
||||||
error instanceof Error ? error.message : "Unknown error";
|
payload.logger.error(`[Game Tick] Error processing shipment ${shipment.id}: ${message}`);
|
||||||
payload.logger.error(
|
|
||||||
`[Game Tick] Error processing shipment ${shipment.id}: ${message}`,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -49,10 +46,7 @@ export const script = async (config: SanitizedConfig) => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const notifyUrl = (process.env.APP_URL ?? "http://localhost:3000").replace(
|
const notifyUrl = (process.env.APP_URL ?? "http://localhost:3000").replace(/\/$/, "");
|
||||||
/\/$/,
|
|
||||||
"",
|
|
||||||
);
|
|
||||||
const notifySecret = process.env.GAME_TICK_NOTIFY_SECRET;
|
const notifySecret = process.env.GAME_TICK_NOTIFY_SECRET;
|
||||||
if (notifySecret) {
|
if (notifySecret) {
|
||||||
await fetch(`${notifyUrl}/api/game-tick/notify`, {
|
await fetch(`${notifyUrl}/api/game-tick/notify`, {
|
||||||
|
|
@ -64,9 +58,7 @@ export const script = async (config: SanitizedConfig) => {
|
||||||
body: JSON.stringify({ processedAt: new Date().toISOString() }),
|
body: JSON.stringify({ processedAt: new Date().toISOString() }),
|
||||||
}).catch((error: unknown) => {
|
}).catch((error: unknown) => {
|
||||||
const message = error instanceof Error ? error.message : "Unknown error";
|
const message = error instanceof Error ? error.message : "Unknown error";
|
||||||
payload.logger.error(
|
payload.logger.error(`[Game Tick] Failed to notify app clients: ${message}`);
|
||||||
`[Game Tick] Failed to notify app clients: ${message}`,
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
payload.logger.warn(
|
payload.logger.warn(
|
||||||
|
|
@ -74,8 +66,6 @@ export const script = async (config: SanitizedConfig) => {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
payload.logger.info(
|
payload.logger.info(`[Game Tick] Complete. Processed ${processedCount} shipments.`);
|
||||||
`[Game Tick] Complete. Processed ${processedCount} shipments.`,
|
|
||||||
);
|
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
};
|
};
|
||||||
|
|
@ -4,9 +4,7 @@ import { getPayload } from "payload";
|
||||||
export const script = async (config: SanitizedConfig) => {
|
export const script = async (config: SanitizedConfig) => {
|
||||||
const payload = await getPayload({ config });
|
const payload = await getPayload({ config });
|
||||||
|
|
||||||
payload.logger.info(
|
payload.logger.info("[Generate Mission] Starting next mission template generation...");
|
||||||
"[Generate Mission] Starting next mission template generation...",
|
|
||||||
);
|
|
||||||
|
|
||||||
const latest = await payload.find({
|
const latest = await payload.find({
|
||||||
collection: "missions",
|
collection: "missions",
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,7 @@ import { getPayload } from "payload";
|
||||||
import type { Asset, MarketListing } from "@/payload-types";
|
import type { Asset, MarketListing } from "@/payload-types";
|
||||||
import { emitGameEvent } from "@/utils/event-log/emit";
|
import { emitGameEvent } from "@/utils/event-log/emit";
|
||||||
import { EventTypes } from "@/utils/event-log/eventTypes";
|
import { EventTypes } from "@/utils/event-log/eventTypes";
|
||||||
import {
|
import { AUTO_LISTING_DURATION_MS, autoPrice, autoQuantity, expireListing } from "@/lib/market";
|
||||||
AUTO_LISTING_DURATION_MS,
|
|
||||||
autoPrice,
|
|
||||||
autoQuantity,
|
|
||||||
expireListing,
|
|
||||||
} from "@/lib/market";
|
|
||||||
import { applyNpcPriceModifier, resolveVendorNpc } from "@/lib/market/npcs";
|
import { applyNpcPriceModifier, resolveVendorNpc } from "@/lib/market/npcs";
|
||||||
import { expireNegotiationsForListing } from "@/lib/market/negotiations";
|
import { expireNegotiationsForListing } from "@/lib/market/negotiations";
|
||||||
import { resolveAssetId } from "@/lib/locker";
|
import { resolveAssetId } from "@/lib/locker";
|
||||||
|
|
@ -26,10 +21,7 @@ export const script = async (config: SanitizedConfig) => {
|
||||||
const expiring = await payload.find({
|
const expiring = await payload.find({
|
||||||
collection: "market-listings",
|
collection: "market-listings",
|
||||||
where: {
|
where: {
|
||||||
and: [
|
and: [{ status: { equals: "active" } }, { expiresAt: { less_than_equal: nowIso } }],
|
||||||
{ status: { equals: "active" } },
|
|
||||||
{ expiresAt: { less_than_equal: nowIso } },
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
limit: 200,
|
limit: 200,
|
||||||
depth: 1,
|
depth: 1,
|
||||||
|
|
@ -63,7 +55,12 @@ export const script = async (config: SanitizedConfig) => {
|
||||||
actor: sellerId ?? undefined,
|
actor: sellerId ?? undefined,
|
||||||
targetCollection: "market-listings",
|
targetCollection: "market-listings",
|
||||||
targetId: listing.id,
|
targetId: listing.id,
|
||||||
data: { assetId: listing.asset, assetName, quantity: listing.quantity, autoGenerated: listing.isAutoGenerated },
|
data: {
|
||||||
|
assetId: listing.asset,
|
||||||
|
assetName,
|
||||||
|
quantity: listing.quantity,
|
||||||
|
autoGenerated: listing.isAutoGenerated,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const message = error instanceof Error ? error.message : "Unknown error";
|
const message = error instanceof Error ? error.message : "Unknown error";
|
||||||
|
|
@ -83,10 +80,7 @@ export const script = async (config: SanitizedConfig) => {
|
||||||
const assets = await payload.find({
|
const assets = await payload.find({
|
||||||
collection: "assets",
|
collection: "assets",
|
||||||
where: {
|
where: {
|
||||||
and: [
|
and: [{ tradeable: { equals: true } }, { isLive: { equals: true } }],
|
||||||
{ tradeable: { equals: true } },
|
|
||||||
{ isLive: { equals: true } },
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
limit: 2000,
|
limit: 2000,
|
||||||
depth: 0,
|
depth: 0,
|
||||||
|
|
@ -134,7 +128,9 @@ export const script = async (config: SanitizedConfig) => {
|
||||||
generatedCount++;
|
generatedCount++;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const message = error instanceof Error ? error.message : "Unknown error";
|
const message = error instanceof Error ? error.message : "Unknown error";
|
||||||
payload.logger.error(`[Market Tick] Error generating listing for asset ${asset.id}: ${message}`);
|
payload.logger.error(
|
||||||
|
`[Market Tick] Error generating listing for asset ${asset.id}: ${message}`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import type { Payload } from "payload";
|
import type { Payload } from "payload";
|
||||||
import type { Shipment, GameVehicle, GameStructure, Vehicle } from "@/payload-types";
|
import type { GameStructure, GameVehicle, Shipment, Vehicle } from "@/payload-types";
|
||||||
import { emitGameEvent } from "@/utils/event-log/emit";
|
import { emitGameEvent } from "@/utils/event-log/emit";
|
||||||
import { EventTypes } from "@/utils/event-log/eventTypes";
|
import { EventTypes } from "@/utils/event-log/eventTypes";
|
||||||
import { notifyUser } from "@/lib/notifications";
|
import { notifyUser } from "@/lib/notifications";
|
||||||
|
|
|
||||||
|
|
@ -43,23 +43,17 @@ const DEFAULT_XP_LEVELS = [
|
||||||
{
|
{
|
||||||
name: "Operative",
|
name: "Operative",
|
||||||
requiredPoints: 500,
|
requiredPoints: 500,
|
||||||
description: richText(
|
description: richText("Proven capable in the field. Trusted with standard combat operations."),
|
||||||
"Proven capable in the field. Trusted with standard combat operations.",
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Veteran",
|
name: "Veteran",
|
||||||
requiredPoints: 1_500,
|
requiredPoints: 1_500,
|
||||||
description: richText(
|
description: richText("Battle-hardened and dependable. Seen enough action to brief newcomers."),
|
||||||
"Battle-hardened and dependable. Seen enough action to brief newcomers.",
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Specialist",
|
name: "Specialist",
|
||||||
requiredPoints: 3_500,
|
requiredPoints: 3_500,
|
||||||
description: richText(
|
description: richText("Expert in a specialized role. Called upon for high-priority missions."),
|
||||||
"Expert in a specialized role. Called upon for high-priority missions.",
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Elite",
|
name: "Elite",
|
||||||
|
|
@ -78,30 +72,22 @@ const DEFAULT_XP_LEVELS = [
|
||||||
{
|
{
|
||||||
name: "Vanguard",
|
name: "Vanguard",
|
||||||
requiredPoints: 20_000,
|
requiredPoints: 20_000,
|
||||||
description: richText(
|
description: richText("Leads from the front. Sets the standard for the entire task force."),
|
||||||
"Leads from the front. Sets the standard for the entire task force.",
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Phantom",
|
name: "Phantom",
|
||||||
requiredPoints: 35_000,
|
requiredPoints: 35_000,
|
||||||
description: richText(
|
description: richText("Operates beyond the wire. Reputation alone shifts the odds."),
|
||||||
"Operates beyond the wire. Reputation alone shifts the odds.",
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Apex",
|
name: "Apex",
|
||||||
requiredPoints: 55_000,
|
requiredPoints: 55_000,
|
||||||
description: richText(
|
description: richText("The peak of combat effectiveness. A living legend within the unit."),
|
||||||
"The peak of combat effectiveness. A living legend within the unit.",
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Mythic",
|
name: "Mythic",
|
||||||
requiredPoints: 80_000,
|
requiredPoints: 80_000,
|
||||||
description: richText(
|
description: richText("Status spoken of in hushed tones. Their record is the unit's history."),
|
||||||
"Status spoken of in hushed tones. Their record is the unit's history.",
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue