Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 13 additions & 25 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
openapi: 3.1.0
info:
title: TaskForge API
version: 1.0.0
version: 2.0.0
paths:
/api/tasks:
get:
Expand Down Expand Up @@ -81,26 +81,6 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
delete:
summary: Delete Task
description: Delete a task by ID.
operationId: delete_task_api_tasks__task_id__delete
parameters:
- name: task_id
in: path
required: true
schema:
type: integer
title: Task Id
responses:
'204':
description: Successful Response
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/health:
get:
summary: Health
Expand Down Expand Up @@ -140,19 +120,23 @@ components:
type: string
title: Status
default: pending
priority:
type: string
title: Priority
created_at:
type: string
format: date-time
title: Created At
assignee:
assigned_to:
anyOf:
- type: string
- type: 'null'
title: Assignee
title: Assigned To
type: object
required:
- id
- title
- priority
- created_at
title: Task
TaskCreate:
Expand All @@ -165,14 +149,18 @@ components:
- type: string
- type: 'null'
title: Description
assignee:
priority:
type: string
title: Priority
assigned_to:
anyOf:
- type: string
- type: 'null'
title: Assignee
title: Assigned To
type: object
required:
- title
- priority
title: TaskCreate
ValidationError:
properties:
Expand Down
17 changes: 7 additions & 10 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,24 @@
from typing import Optional
from datetime import datetime

app = FastAPI(title="TaskForge API", version="1.0.0")
app = FastAPI(title="TaskForge API", version="2.0.0")


class Task(BaseModel):
id: int
title: str
description: Optional[str] = None
status: str = "pending"
priority: str
created_at: datetime
assignee: Optional[str] = None
assigned_to: Optional[str] = None


class TaskCreate(BaseModel):
title: str
description: Optional[str] = None
assignee: Optional[str] = None
priority: str
assigned_to: Optional[str] = None


tasks_db = {}
Expand Down Expand Up @@ -55,15 +57,10 @@ def get_task(task_id: int):
return tasks_db[task_id]


@app.delete("/api/tasks/{task_id}", status_code=204)
def delete_task(task_id: int):
"""Delete a task by ID."""
if task_id not in tasks_db:
raise HTTPException(status_code=404, detail="Task not found")
del tasks_db[task_id]
# DELETE endpoint removed


@app.get("/api/health")
def health():
"""Health check endpoint."""
return {"status": "healthy", "version": "1.0.0", "uptime": 42}
return {"status": "healthy", "version": "2.0.0", "uptime": "42 seconds"}
Loading