(
session: GoalQueueSession,
input: { readonly goalId: string },
)
| 82 | } |
| 83 | |
| 84 | export async function removeGoalQueueItem( |
| 85 | session: GoalQueueSession, |
| 86 | input: { readonly goalId: string }, |
| 87 | ): Promise<GoalQueueSnapshot> { |
| 88 | return withQueueMutationLock(session, async () => { |
| 89 | const state = await readQueueFile(session); |
| 90 | const index = findGoalIndex(state, input.goalId); |
| 91 | const goals = state.goals.filter((_, goalIndex) => goalIndex !== index); |
| 92 | const next: GoalQueueFile = { version: GOAL_QUEUE_VERSION, goals }; |
| 93 | await writeQueueFile(session, next); |
| 94 | return toSnapshot(next); |
| 95 | }); |
| 96 | } |
| 97 | |
| 98 | export async function restoreGoalQueueItem( |
| 99 | session: GoalQueueSession, |
no test coverage detected