Skip to content

Admin Decomposition: Decompose V1 CRUD routes into pipeline primitives (Phase B) #86

Description

@intel352

Overview

Replace 6 V1 CRUD routes that currently delegate to admin-v1-mgmt (V1APIHandler) with declarative pipeline primitives using admin-db.

Reference: docs/ADMIN_CONFIG_DECOMPOSITION.md — Phase B
Depends on: Phase A (#85)

Routes to Decompose

All use existing tables in V1Store: companies, projects, workflows, workflow_versions.

Route Pipeline Pattern
POST /api/v1/admin/organizations/{id}/projects request_parse → validate(name) → set(uuid,now) → db_exec(INSERT projects) → json_response(201)
POST /api/v1/admin/projects/{id}/workflows Same pattern, INSERT INTO workflows
POST /api/v1/admin/workflows request_parse → validate(name,project_id,config_yaml) → set(uuid,now) → db_exec(INSERT workflows) → json_response(201)
PUT /api/v1/admin/workflows/{id} request_parse → db_query(check exists) → conditional(found?) → set(now,version_id) → db_exec(UPDATE workflows) → db_exec(INSERT workflow_versions) → db_query(get updated) → json_response(200)
POST /api/v1/admin/workflows/{id}/deploy request_parse → set(now) → db_exec(UPDATE status='active') → db_query(get workflow) → json_response(200)
POST /api/v1/admin/workflows/{id}/stop Same as deploy but status='stopped'

Pipeline Step Types Used

  • step.request_parse — path params + body
  • step.validate — required_fields strategy
  • step.set — uuid, timestamp generation
  • step.db_exec — INSERT/UPDATE against admin-db
  • step.db_query — SELECT with single mode
  • step.conditional — branching on found/not-found
  • step.json_response — HTTP response with body/body_from

Verification

  • Each route returns correct HTTP status codes
  • Data persists correctly in SQLite
  • Workflow update creates version history
  • go test ./... passes

Files to Modify

  • admin/config.yaml — replace 6 route pipelines

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions