Skip to content

Commit

Permalink
scoping
Browse files Browse the repository at this point in the history
  • Loading branch information
mwdchang authored and fivegrant committed Feb 22, 2024
1 parent f471252 commit 1651b88
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions service/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,16 @@ def cancel_job(
for operation_name, schema in operations.items():
registrar = app.post(f"/{operation_name}", response_model=JobResponse)

def operate(
body: schema,
redis_conn=Depends(get_redis),
) -> JobResponse:
return create_job(body, operation_name, redis_conn)
def make_operate(operation):
def operate(
body: schema,
redis_conn=Depends(get_redis),
) -> JobResponse:
return create_job(body, operation, redis_conn)

return operate

operate = make_operate(operation_name)
registrar(operate)


Expand Down

0 comments on commit 1651b88

Please sign in to comment.