mirror of
https://github.com/Jeuners/ECC.git
synced 2026-09-09 15:02:30 +02:00
feat: add work items CLI
This commit is contained in:
parent
8926ea925e
commit
b1e67788f7
8 changed files with 421 additions and 2 deletions
|
|
@ -450,6 +450,10 @@ function createQueryApi(db) {
|
|||
ORDER BY updated_at DESC, id DESC
|
||||
LIMIT ?
|
||||
`);
|
||||
const countWorkItemsStatement = db.prepare(`
|
||||
SELECT COUNT(*) AS total_count
|
||||
FROM work_items
|
||||
`);
|
||||
const listAllWorkItemsStatement = db.prepare(`
|
||||
SELECT *
|
||||
FROM work_items
|
||||
|
|
@ -690,6 +694,11 @@ function createQueryApi(db) {
|
|||
return row ? mapSessionRow(row) : null;
|
||||
}
|
||||
|
||||
function getWorkItemById(id) {
|
||||
const row = getWorkItemStatement.get(id);
|
||||
return row ? mapWorkItemRow(row) : null;
|
||||
}
|
||||
|
||||
function listRecentSessions(options = {}) {
|
||||
const limit = normalizeLimit(options.limit, 10);
|
||||
return {
|
||||
|
|
@ -716,6 +725,14 @@ function createQueryApi(db) {
|
|||
};
|
||||
}
|
||||
|
||||
function listWorkItems(options = {}) {
|
||||
const limit = normalizeLimit(options.limit, 20);
|
||||
return {
|
||||
totalCount: countWorkItemsStatement.get().total_count,
|
||||
items: listWorkItemsStatement.all(limit).map(mapWorkItemRow),
|
||||
};
|
||||
}
|
||||
|
||||
function getStatus(options = {}) {
|
||||
const activeLimit = normalizeLimit(options.activeLimit, 5);
|
||||
const recentSkillRunLimit = normalizeLimit(options.recentSkillRunLimit, 20);
|
||||
|
|
@ -763,6 +780,7 @@ function createQueryApi(db) {
|
|||
return {
|
||||
getSessionById,
|
||||
getSessionDetail,
|
||||
getWorkItemById,
|
||||
getStatus,
|
||||
insertDecision(decision) {
|
||||
const normalized = normalizeDecisionInput(decision);
|
||||
|
|
@ -812,6 +830,7 @@ function createQueryApi(db) {
|
|||
return normalized;
|
||||
},
|
||||
listRecentSessions,
|
||||
listWorkItems,
|
||||
upsertInstallState(installState) {
|
||||
const normalized = normalizeInstallStateInput(installState);
|
||||
assertValidEntity('installState', normalized);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue