merge: align main command editor with ref
# Conflicts: # app/game-frontend/e2e/mainNavigation.spec.ts
This commit is contained in:
@@ -19,6 +19,7 @@ export interface ReservedTurnView {
|
||||
export interface ReservedTurnSnapshot {
|
||||
revision: number;
|
||||
turns: ReservedTurnView[];
|
||||
autorunLimit?: number | null;
|
||||
}
|
||||
|
||||
export interface ReservedTurnUpdate {
|
||||
@@ -170,13 +171,19 @@ export const listGeneralTurns = async (db: DatabaseClient, generalId: number): P
|
||||
};
|
||||
|
||||
export const getGeneralTurnSnapshot = async (db: DatabaseClient, generalId: number): Promise<ReservedTurnSnapshot> => {
|
||||
const [turns, revisionRow] = await Promise.all([
|
||||
const [turns, revisionRow, general] = await Promise.all([
|
||||
loadGeneralTurns(db, generalId),
|
||||
db.generalTurnRevision.findUnique({ where: { generalId } }),
|
||||
db.general.findUnique({ where: { id: generalId }, select: { meta: true } }),
|
||||
]);
|
||||
const rawAutorunLimit = isRecord(general?.meta) ? general.meta.autorun_limit : undefined;
|
||||
return {
|
||||
revision: revisionRow?.revision ?? 0,
|
||||
turns: serializeTurnList(turns),
|
||||
autorunLimit:
|
||||
typeof rawAutorunLimit === 'number' && Number.isFinite(rawAutorunLimit)
|
||||
? Math.trunc(rawAutorunLimit)
|
||||
: null,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -824,7 +824,7 @@ describe('appRouter', () => {
|
||||
});
|
||||
|
||||
it('returns reserved general turns', async () => {
|
||||
const general = buildGeneralRow({ id: 11 });
|
||||
const general = buildGeneralRow({ id: 11, meta: { autorun_limit: 2408 } });
|
||||
const generalTurns: GeneralTurnRow[] = [
|
||||
{
|
||||
id: 1,
|
||||
@@ -839,6 +839,7 @@ describe('appRouter', () => {
|
||||
const response = await caller.turns.reserved.getGeneral({ generalId: 11 });
|
||||
|
||||
expect(response.revision).toBe(0);
|
||||
expect(response.autorunLimit).toBe(2408);
|
||||
expect(response.turns[0]?.action).toBe('che_화계');
|
||||
expect(response.turns[0]?.index).toBe(0);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user