refactor: centralize paired room role normalization (#193)

This commit is contained in:
Eyejoker
2026-05-30 00:03:15 +09:00
committed by GitHub
parent 5fa5b2f684
commit adf9c16b9a
10 changed files with 107 additions and 50 deletions

View File

@@ -9,7 +9,7 @@ import {
isWatchCiTask,
} from '../task-watch-status.js';
import type { IpcDeps, TaskIpcPayload } from '../ipc-types.js';
import type { PairedRoomRole, RegisteredGroup } from '../types.js';
import { normalizePairedRoomRole, type RegisteredGroup } from '../types.js';
type RoomBindings = ReturnType<IpcDeps['roomBindings']>;
type ScheduleType = 'cron' | 'interval' | 'once';
@@ -20,14 +20,6 @@ interface ResolvedScheduleTarget {
room: RegisteredGroup;
}
function normalizePairedRoomRole(
role: string | null | undefined,
): PairedRoomRole | undefined {
return role === 'owner' || role === 'reviewer' || role === 'arbiter'
? role
: undefined;
}
export function handleScheduleTask(
data: TaskIpcPayload,
sourceGroup: string,