CUB-113: Implement Core CRUD API Endpoints #40

Closed
Dex wants to merge 0 commits from agent/dex/CUB-113-crud-api into dev
Owner

Summary

Implements the full layered architecture (handler → service → repository) for the Extrudex Go backend.

Endpoints

Method Path Description
GET /api/materials List all material bases
GET /api/filaments List spools (filterable: material, finish, color, low_stock)
GET /api/filaments/{id} Get single spool with JOINed data
POST /api/filaments Create spool (with validation)
PUT /api/filaments/{id} Partial update spool
DELETE /api/filaments/{id} Soft-delete spool
GET /api/printers List all printers with type
GET /api/print-jobs List print jobs (filterable: status, printer_id)
GET /api/usage-logs List usage logs (filterable: spool_id, job_id)

Features

  • Consistent error responses: {"error": "...", "code": N}
  • Validation: color_hex regex, required fields, gram ranges
  • Pagination: all list endpoints support ?limit= and ?offset=
  • Soft delete: DELETE sets deleted_at rather than removing rows
  • JOIN queries: spools return populated material_base, finish, modifier

Checks

  • go build ./... → PASS
  • go vet ./... → PASS
## Summary Implements the full layered architecture (handler → service → repository) for the Extrudex Go backend. ## Endpoints | Method | Path | Description | |--------|------|-------------| | GET | `/api/materials` | List all material bases | | GET | `/api/filaments` | List spools (filterable: material, finish, color, low_stock) | | GET | `/api/filaments/{id}` | Get single spool with JOINed data | | POST | `/api/filaments` | Create spool (with validation) | | PUT | `/api/filaments/{id}` | Partial update spool | | DELETE | `/api/filaments/{id}` | Soft-delete spool | | GET | `/api/printers` | List all printers with type | | GET | `/api/print-jobs` | List print jobs (filterable: status, printer_id) | | GET | `/api/usage-logs` | List usage logs (filterable: spool_id, job_id) | ## Features - Consistent error responses: `{"error": "...", "code": N}` - Validation: color_hex regex, required fields, gram ranges - Pagination: all list endpoints support `?limit=` and `?offset=` - Soft delete: DELETE sets `deleted_at` rather than removing rows - JOIN queries: spools return populated material_base, finish, modifier ## Checks - `go build ./...` → PASS - `go vet ./...` → PASS
Dex added 1 commit 2026-05-06 14:26:29 -04:00
CUB-113: implement core CRUD API endpoints
Some checks failed
Dev Build / build-test (pull_request) Failing after 2m4s
fca2ef5b84
- Add dtos package with request/response structs
- Add repositories: Material, Filament, Printer, PrintJob, UsageLog
- Add services: FilamentService, PrinterService, PrintJobService
- Add handlers for all 5 resources with consistent error responses
- Wire all endpoints into Chi router under /api
- Validation on POST/PUT filament endpoints
- Filter/pagination support on list endpoints
- Soft-delete for filaments (DELETE /api/filaments/{id})
- go build ./... && go vet ./... → PASS
Otto reviewed 2026-05-06 20:56:16 -04:00
Otto left a comment
Owner

APPROVED

APPROVED
Otto closed this pull request 2026-05-06 20:58:28 -04:00
Some checks failed
Dev Build / build-test (pull_request) Failing after 2m4s

Pull request closed

Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: CubeCraft-Creations/Extrudex#40