Skip to main content
Retrieve all tasks in the PhotoFlow system, including their associated metadata.

Endpoint

POST /api/getUserTasks
Despite being a read operation, this endpoint uses the POST method following SvelteKit conventions.

Request Body

This endpoint does not require any request body parameters.

Response

tasks
array
An array of task objects.
tasks[].id
number
The unique identifier for the task.
tasks[].task
string
The name or title of the task.
tasks[].dueAt
string
The due date for the task in ISO 8601 format.
tasks[].additional_information
string
Additional details or notes about the task.
tasks[].status
string
The current status of the task.
tasks[].is_finished
boolean
Whether the task has been marked as finished.
tasks[].taskColumn
string
The column or category for the task.
tasks[].amount_of_comments
number
The number of comments associated with this task.
tasks[].created_at
string
The timestamp when the task was created in ISO 8601 format.

Example Request

curl -X POST http://localhost:5173/api/getUserTasks \
  -H "Content-Type: application/json"

Response Example

[
  {
    "id": 1,
    "task": "Wedding photoshoot - Johnson family",
    "dueAt": "2026-03-15T10:00:00.000Z",
    "additional_information": "Outdoor ceremony at Central Park",
    "status": "pending",
    "is_finished": false,
    "taskColumn": "1",
    "amount_of_comments": 3,
    "created_at": "2026-03-01T09:00:00.000Z"
  },
  {
    "id": 2,
    "task": "Portrait session - Smith",
    "dueAt": "2026-03-20T14:00:00.000Z",
    "additional_information": "Family of 4, studio session",
    "status": "in-progress",
    "is_finished": false,
    "taskColumn": "2",
    "amount_of_comments": 1,
    "created_at": "2026-03-02T11:30:00.000Z"
  },
  {
    "id": 3,
    "task": "Product photography - ABC Corp",
    "dueAt": "2026-03-25T09:00:00.000Z",
    "additional_information": "50 product shots, white background",
    "status": "completed",
    "is_finished": true,
    "taskColumn": "3",
    "amount_of_comments": 5,
    "created_at": "2026-02-28T15:00:00.000Z"
  }
]

Error Response

If an error occurs during the database query:
"Invalid! "
Note the trailing space in the error message - this is the actual response from the API.

Filtering and Sorting

This endpoint returns ALL tasks from the database without pagination, filtering, or sorting. If you need to filter tasks by status, column, or finished state, you’ll need to implement that logic on the client side.

Database Query

The endpoint executes a simple Prisma query:
const tasks = await prisma.tasks.findMany();
This returns all fields from the Tasks table, including the related amount_of_comments field.

Source Reference

Implementation: src/routes/api/(tasks-clients)/getUserTasks/+server.ts:5

Build docs developers (and LLMs) love