feat(projects): gather the cards one member carries

A board answers "where does the work stand". Nobody opens a dashboard to
ask that first: they ask what is on them today, and once the work is
spread over several boards no single board can answer it.

The cards assigned to a member are now listed on a page of their own,
grouped by deadline, with a counter on the sidebar entry — a page you
have to open to know whether it needs you is a page you stop opening.
The column travels with each card, so finishing one from the list is a
single move rather than a detour through its board.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
nocodeandClaude Opus 5 committed 2026-09-24 18:45:03 +02:00
1 parent d2256e2211
commit fcc82d82d6
6 files changed
+732 -6

No files matched your search

+53
View File
@@ -13,8 +13,10 @@ import {
getCard,
getColumn,
getOrgBoard,
listAssignees,
listBoards,
listCards,
listCardsForAssignee,
listColumns,
moveCard,
removeBoard,
@@ -77,6 +79,18 @@ const publicColumn = (column) => ({
isDone: column.is_done,
});
/** A card seen from outside its board: it has to say where it comes from (M19). */
const publicTask = (card) => ({
...publicCard(card),
boardId: card.board_id,
boardName: card.board_name,
boardScope: card.board_scope,
repository: card.repository,
columnName: card.column_name,
isDone: card.column_is_done,
doneColumnId: card.done_column_id ?? null,
});
function board(id) {
const found = getBoard(Number.parseInt(id, 10));
if (!found || found.guild_id !== guildId()) throw notFound('Tableau introuvable.');
@@ -150,6 +164,45 @@ async function announce(client, { board: owner, card, action, actor, column }) {
}
export function registerProjectRoutes(router) {
// --- My tasks --------------------------------------------------------------
/**
* What one member carries, across every board (M19).
*
* The boards answer « where does the work stand ». This answers « what am I
* on », which is the question someone actually opens a dashboard with, and no
* board alone can answer it once the work is spread over several.
*/
router.get(
'/api/me/tasks',
async ({ query, actor }) => {
const assigneeId = String(query.get('assignee') ?? '').trim() || actor.userId;
if (!assigneeId) throw badRequest('Aucun membre à qui rattacher des cartes.');
const cards = listCardsForAssignee(guildId(), assigneeId);
const today = new Date().toISOString().slice(0, 10);
const open = cards.filter((entry) => !entry.column_is_done);
const dated = (entry, test) => entry.due_at && test(String(entry.due_at).slice(0, 10));
return {
assigneeId,
self: assigneeId === actor.userId,
assignees: listAssignees(guildId()),
counts: {
total: cards.length,
open: open.length,
done: cards.length - open.length,
overdue: open.filter((entry) => dated(entry, (due) => due < today)).length,
dueToday: open.filter((entry) => dated(entry, (due) => due === today)).length,
},
cards: cards.map(publicTask),
// Resolving costs a round trip to the forge, which the sidebar counter
// has no use for — it asks for the numbers and skips it.
issues: query.get('issues') === '0' ? {} : await resolveIssues(cards),
};
},
{ access: ACCESS_LEVELS.STAFF },
);
// --- Boards ----------------------------------------------------------------
router.get(
'/api/projects',