Skip to content

Commit a8af014

Browse files
committed
create app
1 parent a684352 commit a8af014

File tree

1 file changed

+4
-4
lines changed
  • simple_backend/src/task_tracker

1 file changed

+4
-4
lines changed

simple_backend/src/task_tracker/main.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44
app = FastAPI()
55
tasks = []
66
task_id_counter = 1
7-
# выводим список всех полученных задач
7+
# we display a list of all received tasks.
88
@app.get("/tasks")
99
def get_tasks():
1010
return tasks
11-
# добавляем новую задачу, добавляем ее в список задач и увеличиваем счетчик id
11+
# We add a new task, add it to the task list, and increment the id counter.
1212
@app.post("/tasks")
1313
def create_task(name: str, condition: str = 'new'):
1414
task = {'id': task_id_counter, 'name': name, 'condition': condition}
1515
tasks.append(task)
1616
task_id_counter += 1
1717
return task
18-
# обновляем задачу , в случае отсутствия задачи вызываем ошибку
18+
# We update the task; if the task is missing, we raise an error.
1919
@app.put("/tasks/{task_id}")
2020
def update_task(task_id: int, name:str, condition: str):
2121
for task in tasks:
@@ -24,7 +24,7 @@ def update_task(task_id: int, name:str, condition: str):
2424
task[condition] = condition
2525
return task
2626
raise HTTPException(status_code = 404, detail = 'task not found')
27-
# ищем задачу по id, если находи - удаляем, если нет - вызываем ошибку
27+
# We search for a task by ID, if we find it, we delete it, if not, we raise an error
2828
@app.delete("/tasks/{task_id}")
2929
def delete_task(task_id: int):
3030
for task in tasks:

0 commit comments

Comments
 (0)