Initial commit - SOGOMS v1.0.0
- sogoctl: supervisor avec health checks et restart auto - sogoway: gateway HTTP, auth JWT, routing par hostname - sogoms-db: microservice MariaDB avec pool par application - Protocol IPC Unix socket JSON length-prefixed - Config YAML multi-application (prokov) - Deploy script pour container Alpine gw3 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
68
config/scenarios/prokov/statuses/create.yaml
Normal file
68
config/scenarios/prokov/statuses/create.yaml
Normal file
@@ -0,0 +1,68 @@
|
||||
# Scénario: Créer un statut
|
||||
name: statuses_create
|
||||
version: "1.0"
|
||||
description: Crée un nouveau statut
|
||||
|
||||
input:
|
||||
required:
|
||||
- code
|
||||
- name
|
||||
optional:
|
||||
- color
|
||||
- project_id
|
||||
- position
|
||||
defaults:
|
||||
color: "#6B7280"
|
||||
validation:
|
||||
code:
|
||||
type: int
|
||||
name:
|
||||
type: string
|
||||
min_length: 1
|
||||
max_length: 50
|
||||
color:
|
||||
type: string
|
||||
max_length: 7
|
||||
project_id:
|
||||
type: int
|
||||
position:
|
||||
type: int
|
||||
|
||||
steps:
|
||||
- id: check_project
|
||||
service: db
|
||||
action: query_one
|
||||
condition: "{{input.project_id != null}}"
|
||||
params:
|
||||
query: "SELECT id FROM projects WHERE id = ? AND user_id = ?"
|
||||
args: ["{{input.project_id}}", "{{auth.user_id}}"]
|
||||
on_error: abort
|
||||
error_message: "Projet invalide"
|
||||
error_status: 422
|
||||
|
||||
- id: insert_status
|
||||
service: db
|
||||
action: insert
|
||||
params:
|
||||
table: statuses
|
||||
data:
|
||||
user_id: "{{auth.user_id}}"
|
||||
project_id: "{{input.project_id}}"
|
||||
code: "{{input.code}}"
|
||||
name: "{{input.name}}"
|
||||
color: "{{input.color}}"
|
||||
position: "{{input.position ?? input.code}}"
|
||||
|
||||
- id: get_status
|
||||
service: db
|
||||
action: query_one
|
||||
params:
|
||||
query: "SELECT * FROM statuses WHERE id = ?"
|
||||
args: ["{{steps.insert_status.insert_id}}"]
|
||||
|
||||
output:
|
||||
status: 201
|
||||
body:
|
||||
success: true
|
||||
message: "Statut créé"
|
||||
data: "{{steps.get_status.result}}"
|
||||
51
config/scenarios/prokov/statuses/delete.yaml
Normal file
51
config/scenarios/prokov/statuses/delete.yaml
Normal file
@@ -0,0 +1,51 @@
|
||||
# Scénario: Supprimer un statut
|
||||
name: statuses_delete
|
||||
version: "1.0"
|
||||
description: Supprime un statut (si aucune tâche ne l'utilise)
|
||||
|
||||
input:
|
||||
required:
|
||||
- id
|
||||
validation:
|
||||
id:
|
||||
type: int
|
||||
|
||||
steps:
|
||||
- id: check_status
|
||||
service: db
|
||||
action: query_one
|
||||
params:
|
||||
query: "SELECT id FROM statuses WHERE id = ? AND user_id = ?"
|
||||
args: ["{{input.id}}", "{{auth.user_id}}"]
|
||||
on_error: abort
|
||||
error_message: "Statut non trouvé"
|
||||
error_status: 404
|
||||
|
||||
- id: count_tasks
|
||||
service: db
|
||||
action: query_one
|
||||
params:
|
||||
query: "SELECT COUNT(*) as count FROM tasks WHERE status_id = ?"
|
||||
args: ["{{input.id}}"]
|
||||
|
||||
- id: check_usage
|
||||
service: system
|
||||
action: assert
|
||||
params:
|
||||
condition: "{{steps.count_tasks.result.count == 0}}"
|
||||
error_message: "Impossible de supprimer : {{steps.count_tasks.result.count}} tâche(s) utilisent ce statut"
|
||||
error_status: 409
|
||||
|
||||
- id: delete_status
|
||||
service: db
|
||||
action: delete
|
||||
params:
|
||||
table: statuses
|
||||
where:
|
||||
id: "{{input.id}}"
|
||||
|
||||
output:
|
||||
status: 200
|
||||
body:
|
||||
success: true
|
||||
message: "Statut supprimé"
|
||||
44
config/scenarios/prokov/statuses/list.yaml
Normal file
44
config/scenarios/prokov/statuses/list.yaml
Normal file
@@ -0,0 +1,44 @@
|
||||
# Scénario: Liste des statuts
|
||||
name: statuses_list
|
||||
version: "1.0"
|
||||
description: Retourne les statuts avec filtres optionnels
|
||||
|
||||
input:
|
||||
optional:
|
||||
- project_id
|
||||
- global
|
||||
validation:
|
||||
project_id:
|
||||
type: int
|
||||
global:
|
||||
type: bool
|
||||
|
||||
steps:
|
||||
- id: get_statuses
|
||||
service: db
|
||||
action: query
|
||||
params:
|
||||
query: |
|
||||
SELECT s.*,
|
||||
(SELECT COUNT(*) FROM tasks t WHERE t.status_id = s.id) as task_count
|
||||
FROM statuses s
|
||||
WHERE s.user_id = ?
|
||||
AND (
|
||||
(? IS NOT NULL AND (s.project_id = ? OR s.project_id IS NULL))
|
||||
OR (? IS NOT NULL AND s.project_id IS NULL)
|
||||
OR (? IS NULL AND ? IS NULL)
|
||||
)
|
||||
ORDER BY s.position ASC, s.code ASC
|
||||
args:
|
||||
- "{{auth.user_id}}"
|
||||
- "{{input.project_id}}"
|
||||
- "{{input.project_id}}"
|
||||
- "{{input.global}}"
|
||||
- "{{input.project_id}}"
|
||||
- "{{input.global}}"
|
||||
|
||||
output:
|
||||
status: 200
|
||||
body:
|
||||
success: true
|
||||
data: "{{steps.get_statuses.result}}"
|
||||
42
config/scenarios/prokov/statuses/show.yaml
Normal file
42
config/scenarios/prokov/statuses/show.yaml
Normal file
@@ -0,0 +1,42 @@
|
||||
# Scénario: Détail d'un statut
|
||||
name: statuses_show
|
||||
version: "1.0"
|
||||
description: Retourne un statut avec le nombre de tâches
|
||||
|
||||
input:
|
||||
required:
|
||||
- id
|
||||
validation:
|
||||
id:
|
||||
type: int
|
||||
|
||||
steps:
|
||||
- id: get_status
|
||||
service: db
|
||||
action: query_one
|
||||
params:
|
||||
query: "SELECT * FROM statuses WHERE id = ? AND user_id = ?"
|
||||
args: ["{{input.id}}", "{{auth.user_id}}"]
|
||||
on_error: abort
|
||||
error_message: "Statut non trouvé"
|
||||
error_status: 404
|
||||
|
||||
- id: count_tasks
|
||||
service: db
|
||||
action: query_one
|
||||
params:
|
||||
query: "SELECT COUNT(*) as count FROM tasks WHERE status_id = ?"
|
||||
args: ["{{input.id}}"]
|
||||
|
||||
output:
|
||||
status: 200
|
||||
body:
|
||||
success: true
|
||||
data:
|
||||
id: "{{steps.get_status.result.id}}"
|
||||
code: "{{steps.get_status.result.code}}"
|
||||
name: "{{steps.get_status.result.name}}"
|
||||
color: "{{steps.get_status.result.color}}"
|
||||
project_id: "{{steps.get_status.result.project_id}}"
|
||||
position: "{{steps.get_status.result.position}}"
|
||||
task_count: "{{steps.count_tasks.result.count}}"
|
||||
65
config/scenarios/prokov/statuses/update.yaml
Normal file
65
config/scenarios/prokov/statuses/update.yaml
Normal file
@@ -0,0 +1,65 @@
|
||||
# Scénario: Modifier un statut
|
||||
name: statuses_update
|
||||
version: "1.0"
|
||||
description: Met à jour un statut existant
|
||||
|
||||
input:
|
||||
required:
|
||||
- id
|
||||
optional:
|
||||
- code
|
||||
- name
|
||||
- color
|
||||
- position
|
||||
validation:
|
||||
id:
|
||||
type: int
|
||||
code:
|
||||
type: int
|
||||
name:
|
||||
type: string
|
||||
min_length: 1
|
||||
max_length: 50
|
||||
color:
|
||||
type: string
|
||||
max_length: 7
|
||||
position:
|
||||
type: int
|
||||
|
||||
steps:
|
||||
- id: get_status
|
||||
service: db
|
||||
action: query_one
|
||||
params:
|
||||
query: "SELECT * FROM statuses WHERE id = ? AND user_id = ?"
|
||||
args: ["{{input.id}}", "{{auth.user_id}}"]
|
||||
on_error: abort
|
||||
error_message: "Statut non trouvé"
|
||||
error_status: 404
|
||||
|
||||
- id: update_status
|
||||
service: db
|
||||
action: update
|
||||
params:
|
||||
table: statuses
|
||||
where:
|
||||
id: "{{input.id}}"
|
||||
data:
|
||||
code: "{{input.code ?? steps.get_status.result.code}}"
|
||||
name: "{{input.name ?? steps.get_status.result.name}}"
|
||||
color: "{{input.color ?? steps.get_status.result.color}}"
|
||||
position: "{{input.position ?? steps.get_status.result.position}}"
|
||||
|
||||
- id: get_updated
|
||||
service: db
|
||||
action: query_one
|
||||
params:
|
||||
query: "SELECT * FROM statuses WHERE id = ?"
|
||||
args: ["{{input.id}}"]
|
||||
|
||||
output:
|
||||
status: 200
|
||||
body:
|
||||
success: true
|
||||
message: "Statut mis à jour"
|
||||
data: "{{steps.get_updated.result}}"
|
||||
Reference in New Issue
Block a user