mahdahar 282c642da6 feat: add OpenSpec workflow, Serena integration, User API, and Specimen delete endpoint
- Add OpenSpec experimental workflow with commands (opsx-apply, opsx-archive, opsx-explore, opsx-propose)
- Add Serena memory system for project context
- Implement User API (UserController, UserModel, routes)
- Add Specimen delete endpoint
- Update Test definitions and Routes
- Sync API documentation (OpenAPI)
- Archive completed 2026-03-08-backend-specs change
2026-03-09 07:00:12 +07:00

2.0 KiB

Backend Implementation - Quick Reference

Files to Create

  1. app/Controllers/User/UserController.php

    • Copy from: code-templates/UserController.php
    • Creates: Full CRUD for users
  2. app/Models/User/UserModel.php

    • Copy from: code-templates/UserModel.php
    • Creates: User database model

Files to Modify

  1. app/Controllers/Specimen/SpecimenController.php

    • Add method from: code-templates/SpecimenController-delete-method.php
    • Adds: Delete specimen functionality
  2. app/Config/Routes.php

    • Add routes from: code-templates/Routes-additions.php
    • Adds: User routes + Specimen delete route

Database Migration

Run this SQL if users table doesn't exist:

CREATE TABLE IF NOT EXISTS users (
    UserID INT AUTO_INCREMENT PRIMARY KEY,
    Username VARCHAR(50) NOT NULL UNIQUE,
    Email VARCHAR(100) NOT NULL,
    Name VARCHAR(100),
    Role VARCHAR(50),
    Department VARCHAR(100),
    IsActive BOOLEAN DEFAULT TRUE,
    CreatedAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    UpdatedAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    DelDate TIMESTAMP NULL,
    INDEX idx_username (Username),
    INDEX idx_email (Email)
);

Testing Commands

# Specimen Delete
curl -X DELETE http://localhost:8000/api/specimen/1

# Users API
curl http://localhost:8000/api/users
curl http://localhost:8000/api/users/1
curl -X POST http://localhost:8000/api/users \
  -H "Content-Type: application/json" \
  -d '{"Username":"test","Email":"test@test.com","Name":"Test User"}'
curl -X PATCH http://localhost:8000/api/users \
  -H "Content-Type: application/json" \
  -d '{"UserID":1,"Name":"Updated"}'
curl -X DELETE http://localhost:8000/api/users/1

Timeline Estimate

  • Specimen Delete: 15 minutes (just add route + method)
  • User API: 1-2 hours (new controller + model + routes)
  • Testing: 30 minutes

Total: ~2-3 hours

Questions?

See the detailed specs:

  • specimen-delete.md - Full specimen delete specification
  • user-api.md - Complete user API specification with examples