0xironclad / 0xironclad/Task-Scheduler-API

GET /tasks/upcoming

未关闭 适合新手
#31 0 条评论 0 个 reaction 已指派 1 人 已被 @0xironclad 认领 在 GitHub 查看
api good first issue
主要语言
TypeScript
星标
0
派生
2
PR 合并指标
30 天内没有已合并 PR

描述

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.

贡献指南

这个仓库没有索引到贡献指南

调研方向

在代码库中查找现有的任务路由,可能在 routes/ 或 controllers/ 目录中。需要在那里添加新的 GET /tasks/upcoming 端点,使用描述的过滤器(status='pending',run_at 在窗口内)查询 tasks 表。检查其他端点如何处理查询参数和数据库查询,以遵循项目的模式。通过运行服务器并使用不同的 window 值调用端点进行测试。

由索引模型根据 Issue 内容生成。

评估

技术栈
express, nodejs, postgresql, typescript
领域
api, backend
Issue 类型
功能
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
描述清楚
新手友好度
70/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。