diff --git a/src/nextline_schedule/schema/mutation.py b/src/nextline_schedule/schema/mutation.py index 3e596eb..ce75793 100644 --- a/src/nextline_schedule/schema/mutation.py +++ b/src/nextline_schedule/schema/mutation.py @@ -1,8 +1,11 @@ from typing import Optional import strawberry +from nextline import Nextline from strawberry.types import Info +from nextline_schedule.scheduler import RequestStatement + async def mutate_turn_on(info: Info) -> bool: auto_mode = info.context["auto_mode"] @@ -43,6 +46,14 @@ def update(self, info: Info, input: MutationSchedulerInput) -> bool: return True +async def mutate_load_script(info: Info) -> bool: + nextline: Nextline = info.context["nextline"] + scheduler: RequestStatement = info.context["scheduler"] + statement = await scheduler() + await nextline.reset(statement=statement) + return True + + @strawberry.type class MutationSchedule: @strawberry.field @@ -53,6 +64,10 @@ def auto_mode(self, info: Info) -> MutationAutoMode: def scheduler(self, info: Info) -> MutationScheduler: return MutationScheduler() + @strawberry.mutation + async def load_script(self, info: Info) -> bool: + return await mutate_load_script(info) + @strawberry.type class Mutation: