diff --git a/src/migrations/20251206_065831.ts b/src/migrations/20251206_065831.ts index ac33ea1..2d4872c 100644 --- a/src/migrations/20251206_065831.ts +++ b/src/migrations/20251206_065831.ts @@ -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 { await db.execute(sql` @@ -980,7 +980,7 @@ export async function up({ db, payload, req }: MigrateUpArgs): Promise { 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_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 { @@ -1069,5 +1069,5 @@ export async function down({ db, payload, req }: MigrateDownArgs): Promise DROP TYPE "public"."enum_vehicles_armor_rating"; DROP TYPE "public"."enum_structures_category"; DROP TYPE "public"."enum_structures_terrain_type"; - DROP TYPE "public"."enum_structures_function_type";`) + DROP TYPE "public"."enum_structures_function_type";`); } diff --git a/src/migrations/20251212_183607.ts b/src/migrations/20251212_183607.ts index 1e30352..b99abc2 100644 --- a/src/migrations/20251212_183607.ts +++ b/src/migrations/20251212_183607.ts @@ -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 { 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 { await db.execute(sql` - ALTER TABLE "media" ALTER COLUMN "alt" SET NOT NULL;`) + ALTER TABLE "media" ALTER COLUMN "alt" SET NOT NULL;`); } diff --git a/src/migrations/20251219_061127.ts b/src/migrations/20251219_061127.ts index 2bb69a2..c4da1a8 100644 --- a/src/migrations/20251219_061127.ts +++ b/src/migrations/20251219_061127.ts @@ -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 { await db.execute(sql` @@ -43,7 +43,7 @@ export async function up({ db, payload, req }: MigrateUpArgs): Promise { 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"); 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 { @@ -65,5 +65,5 @@ export async function down({ db, payload, req }: MigrateDownArgs): Promise 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 "produce_chance"; - ALTER TABLE "payload_locked_documents_rels" DROP COLUMN "game_structures_id";`) + ALTER TABLE "payload_locked_documents_rels" DROP COLUMN "game_structures_id";`); } diff --git a/src/migrations/20251222_200320.ts b/src/migrations/20251222_200320.ts index a233888..e5e5633 100644 --- a/src/migrations/20251222_200320.ts +++ b/src/migrations/20251222_200320.ts @@ -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 { await db.execute(sql` @@ -16,7 +16,7 @@ export async function up({ db, payload, req }: MigrateUpArgs): Promise { 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"); 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 { @@ -26,5 +26,5 @@ export async function down({ db, payload, req }: MigrateDownArgs): Promise 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"; - ALTER TABLE "payload_locked_documents_rels" DROP COLUMN "game_hard_resources_id";`) + ALTER TABLE "payload_locked_documents_rels" DROP COLUMN "game_hard_resources_id";`); } diff --git a/src/migrations/20251223_055859.ts b/src/migrations/20251223_055859.ts index 2f7e5c8..0bc9520 100644 --- a/src/migrations/20251223_055859.ts +++ b/src/migrations/20251223_055859.ts @@ -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 { await db.execute(sql` @@ -15,11 +15,11 @@ export async function up({ db, payload, req }: MigrateUpArgs): Promise { 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_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 { await db.execute(sql` 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;`); } diff --git a/src/migrations/20260109_065519.ts b/src/migrations/20260109_065519.ts index 44dcc0c..5a6f61f 100644 --- a/src/migrations/20260109_065519.ts +++ b/src/migrations/20260109_065519.ts @@ -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 { await db.execute(sql` @@ -16,7 +16,7 @@ export async function up({ db, payload, req }: MigrateUpArgs): Promise { CREATE INDEX "experience_updated_at_idx" ON "experience" USING btree ("updated_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; - 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 { @@ -26,5 +26,5 @@ export async function down({ db, payload, req }: MigrateDownArgs): Promise ALTER TABLE "payload_locked_documents_rels" DROP CONSTRAINT "payload_locked_documents_rels_experience_fk"; 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";`); } diff --git a/src/migrations/20260816_213455.ts b/src/migrations/20260816_213455.ts index 0f16938..5bac723 100644 --- a/src/migrations/20260816_213455.ts +++ b/src/migrations/20260816_213455.ts @@ -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 { await db.execute(sql` @@ -641,7 +641,7 @@ export async function up({ db, payload, req }: MigrateUpArgs): Promise { 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_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 { @@ -862,5 +862,5 @@ export async function down({ db, payload, req }: MigrateDownArgs): Promise DROP TYPE "public"."enum_market_negotiations_history_from"; DROP TYPE "public"."enum_market_negotiations_status"; DROP TYPE "public"."enum_market_negotiations_proposed_by"; - DROP TYPE "public"."enum_narrative_events_triggers_type";`) + DROP TYPE "public"."enum_narrative_events_triggers_type";`); } diff --git a/src/migrations/20260816_220000.ts b/src/migrations/20260816_220000.ts index 2c3278b..cd5028c 100644 --- a/src/migrations/20260816_220000.ts +++ b/src/migrations/20260816_220000.ts @@ -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 { await db.execute(sql` @@ -65,7 +65,7 @@ export async function up({ db, payload, req }: MigrateUpArgs): Promise { 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" DISABLE ROW LEVEL SECURITY;`) + ALTER TABLE "tickets" DISABLE ROW LEVEL SECURITY;`); } export async function down({ db, payload, req }: MigrateDownArgs): Promise { @@ -101,5 +101,5 @@ export async function down({ db, payload, req }: MigrateDownArgs): Promise -- Note: the enum values added via ALTER TYPE ... ADD VALUE in up() -- ('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.`); } diff --git a/src/migrations/index.ts b/src/migrations/index.ts index 1baba7f..6fa4279 100644 --- a/src/migrations/index.ts +++ b/src/migrations/index.ts @@ -1,51 +1,51 @@ -import * as migration_20251206_065831 from './20251206_065831'; -import * as migration_20251212_183607 from './20251212_183607'; -import * as migration_20251219_061127 from './20251219_061127'; -import * as migration_20251222_200320 from './20251222_200320'; -import * as migration_20251223_055859 from './20251223_055859'; -import * as migration_20260109_065519 from './20260109_065519'; -import * as migration_20260816_213455 from './20260816_213455'; -import * as migration_20260816_220000 from './20260816_220000'; +import * as migration_20251206_065831 from "./20251206_065831"; +import * as migration_20251212_183607 from "./20251212_183607"; +import * as migration_20251219_061127 from "./20251219_061127"; +import * as migration_20251222_200320 from "./20251222_200320"; +import * as migration_20251223_055859 from "./20251223_055859"; +import * as migration_20260109_065519 from "./20260109_065519"; +import * as migration_20260816_213455 from "./20260816_213455"; +import * as migration_20260816_220000 from "./20260816_220000"; export const migrations = [ { up: migration_20251206_065831.up, down: migration_20251206_065831.down, - name: '20251206_065831', + name: "20251206_065831", }, { up: migration_20251212_183607.up, down: migration_20251212_183607.down, - name: '20251212_183607', + name: "20251212_183607", }, { up: migration_20251219_061127.up, down: migration_20251219_061127.down, - name: '20251219_061127', + name: "20251219_061127", }, { up: migration_20251222_200320.up, down: migration_20251222_200320.down, - name: '20251222_200320', + name: "20251222_200320", }, { up: migration_20251223_055859.up, down: migration_20251223_055859.down, - name: '20251223_055859', + name: "20251223_055859", }, { up: migration_20260109_065519.up, down: migration_20260109_065519.down, - name: '20260109_065519', + name: "20260109_065519", }, { up: migration_20260816_213455.up, down: migration_20260816_213455.down, - name: '20260816_213455', + name: "20260816_213455", }, { up: migration_20260816_220000.up, down: migration_20260816_220000.down, - name: '20260816_220000', + name: "20260816_220000", }, ]; diff --git a/src/scripts/gameTick.ts b/src/scripts/gameTick.ts index 37a4019..a84d449 100644 --- a/src/scripts/gameTick.ts +++ b/src/scripts/gameTick.ts @@ -1,6 +1,6 @@ import type { SanitizedConfig } 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 { emitGameEvent } from "@/utils/event-log/emit"; import { EventTypes } from "@/utils/event-log/eventTypes"; @@ -32,11 +32,8 @@ export const script = async (config: SanitizedConfig) => { ); processedCount++; } catch (error) { - const message = - error instanceof Error ? error.message : "Unknown error"; - payload.logger.error( - `[Game Tick] Error processing shipment ${shipment.id}: ${message}`, - ); + const message = error instanceof Error ? error.message : "Unknown error"; + 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; if (notifySecret) { await fetch(`${notifyUrl}/api/game-tick/notify`, { @@ -64,9 +58,7 @@ export const script = async (config: SanitizedConfig) => { body: JSON.stringify({ processedAt: new Date().toISOString() }), }).catch((error: unknown) => { const message = error instanceof Error ? error.message : "Unknown error"; - payload.logger.error( - `[Game Tick] Failed to notify app clients: ${message}`, - ); + payload.logger.error(`[Game Tick] Failed to notify app clients: ${message}`); }); } else { payload.logger.warn( @@ -74,8 +66,6 @@ export const script = async (config: SanitizedConfig) => { ); } - payload.logger.info( - `[Game Tick] Complete. Processed ${processedCount} shipments.`, - ); + payload.logger.info(`[Game Tick] Complete. Processed ${processedCount} shipments.`); process.exit(0); }; \ No newline at end of file diff --git a/src/scripts/generateNextMission.ts b/src/scripts/generateNextMission.ts index 3bc9b40..94147b1 100644 --- a/src/scripts/generateNextMission.ts +++ b/src/scripts/generateNextMission.ts @@ -4,9 +4,7 @@ import { getPayload } from "payload"; export const script = async (config: SanitizedConfig) => { const payload = await getPayload({ config }); - payload.logger.info( - "[Generate Mission] Starting next mission template generation...", - ); + payload.logger.info("[Generate Mission] Starting next mission template generation..."); const latest = await payload.find({ collection: "missions", diff --git a/src/scripts/marketTick.ts b/src/scripts/marketTick.ts index ac9382e..6f45d71 100644 --- a/src/scripts/marketTick.ts +++ b/src/scripts/marketTick.ts @@ -3,12 +3,7 @@ import { getPayload } from "payload"; import type { Asset, MarketListing } from "@/payload-types"; import { emitGameEvent } from "@/utils/event-log/emit"; import { EventTypes } from "@/utils/event-log/eventTypes"; -import { - AUTO_LISTING_DURATION_MS, - autoPrice, - autoQuantity, - expireListing, -} from "@/lib/market"; +import { AUTO_LISTING_DURATION_MS, autoPrice, autoQuantity, expireListing } from "@/lib/market"; import { applyNpcPriceModifier, resolveVendorNpc } from "@/lib/market/npcs"; import { expireNegotiationsForListing } from "@/lib/market/negotiations"; import { resolveAssetId } from "@/lib/locker"; @@ -26,10 +21,7 @@ export const script = async (config: SanitizedConfig) => { const expiring = await payload.find({ collection: "market-listings", where: { - and: [ - { status: { equals: "active" } }, - { expiresAt: { less_than_equal: nowIso } }, - ], + and: [{ status: { equals: "active" } }, { expiresAt: { less_than_equal: nowIso } }], }, limit: 200, depth: 1, @@ -63,7 +55,12 @@ export const script = async (config: SanitizedConfig) => { actor: sellerId ?? undefined, targetCollection: "market-listings", 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) { const message = error instanceof Error ? error.message : "Unknown error"; @@ -83,10 +80,7 @@ export const script = async (config: SanitizedConfig) => { const assets = await payload.find({ collection: "assets", where: { - and: [ - { tradeable: { equals: true } }, - { isLive: { equals: true } }, - ], + and: [{ tradeable: { equals: true } }, { isLive: { equals: true } }], }, limit: 2000, depth: 0, @@ -134,7 +128,9 @@ export const script = async (config: SanitizedConfig) => { generatedCount++; } catch (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}`, + ); } } diff --git a/src/scripts/processShipmentTick.ts b/src/scripts/processShipmentTick.ts index 1aff253..28d02fa 100644 --- a/src/scripts/processShipmentTick.ts +++ b/src/scripts/processShipmentTick.ts @@ -1,5 +1,5 @@ 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 { EventTypes } from "@/utils/event-log/eventTypes"; import { notifyUser } from "@/lib/notifications"; diff --git a/src/tools/seed/seedExperience.ts b/src/tools/seed/seedExperience.ts index 79df5f9..bfb826a 100644 --- a/src/tools/seed/seedExperience.ts +++ b/src/tools/seed/seedExperience.ts @@ -43,23 +43,17 @@ const DEFAULT_XP_LEVELS = [ { name: "Operative", requiredPoints: 500, - description: richText( - "Proven capable in the field. Trusted with standard combat operations.", - ), + description: richText("Proven capable in the field. Trusted with standard combat operations."), }, { name: "Veteran", requiredPoints: 1_500, - description: richText( - "Battle-hardened and dependable. Seen enough action to brief newcomers.", - ), + description: richText("Battle-hardened and dependable. Seen enough action to brief newcomers."), }, { name: "Specialist", requiredPoints: 3_500, - description: richText( - "Expert in a specialized role. Called upon for high-priority missions.", - ), + description: richText("Expert in a specialized role. Called upon for high-priority missions."), }, { name: "Elite", @@ -78,30 +72,22 @@ const DEFAULT_XP_LEVELS = [ { name: "Vanguard", requiredPoints: 20_000, - description: richText( - "Leads from the front. Sets the standard for the entire task force.", - ), + description: richText("Leads from the front. Sets the standard for the entire task force."), }, { name: "Phantom", requiredPoints: 35_000, - description: richText( - "Operates beyond the wire. Reputation alone shifts the odds.", - ), + description: richText("Operates beyond the wire. Reputation alone shifts the odds."), }, { name: "Apex", requiredPoints: 55_000, - description: richText( - "The peak of combat effectiveness. A living legend within the unit.", - ), + description: richText("The peak of combat effectiveness. A living legend within the unit."), }, { name: "Mythic", requiredPoints: 80_000, - description: richText( - "Status spoken of in hushed tones. Their record is the unit's history.", - ), + description: richText("Status spoken of in hushed tones. Their record is the unit's history."), }, ];