Add task priority field

Introduce a rank-style priority on tasks, scoped by
(organization_id, state). New tasks auto-assign the next
priority. Reordering uses the same CTE-based algorithm as
trust center references and compliance external URLs.
Exposed through GraphQL, MCP, and the PRIORITY order field.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2026-03-26 19:05:13 +01:00
parent 72a48ff6b1
commit 257cbcf826
10 changed files with 234 additions and 51 deletions

View File

@@ -499,6 +499,7 @@ enum MeasureOrderField
enum TaskOrderField
@goModel(model: "go.probo.inc/probo/pkg/coredata.TaskOrderField") {
PRIORITY
CREATED_AT
}
@@ -2392,6 +2393,7 @@ type Task implements Node {
name: String!
description: String
state: TaskState!
priority: Int!
timeEstimate: Duration
deadline: Datetime
assignedTo: Profile @goField(forceResolver: true)
@@ -4211,6 +4213,7 @@ input UpdateTaskInput {
name: String
description: String @goField(omittable: true)
state: TaskState
priority: Int
timeEstimate: Duration @goField(omittable: true)
deadline: Datetime @goField(omittable: true)
assignedToId: ID @goField(omittable: true)

View File

@@ -70,6 +70,7 @@ func NewTask(t *coredata.Task) *Task {
Name: t.Name,
Description: t.Description,
State: t.State,
Priority: t.Priority,
TimeEstimate: t.TimeEstimate,
Deadline: t.Deadline,
CreatedAt: t.CreatedAt,

View File

@@ -3766,6 +3766,7 @@ func (r *mutationResolver) UpdateTask(ctx context.Context, input types.UpdateTas
Name: input.Name,
Description: gqlutils.UnwrapOmittable(input.Description),
State: input.State,
Priority: input.Priority,
TimeEstimate: gqlutils.UnwrapOmittable(input.TimeEstimate),
Deadline: gqlutils.UnwrapOmittable(input.Deadline),
AssignedToID: gqlutils.UnwrapOmittable(input.AssignedToID),

View File

@@ -1904,6 +1904,7 @@ func (r *Resolver) UpdateTaskTool(ctx context.Context, req *mcp.CallToolRequest,
Name: input.Name,
Description: UnwrapOmittable(input.Description),
State: input.State,
Priority: input.Priority,
TimeEstimate: UnwrapOmittable(input.TimeEstimate),
Deadline: UnwrapOmittable(input.Deadline),
AssignedToID: UnwrapOmittable(input.AssignedToID),

View File

@@ -4619,6 +4619,7 @@ components:
TaskOrderField:
type: string
enum:
- PRIORITY
- CREATED_AT
go.probo.inc/mcpgen/type: go.probo.inc/probo/pkg/coredata.TaskOrderField
@@ -4642,6 +4643,7 @@ components:
- organization_id
- name
- state
- priority
- created_at
- updated_at
properties:
@@ -4671,6 +4673,9 @@ components:
state:
$ref: "#/components/schemas/TaskState"
description: Task state
priority:
type: integer
description: Task priority within state
time_estimate:
anyOf:
- $ref: "#/components/schemas/Duration"
@@ -4822,6 +4827,9 @@ components:
- type: "null"
description: No state
description: Task state
priority:
type: integer
description: Task priority within state
time_estimate:
anyOf:
- $ref: "#/components/schemas/Duration"

View File

@@ -25,6 +25,7 @@ func NewTask(t *coredata.Task) *Task {
Name: t.Name,
Description: t.Description,
State: t.State,
Priority: t.Priority,
TimeEstimate: t.TimeEstimate,
CreatedAt: t.CreatedAt,
UpdatedAt: t.UpdatedAt,