feat: port monthly scout policy actions

This commit is contained in:
2026-07-25 20:28:25 +00:00
parent 5262a61ddf
commit fdd169fbfd
6 changed files with 428 additions and 4 deletions
@@ -16,14 +16,26 @@ export const setBlockScout = authedProcedure
.mutation(async ({ ctx, input }) => {
const me = await getMyGeneral(ctx);
assertNationAccess(me);
const nation = await ctx.db.nation.findUnique({
where: { id: me.nationId },
select: { meta: true },
});
const [nation, worldState] = await Promise.all([
ctx.db.nation.findUnique({
where: { id: me.nationId },
select: { meta: true },
}),
ctx.db.worldState.findFirst({
select: { meta: true },
}),
]);
if (!nation) {
throw new TRPCError({ code: 'NOT_FOUND', message: 'Nation not found' });
}
assertNationEditable(me, nation.meta);
const worldMeta = asRecord(worldState?.meta);
if (worldMeta.block_change_scout === true) {
throw new TRPCError({
code: 'FORBIDDEN',
message: '임관 설정을 바꿀 수 없도록 설정되어 있습니다.',
});
}
const nationMeta = asRecord(nation.meta);
await updateNationMeta(
ctx,