Skip to content

Commit 9aa6f3d

Browse files
committed
add run-task endpoint
1 parent f184df8 commit 9aa6f3d

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

app/main.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from fastapi import FastAPI, Depends
33
from typing import List
44

5-
from app.dependencies import get_db
5+
from app.dependencies import get_db, get_queue
66
from app.schemas import ItemRequestSchema, ItemResponseSchema, ItemUpdateSchema
77
from app.schemas import PaymentResponseSchema, PaymentRequestSchema
88
from app.models import Item, Payment
@@ -60,6 +60,7 @@ def delete_item(item_id: int):
6060
@app.patch("/items/{item_id}")
6161
def update_item(item_id: int, item_body: ItemUpdateSchema):
6262
item_to_update = Item.get_by_id(item_id)
63+
6364
item_to_update.title = item_body.title
6465
item_to_update.price = item_body.price
6566
item_to_update.category = item_body.category
@@ -102,3 +103,11 @@ def get_payments_list(days: int):
102103
response = [PaymentResponseSchema.from_orm(item) for item in payments_list]
103104

104105
return response
106+
107+
108+
@app.post("/run-task")
109+
def run_task():
110+
queue = get_queue()
111+
queue.enqueue(fill_file_with_hw)
112+
113+
return {}

0 commit comments

Comments
 (0)