Skip to content

Commit

Permalink
add mutate_load_script()
Browse files Browse the repository at this point in the history
  • Loading branch information
TaiSakuma committed Jul 28, 2023
1 parent b4cd812 commit c252338
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/nextline_schedule/schema/mutation.py
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit c252338

Please sign in to comment.