Tasks

A task is a piece of work with a deadline, an owner and a status, raised by whoever raises it and resolved by whoever is assigned. The module promises that a breached deadline is a recorded fact and not an opinion: a task created past its deadline is breached on arrival, and a sweep marks every other breach within a minute. It is the exemplar every later module copied. The module is modules/task; this page states nothing that tree does not.

The map

Open the map full screen · source features/task in the record

What it promises

Entity

Task in contracts/task.go: a title, a status (open, acknowledged, in_progress, resolved, closed), a priority (low to critical), a deadline, an assignee, and the SLA fields a command owns.

Events

task.task.created, task.task.updated, task.task.deleted from the generated routes; task.assigned, task.resolved from the commands; task.sla_breached from the create hook and the sweep.

Permissions

task:read — the list, the reads and the navigation entry; task:update — the writes and the three commands.

Service

contracts.Service: Assign, Resolve, CheckSLA; the fake and the conformance suite live in contracts/tasktest/.

Routes and screens

Method Path Does Authorization Publishes

GET

/api/v1/task/tasks

List tasks

task:read

POST

/api/v1/task/tasks

Create a task

task:update

task.task.created, task.sla_breached

GET

/api/v1/task/tasks/{id}

Read a task

task:read

PATCH

/api/v1/task/tasks/{id}

Update a task

task:update

task.task.updated, task.sla_breached

DELETE

/api/v1/task/tasks/{id}

Delete a task

task:update

task.task.deleted, task.sla_breached

POST

/api/v1/task/tasks/{id}/assign

Assign a task

task:update

task.assigned

POST

/api/v1/task/tasks/{id}/check-sla

Check a task’s SLA

task:update

task.sla_breached

POST

/api/v1/task/tasks/{id}/resolve

Resolve a task

task:update

task.resolved

  • The first five are what rest.Spec.Mount registers, with soft delete. The three commands exist because assigneeId, slaBreached, resolvedAt and resolution are Immutable to a PATCH: setting an assignee has to move the status and publish task.assigned, and nothing may forge a breach.

  • Screens: the generated list, detail and forms under /admin/task/tasks, and the navigation entry "Tasks" for anyone with task:read. Hand-written pages: none.

Authorization

Authorization Who passes Routes

task:read

a member of the tenant

task-list, task-read

task:update

a member of the tenant

task-create, task-update, task-delete, task-assign, task-check-sla, task-resolve

Events, jobs and subscriptions

Event Published by Handled by

task.task.created

task-create

audit (every event)

task.task.updated

task-update

audit (every event)

task.task.deleted

task-delete

audit (every event)

task.assigned

task-assign

audit (every event)

task.resolved

task-resolve

audit (every event)

task.sla_breached

task-create, task-update, task-delete, task-check-sla

audit (every event)

  • task.sla_breached also comes from the sweep; HookEvents declares it on the create operation so the boot gate can check it.

  • Jobs: SLASweep, every minute unless Deps.SweepEvery says otherwise, through jobs.PerTenant, marking every task whose deadline has passed.

  • Subscriptions: none, written out as a decision: a task is raised by whoever raises it.

What it needs

Deps field

Interface

Supplied by

Tenants

jobs.TenantLister

the tenant module’s Active lister, passed in apps/platformkit/modules.go

SweepEvery

time.Duration

zero, meaning a minute; a test sets it lower

Configuration: none.

Who uses it

  • No module takes its contracts; the tests and the reference application do.

  • The admin and the native shell reach it through httpx.Resource, not through contracts/.

Verification

  • go test ./modules/task/…​ — the fake and the real service pass one conformance suite; the internal tests cover the service and the handlers, including a breach on arrival.

  • make e2e signs in, creates a task through the generated form and finds it in the list (e2e/admin-tasks.spec.ts).

  • Not proven: the sweep against a live NATS fleet; the journey uses the combined role.