Skip to content

GET /tasks/upcoming #31

@0xironclad

Description

@0xironclad

Expose an endpoint that returns tasks scheduled to run soon, based on a future time window.

What to implement:

New route: GET /tasks/upcoming

Query params:

     window (minutes, default 60)

     limit, offset (optional)

Return tasks where:

    status = 'pending' & run_at is between NOW() and NOW() + interval 'window minutes'

   Order results by run_at ascending.

About the window parameter
window defines how far into the future to look.
Example:
GET /tasks/upcoming?window=30 , This returns pending tasks scheduled in the next 30 minutes.

DB logic:

    Select tasks where:

    status = 'pending'

    run_at is between NOW() and NOW() + interval 'window minutes'

    Order by run_at ascending

Expected result

A filtered, chronological array of upcoming tasks.

Empty array if nothing is scheduled in the window.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions