refactor: centralize paired room role normalization (#193)
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user