fix: align legacy general access call boundaries

This commit is contained in:
2026-07-31 07:33:26 +00:00
parent 821da19731
commit 98a3cf514f
34 changed files with 909 additions and 177 deletions
+2 -3
View File
@@ -1,7 +1,7 @@
import { asRecord } from '@sammo-ts/common';
import { z } from 'zod';
import { authedProcedure } from '../../trpc.js';
import { accessAuthedInputProcedure, authedProcedure } from '../../trpc.js';
import { loadTraitNames } from '../nation/shared.js';
import { getMyGeneral } from '../shared/general.js';
import { resolveSecretPermission } from '../shared/secretPermission.js';
@@ -204,8 +204,7 @@ export const getNationDirectory = authedProcedure.query(async ({ ctx }) => {
});
});
export const getGeneralDirectory = authedProcedure
.input(z.object({ sort: zDirectorySort }).optional())
export const getGeneralDirectory = accessAuthedInputProcedure(z.object({ sort: zDirectorySort }).optional())
.query(async ({ ctx, input }) => {
await getMyGeneral(ctx);
const sort = input?.sort ?? 9;
+2 -3
View File
@@ -2,8 +2,7 @@ import { TRPCError } from '@trpc/server';
import { z } from 'zod';
import { type WorldStateRow, zWorldStateConfig, zWorldStateMeta } from '../../context.js';
import { procedure, router } from '../../trpc.js';
import { authedProcedure } from '../../trpc.js';
import { accessAuthedProcedure, authedProcedure, procedure, router } from '../../trpc.js';
import { asRecord, isRecord } from '@sammo-ts/common';
import { loadWorldMap } from '../../maps/worldMap.js';
import { loadMapLayout } from '../../maps/mapLayout.js';
@@ -71,7 +70,7 @@ const toWorldStateSnapshot = (row: WorldStateRow) => ({
export const worldRouter = router({
getNationDirectory,
getGeneralDirectory,
getGlobalInfo: authedProcedure.query(async ({ ctx }) => {
getGlobalInfo: accessAuthedProcedure.query(async ({ ctx }) => {
const me = await getMyGeneral(ctx);
const [nations, cities, diplomacy, map] = await Promise.all([
ctx.db.nation.findMany({ where: { level: { gt: 0 } } }),