Files
Michilis bd24545b7b Fix BASE_URL config loading, add tasks/projects; robust .env path resolution
- Config: try ENV_FILE, .env, ../.env for loading; trim trailing slash from BaseURL
- Log BASE_URL at server startup for verification
- .env.example: document BASE_URL
- Tasks, projects, tags, migrations and related API/handlers

Made-with: Cursor
2026-03-09 18:57:51 +00:00

460 lines
22 KiB
JSON

{
"paths": {
"/tasks": {
"get": {
"tags": ["Tasks"],
"summary": "List tasks",
"description": "Returns the authenticated user's tasks with optional filters. Supports status, priority, due date range, project, and cursor-based pagination. Requires `tasks:read` scope.",
"operationId": "listTasks",
"parameters": [
{ "name": "status", "in": "query", "schema": { "type": "string", "enum": ["todo", "in_progress", "done", "archived"] }, "description": "Filter by status" },
{ "name": "priority", "in": "query", "schema": { "type": "string", "enum": ["low", "medium", "high", "critical"] }, "description": "Filter by priority" },
{ "name": "project_id", "in": "query", "schema": { "type": "string", "format": "uuid" }, "description": "Filter by project" },
{ "name": "due_from", "in": "query", "schema": { "type": "string", "format": "date-time" }, "description": "Filter tasks due on or after" },
{ "name": "due_to", "in": "query", "schema": { "type": "string", "format": "date-time" }, "description": "Filter tasks due on or before" },
{ "name": "limit", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 200, "default": 50 } },
{ "name": "cursor", "in": "query", "schema": { "type": "string" }, "description": "Pagination cursor" }
],
"responses": {
"200": {
"description": "List of tasks",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["items", "page"],
"properties": {
"items": { "type": "array", "items": { "$ref": "#/components/schemas/Task" } },
"page": { "$ref": "#/components/schemas/PageInfo" }
}
}
}
}
},
"401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
"403": { "description": "Insufficient scope", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }
}
},
"post": {
"tags": ["Tasks"],
"summary": "Create a task",
"description": "Creates a new task for the authenticated user. Requires `tasks:write` scope.",
"operationId": "createTask",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["title"],
"properties": {
"title": { "type": "string", "minLength": 1, "maxLength": 500 },
"description": { "type": "string" },
"status": { "type": "string", "enum": ["todo", "in_progress", "done", "archived"], "default": "todo" },
"priority": { "type": "string", "enum": ["low", "medium", "high", "critical"], "default": "medium" },
"due_date": { "type": "string", "format": "date-time" },
"project_id": { "type": "string", "format": "uuid" },
"parent_id": { "type": "string", "format": "uuid" },
"sort_order": { "type": "integer" },
"recurrence_rule": { "type": "string" }
}
}
}
}
},
"responses": {
"200": {
"description": "Task created",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["task"],
"properties": {
"task": { "$ref": "#/components/schemas/Task" }
}
}
}
}
},
"400": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
"401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
"403": { "description": "Insufficient scope", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }
}
}
},
"/tasks/{id}": {
"get": {
"tags": ["Tasks"],
"summary": "Get a task",
"description": "Returns a single task by ID. Requires `tasks:read` scope.",
"operationId": "getTask",
"parameters": [
{ "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }
],
"responses": {
"200": {
"description": "Task details",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["task"],
"properties": {
"task": { "$ref": "#/components/schemas/Task" }
}
}
}
}
},
"401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
"403": { "description": "Insufficient scope", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
"404": { "description": "Task not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }
}
},
"put": {
"tags": ["Tasks"],
"summary": "Update a task",
"description": "Updates a task's fields. Requires `tasks:write` scope.",
"operationId": "updateTask",
"parameters": [
{ "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"title": { "type": "string", "minLength": 1, "maxLength": 500 },
"description": { "type": "string" },
"status": { "type": "string", "enum": ["todo", "in_progress", "done", "archived"] },
"priority": { "type": "string", "enum": ["low", "medium", "high", "critical"] },
"due_date": { "type": "string", "format": "date-time" },
"project_id": { "type": "string", "format": "uuid", "nullable": true },
"sort_order": { "type": "integer" },
"recurrence_rule": { "type": "string", "nullable": true }
}
}
}
}
},
"responses": {
"200": {
"description": "Task updated",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["task"],
"properties": {
"task": { "$ref": "#/components/schemas/Task" }
}
}
}
}
},
"400": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
"401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
"403": { "description": "Insufficient scope", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
"404": { "description": "Task not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }
}
},
"delete": {
"tags": ["Tasks"],
"summary": "Delete a task",
"description": "Soft-deletes a task by default. Use `?permanent=true` for hard delete. Requires `tasks:write` scope.",
"operationId": "deleteTask",
"parameters": [
{ "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } },
{ "name": "permanent", "in": "query", "schema": { "type": "boolean", "default": false }, "description": "If true, permanently delete (hard delete)" }
],
"responses": {
"200": { "description": "Task deleted", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OkResponse" } } } },
"401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
"403": { "description": "Insufficient scope", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
"404": { "description": "Task not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }
}
}
},
"/tasks/{id}/complete": {
"post": {
"tags": ["Tasks"],
"summary": "Mark task complete",
"description": "Marks a task as done. Fails if blocked by incomplete dependencies. Requires `tasks:write` scope.",
"operationId": "markTaskComplete",
"parameters": [
{ "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }
],
"responses": {
"200": {
"description": "Task marked complete",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["task"],
"properties": {
"task": { "$ref": "#/components/schemas/Task" }
}
}
}
}
},
"401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
"403": { "description": "Insufficient scope", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
"404": { "description": "Task not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
"409": { "description": "Blocked by incomplete dependencies", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }
}
}
},
"/tasks/{id}/uncomplete": {
"post": {
"tags": ["Tasks"],
"summary": "Mark task uncomplete",
"description": "Reverts a completed task to todo (or specified status). Requires `tasks:write` scope.",
"operationId": "markTaskUncomplete",
"parameters": [
{ "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"status": { "type": "string", "enum": ["todo", "in_progress"], "default": "todo" }
}
}
}
}
},
"responses": {
"200": {
"description": "Task marked uncomplete",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["task"],
"properties": {
"task": { "$ref": "#/components/schemas/Task" }
}
}
}
}
},
"401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
"403": { "description": "Insufficient scope", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
"404": { "description": "Task not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }
}
}
},
"/tasks/{id}/subtasks": {
"get": {
"tags": ["Tasks"],
"summary": "List subtasks",
"description": "Returns the subtasks of a task. Requires `tasks:read` scope.",
"operationId": "listTaskSubtasks",
"parameters": [
{ "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }
],
"responses": {
"200": {
"description": "List of subtasks",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["items", "page"],
"properties": {
"items": { "type": "array", "items": { "$ref": "#/components/schemas/Task" } },
"page": { "$ref": "#/components/schemas/PageInfo" }
}
}
}
}
},
"401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
"403": { "description": "Insufficient scope", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
"404": { "description": "Task not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }
}
}
},
"/tasks/{id}/dependencies": {
"get": {
"tags": ["Tasks"],
"summary": "List task blockers",
"description": "Returns tasks that block this task from being completed. Requires `tasks:read` scope.",
"operationId": "listTaskBlockers",
"parameters": [
{ "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }
],
"responses": {
"200": {
"description": "List of blocking tasks",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["items", "page"],
"properties": {
"items": { "type": "array", "items": { "$ref": "#/components/schemas/Task" } },
"page": { "$ref": "#/components/schemas/PageInfo" }
}
}
}
}
},
"401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
"403": { "description": "Insufficient scope", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
"404": { "description": "Task not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }
}
},
"post": {
"tags": ["Tasks"],
"summary": "Add dependency",
"description": "Adds a dependency: the specified task blocks this task. Requires `tasks:write` scope.",
"operationId": "addTaskDependency",
"parameters": [
{ "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Task ID (blocked task)" }
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["blocks_task_id"],
"properties": {
"blocks_task_id": { "type": "string", "format": "uuid", "description": "Task that blocks this one" }
}
}
}
}
},
"responses": {
"200": { "description": "Dependency added", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OkResponse" } } } },
"400": { "description": "Validation error (e.g. self-dependency)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
"401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
"403": { "description": "Insufficient scope", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
"404": { "description": "Task not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
"409": { "description": "Circular dependency detected", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }
}
}
},
"/tasks/{id}/dependencies/{blocksTaskId}": {
"delete": {
"tags": ["Tasks"],
"summary": "Remove dependency",
"description": "Removes a dependency. Requires `tasks:write` scope.",
"operationId": "removeTaskDependency",
"parameters": [
{ "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Task ID (blocked task)" },
{ "name": "blocksTaskId", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Blocker task ID" }
],
"responses": {
"200": { "description": "Dependency removed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OkResponse" } } } },
"401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
"403": { "description": "Insufficient scope", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
"404": { "description": "Task not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }
}
}
},
"/tasks/{id}/reminders": {
"get": {
"tags": ["Tasks"],
"summary": "List task reminders",
"description": "Returns reminders for a task. Requires `tasks:read` scope.",
"operationId": "listTaskReminders",
"parameters": [
{ "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }
],
"responses": {
"200": {
"description": "List of reminders",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["items", "page"],
"properties": {
"items": { "type": "array", "items": { "$ref": "#/components/schemas/TaskReminder" } },
"page": { "$ref": "#/components/schemas/PageInfo" }
}
}
}
}
},
"401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
"403": { "description": "Insufficient scope", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
"404": { "description": "Task not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }
}
},
"post": {
"tags": ["Tasks"],
"summary": "Add task reminder",
"description": "Creates a reminder for a task. Requires `tasks:write` scope.",
"operationId": "addTaskReminder",
"parameters": [
{ "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["type", "scheduled_at"],
"properties": {
"type": { "type": "string", "enum": ["push", "email", "webhook", "telegram", "nostr"] },
"config": { "type": "object", "additionalProperties": true },
"scheduled_at": { "type": "string", "format": "date-time" }
}
}
}
}
},
"responses": {
"200": {
"description": "Reminder created",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["reminder"],
"properties": {
"reminder": { "$ref": "#/components/schemas/TaskReminder" }
}
}
}
}
},
"400": { "description": "Validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
"401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
"403": { "description": "Insufficient scope", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
"404": { "description": "Task not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }
}
}
},
"/tasks/{id}/reminders/{reminderId}": {
"delete": {
"tags": ["Tasks"],
"summary": "Delete task reminder",
"description": "Deletes a reminder. Requires `tasks:write` scope.",
"operationId": "deleteTaskReminder",
"parameters": [
{ "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Task ID" },
{ "name": "reminderId", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Reminder ID" }
],
"responses": {
"200": { "description": "Reminder deleted", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OkResponse" } } } },
"401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
"403": { "description": "Insufficient scope", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
"404": { "description": "Task or reminder not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }
}
}
}
}
}