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:
129
config/routes/prokov.yaml
Normal file
129
config/routes/prokov.yaml
Normal file
@@ -0,0 +1,129 @@
|
||||
# Routes API Prokov
|
||||
# Gestion de projets et tâches
|
||||
|
||||
app: prokov
|
||||
version: "1.0"
|
||||
base_path: /api
|
||||
|
||||
# Identification par hostname
|
||||
hosts:
|
||||
- prokov.unikoffice.com
|
||||
- prokov.sogoms.com
|
||||
|
||||
# Base de données
|
||||
database:
|
||||
host: 13.23.33.4
|
||||
port: 3306
|
||||
user: prokov_user
|
||||
password_file: /secrets/prokov_db_pass
|
||||
name: prokov
|
||||
|
||||
# Authentification
|
||||
auth:
|
||||
jwt_secret_file: /secrets/prokov_jwt_secret
|
||||
jwt_expiry: 24h
|
||||
|
||||
# Routes
|
||||
routes:
|
||||
# === AUTH ===
|
||||
- path: /auth/register
|
||||
method: POST
|
||||
scenario: prokov/auth/register
|
||||
auth: false
|
||||
|
||||
- path: /auth/login
|
||||
method: POST
|
||||
scenario: prokov/auth/login
|
||||
auth: false
|
||||
|
||||
- path: /auth/logout
|
||||
method: POST
|
||||
scenario: prokov/auth/logout
|
||||
|
||||
- path: /auth/me
|
||||
method: GET
|
||||
scenario: prokov/auth/me
|
||||
|
||||
# === PROJECTS ===
|
||||
- path: /projects
|
||||
method: GET
|
||||
scenario: prokov/projects/list
|
||||
|
||||
- path: /projects
|
||||
method: POST
|
||||
scenario: prokov/projects/create
|
||||
|
||||
- path: /projects/{id}
|
||||
method: GET
|
||||
scenario: prokov/projects/show
|
||||
|
||||
- path: /projects/{id}
|
||||
method: PUT
|
||||
scenario: prokov/projects/update
|
||||
|
||||
- path: /projects/{id}
|
||||
method: DELETE
|
||||
scenario: prokov/projects/delete
|
||||
|
||||
# === TASKS ===
|
||||
- path: /tasks
|
||||
method: GET
|
||||
scenario: prokov/tasks/list
|
||||
|
||||
- path: /tasks
|
||||
method: POST
|
||||
scenario: prokov/tasks/create
|
||||
|
||||
- path: /tasks/{id}
|
||||
method: GET
|
||||
scenario: prokov/tasks/show
|
||||
|
||||
- path: /tasks/{id}
|
||||
method: PUT
|
||||
scenario: prokov/tasks/update
|
||||
|
||||
- path: /tasks/{id}
|
||||
method: DELETE
|
||||
scenario: prokov/tasks/delete
|
||||
|
||||
# === TAGS ===
|
||||
- path: /tags
|
||||
method: GET
|
||||
scenario: prokov/tags/list
|
||||
|
||||
- path: /tags
|
||||
method: POST
|
||||
scenario: prokov/tags/create
|
||||
|
||||
- path: /tags/{id}
|
||||
method: GET
|
||||
scenario: prokov/tags/show
|
||||
|
||||
- path: /tags/{id}
|
||||
method: PUT
|
||||
scenario: prokov/tags/update
|
||||
|
||||
- path: /tags/{id}
|
||||
method: DELETE
|
||||
scenario: prokov/tags/delete
|
||||
|
||||
# === STATUSES ===
|
||||
- path: /statuses
|
||||
method: GET
|
||||
scenario: prokov/statuses/list
|
||||
|
||||
- path: /statuses
|
||||
method: POST
|
||||
scenario: prokov/statuses/create
|
||||
|
||||
- path: /statuses/{id}
|
||||
method: GET
|
||||
scenario: prokov/statuses/show
|
||||
|
||||
- path: /statuses/{id}
|
||||
method: PUT
|
||||
scenario: prokov/statuses/update
|
||||
|
||||
- path: /statuses/{id}
|
||||
method: DELETE
|
||||
scenario: prokov/statuses/delete
|
||||
58
config/scenarios/prokov/auth/login.yaml
Normal file
58
config/scenarios/prokov/auth/login.yaml
Normal file
@@ -0,0 +1,58 @@
|
||||
# Scénario: Connexion utilisateur
|
||||
name: login
|
||||
version: "1.0"
|
||||
description: Authentifie un utilisateur et retourne un JWT
|
||||
|
||||
input:
|
||||
required:
|
||||
- email
|
||||
- password
|
||||
validation:
|
||||
email:
|
||||
type: string
|
||||
format: email
|
||||
password:
|
||||
type: string
|
||||
min_length: 1
|
||||
|
||||
steps:
|
||||
- id: get_user
|
||||
service: db
|
||||
action: query_one
|
||||
params:
|
||||
query: "SELECT id, email, name, password FROM users WHERE email = ?"
|
||||
args: ["{{input.email}}"]
|
||||
on_error: abort
|
||||
error_message: "Email ou mot de passe incorrect"
|
||||
error_status: 401
|
||||
|
||||
- id: verify_password
|
||||
service: auth
|
||||
action: verify_password
|
||||
params:
|
||||
hash: "{{steps.get_user.result.password}}"
|
||||
password: "{{input.password}}"
|
||||
on_error: abort
|
||||
error_message: "Email ou mot de passe incorrect"
|
||||
error_status: 401
|
||||
|
||||
- id: generate_token
|
||||
service: auth
|
||||
action: generate_jwt
|
||||
params:
|
||||
claims:
|
||||
sub: "{{steps.get_user.result.id}}"
|
||||
email: "{{steps.get_user.result.email}}"
|
||||
name: "{{steps.get_user.result.name}}"
|
||||
|
||||
output:
|
||||
status: 200
|
||||
body:
|
||||
success: true
|
||||
message: "Connexion réussie"
|
||||
data:
|
||||
token: "{{steps.generate_token.result.token}}"
|
||||
user:
|
||||
id: "{{steps.get_user.result.id}}"
|
||||
email: "{{steps.get_user.result.email}}"
|
||||
name: "{{steps.get_user.result.name}}"
|
||||
13
config/scenarios/prokov/auth/logout.yaml
Normal file
13
config/scenarios/prokov/auth/logout.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
# Scénario: Déconnexion
|
||||
name: logout
|
||||
version: "1.0"
|
||||
description: Déconnecte l'utilisateur (côté client, invalide le JWT)
|
||||
|
||||
# Avec JWT stateless, le logout est géré côté client
|
||||
# Ce endpoint existe pour la compatibilité API
|
||||
|
||||
output:
|
||||
status: 200
|
||||
body:
|
||||
success: true
|
||||
message: "Déconnexion réussie"
|
||||
22
config/scenarios/prokov/auth/me.yaml
Normal file
22
config/scenarios/prokov/auth/me.yaml
Normal file
@@ -0,0 +1,22 @@
|
||||
# Scénario: Récupérer l'utilisateur connecté
|
||||
name: me
|
||||
version: "1.0"
|
||||
description: Retourne les informations de l'utilisateur authentifié
|
||||
|
||||
steps:
|
||||
- id: get_user
|
||||
service: db
|
||||
action: query_one
|
||||
params:
|
||||
query: "SELECT id, email, name, created_at FROM users WHERE id = ?"
|
||||
args: ["{{auth.user_id}}"]
|
||||
on_error: abort
|
||||
error_message: "Utilisateur non trouvé"
|
||||
error_status: 404
|
||||
|
||||
output:
|
||||
status: 200
|
||||
body:
|
||||
success: true
|
||||
data:
|
||||
user: "{{steps.get_user.result}}"
|
||||
93
config/scenarios/prokov/auth/register.yaml
Normal file
93
config/scenarios/prokov/auth/register.yaml
Normal file
@@ -0,0 +1,93 @@
|
||||
# Scénario: Inscription utilisateur
|
||||
name: register
|
||||
version: "1.0"
|
||||
description: Crée un nouvel utilisateur
|
||||
|
||||
input:
|
||||
required:
|
||||
- email
|
||||
- password
|
||||
- name
|
||||
validation:
|
||||
email:
|
||||
type: string
|
||||
format: email
|
||||
max_length: 255
|
||||
password:
|
||||
type: string
|
||||
min_length: 6
|
||||
max_length: 255
|
||||
name:
|
||||
type: string
|
||||
min_length: 2
|
||||
max_length: 100
|
||||
|
||||
steps:
|
||||
- id: check_email
|
||||
service: db
|
||||
action: query_one
|
||||
params:
|
||||
query: "SELECT id FROM users WHERE email = ?"
|
||||
args: ["{{input.email}}"]
|
||||
on_success: abort
|
||||
error_message: "Cet email est déjà utilisé"
|
||||
error_status: 409
|
||||
|
||||
- id: hash_password
|
||||
service: auth
|
||||
action: hash_password
|
||||
params:
|
||||
password: "{{input.password}}"
|
||||
|
||||
- id: create_user
|
||||
service: db
|
||||
action: insert
|
||||
params:
|
||||
table: users
|
||||
data:
|
||||
email: "{{input.email}}"
|
||||
password: "{{steps.hash_password.result.hash}}"
|
||||
name: "{{input.name}}"
|
||||
|
||||
- id: create_default_statuses
|
||||
service: db
|
||||
action: exec
|
||||
params:
|
||||
query: |
|
||||
INSERT INTO statuses (user_id, project_id, code, name, color, position) VALUES
|
||||
(?, NULL, 10, 'Backlog', '#6B7280', 10),
|
||||
(?, NULL, 20, 'À faire', '#3B82F6', 20),
|
||||
(?, NULL, 30, 'En cours', '#F59E0B', 30),
|
||||
(?, NULL, 40, 'À tester', '#8B5CF6', 40),
|
||||
(?, NULL, 50, 'Livré', '#10B981', 50),
|
||||
(?, NULL, 60, 'Terminé', '#059669', 60),
|
||||
(?, NULL, 70, 'Archivé', '#9CA3AF', 70)
|
||||
args:
|
||||
- "{{steps.create_user.insert_id}}"
|
||||
- "{{steps.create_user.insert_id}}"
|
||||
- "{{steps.create_user.insert_id}}"
|
||||
- "{{steps.create_user.insert_id}}"
|
||||
- "{{steps.create_user.insert_id}}"
|
||||
- "{{steps.create_user.insert_id}}"
|
||||
- "{{steps.create_user.insert_id}}"
|
||||
|
||||
- id: generate_token
|
||||
service: auth
|
||||
action: generate_jwt
|
||||
params:
|
||||
claims:
|
||||
sub: "{{steps.create_user.insert_id}}"
|
||||
email: "{{input.email}}"
|
||||
name: "{{input.name}}"
|
||||
|
||||
output:
|
||||
status: 201
|
||||
body:
|
||||
success: true
|
||||
message: "Inscription réussie"
|
||||
data:
|
||||
token: "{{steps.generate_token.result.token}}"
|
||||
user:
|
||||
id: "{{steps.create_user.insert_id}}"
|
||||
email: "{{input.email}}"
|
||||
name: "{{input.name}}"
|
||||
95
config/scenarios/prokov/projects/create.yaml
Normal file
95
config/scenarios/prokov/projects/create.yaml
Normal file
@@ -0,0 +1,95 @@
|
||||
# Scénario: Créer un projet
|
||||
name: projects_create
|
||||
version: "1.0"
|
||||
description: Crée un nouveau projet
|
||||
|
||||
input:
|
||||
required:
|
||||
- name
|
||||
optional:
|
||||
- description
|
||||
- parent_id
|
||||
- position
|
||||
- tags
|
||||
defaults:
|
||||
position: 0
|
||||
validation:
|
||||
name:
|
||||
type: string
|
||||
min_length: 1
|
||||
max_length: 100
|
||||
description:
|
||||
type: string
|
||||
max_length: 65535
|
||||
parent_id:
|
||||
type: int
|
||||
position:
|
||||
type: int
|
||||
|
||||
steps:
|
||||
- id: check_parent
|
||||
service: db
|
||||
action: query_one
|
||||
condition: "{{input.parent_id != null}}"
|
||||
params:
|
||||
query: "SELECT id FROM projects WHERE id = ? AND user_id = ?"
|
||||
args: ["{{input.parent_id}}", "{{auth.user_id}}"]
|
||||
on_error: abort
|
||||
error_message: "Projet parent non trouvé"
|
||||
error_status: 422
|
||||
|
||||
- id: insert_project
|
||||
service: db
|
||||
action: insert
|
||||
params:
|
||||
table: projects
|
||||
data:
|
||||
user_id: "{{auth.user_id}}"
|
||||
parent_id: "{{input.parent_id}}"
|
||||
name: "{{input.name}}"
|
||||
description: "{{input.description}}"
|
||||
position: "{{input.position}}"
|
||||
|
||||
- id: sync_tags
|
||||
service: db
|
||||
action: exec
|
||||
condition: "{{input.tags != null && input.tags | length > 0}}"
|
||||
foreach: "{{input.tags}}"
|
||||
foreach_as: tag_id
|
||||
params:
|
||||
query: |
|
||||
INSERT INTO project_tags (project_id, tag_id)
|
||||
SELECT ?, id FROM tags WHERE id = ? AND user_id = ?
|
||||
args: ["{{steps.insert_project.insert_id}}", "{{tag_id}}", "{{auth.user_id}}"]
|
||||
|
||||
- id: get_project
|
||||
service: db
|
||||
action: query_one
|
||||
params:
|
||||
query: "SELECT * FROM projects WHERE id = ?"
|
||||
args: ["{{steps.insert_project.insert_id}}"]
|
||||
|
||||
- id: get_tags
|
||||
service: db
|
||||
action: query
|
||||
params:
|
||||
query: |
|
||||
SELECT t.id, t.name, t.color
|
||||
FROM tags t
|
||||
JOIN project_tags pt ON t.id = pt.tag_id
|
||||
WHERE pt.project_id = ?
|
||||
args: ["{{steps.insert_project.insert_id}}"]
|
||||
|
||||
output:
|
||||
status: 201
|
||||
body:
|
||||
success: true
|
||||
message: "Projet créé"
|
||||
data:
|
||||
id: "{{steps.get_project.result.id}}"
|
||||
name: "{{steps.get_project.result.name}}"
|
||||
description: "{{steps.get_project.result.description}}"
|
||||
parent_id: "{{steps.get_project.result.parent_id}}"
|
||||
position: "{{steps.get_project.result.position}}"
|
||||
created_at: "{{steps.get_project.result.created_at}}"
|
||||
tags: "{{steps.get_tags.result}}"
|
||||
36
config/scenarios/prokov/projects/delete.yaml
Normal file
36
config/scenarios/prokov/projects/delete.yaml
Normal file
@@ -0,0 +1,36 @@
|
||||
# Scénario: Supprimer un projet
|
||||
name: projects_delete
|
||||
version: "1.0"
|
||||
description: Supprime un projet (cascade sur sous-projets et tâches)
|
||||
|
||||
input:
|
||||
required:
|
||||
- id
|
||||
validation:
|
||||
id:
|
||||
type: int
|
||||
|
||||
steps:
|
||||
- id: check_project
|
||||
service: db
|
||||
action: query_one
|
||||
params:
|
||||
query: "SELECT id FROM projects WHERE id = ? AND user_id = ?"
|
||||
args: ["{{input.id}}", "{{auth.user_id}}"]
|
||||
on_error: abort
|
||||
error_message: "Projet non trouvé"
|
||||
error_status: 404
|
||||
|
||||
- id: delete_project
|
||||
service: db
|
||||
action: delete
|
||||
params:
|
||||
table: projects
|
||||
where:
|
||||
id: "{{input.id}}"
|
||||
|
||||
output:
|
||||
status: 200
|
||||
body:
|
||||
success: true
|
||||
message: "Projet supprimé"
|
||||
27
config/scenarios/prokov/projects/list.yaml
Normal file
27
config/scenarios/prokov/projects/list.yaml
Normal file
@@ -0,0 +1,27 @@
|
||||
# Scénario: Liste des projets (arborescence)
|
||||
name: projects_list
|
||||
version: "1.0"
|
||||
description: Retourne tous les projets de l'utilisateur en arborescence
|
||||
|
||||
steps:
|
||||
- id: get_projects
|
||||
service: db
|
||||
action: query
|
||||
params:
|
||||
query: |
|
||||
SELECT p.*,
|
||||
GROUP_CONCAT(t.id) as tag_ids,
|
||||
GROUP_CONCAT(t.name) as tag_names
|
||||
FROM projects p
|
||||
LEFT JOIN project_tags pt ON p.id = pt.project_id
|
||||
LEFT JOIN tags t ON pt.tag_id = t.id
|
||||
WHERE p.user_id = ?
|
||||
GROUP BY p.id
|
||||
ORDER BY p.parent_id ASC, p.position ASC, p.name ASC
|
||||
args: ["{{auth.user_id}}"]
|
||||
|
||||
output:
|
||||
status: 200
|
||||
body:
|
||||
success: true
|
||||
data: "{{steps.get_projects.result | tree}}"
|
||||
57
config/scenarios/prokov/projects/show.yaml
Normal file
57
config/scenarios/prokov/projects/show.yaml
Normal file
@@ -0,0 +1,57 @@
|
||||
# Scénario: Détail d'un projet
|
||||
name: projects_show
|
||||
version: "1.0"
|
||||
description: Retourne un projet avec ses tags et sous-projets
|
||||
|
||||
input:
|
||||
required:
|
||||
- id
|
||||
validation:
|
||||
id:
|
||||
type: int
|
||||
|
||||
steps:
|
||||
- id: get_project
|
||||
service: db
|
||||
action: query_one
|
||||
params:
|
||||
query: "SELECT * FROM projects WHERE id = ? AND user_id = ?"
|
||||
args: ["{{input.id}}", "{{auth.user_id}}"]
|
||||
on_error: abort
|
||||
error_message: "Projet non trouvé"
|
||||
error_status: 404
|
||||
|
||||
- id: get_tags
|
||||
service: db
|
||||
action: query
|
||||
params:
|
||||
query: |
|
||||
SELECT t.id, t.name, t.color
|
||||
FROM tags t
|
||||
JOIN project_tags pt ON t.id = pt.tag_id
|
||||
WHERE pt.project_id = ?
|
||||
args: ["{{input.id}}"]
|
||||
|
||||
- id: get_children
|
||||
service: db
|
||||
action: query
|
||||
params:
|
||||
query: |
|
||||
SELECT * FROM projects
|
||||
WHERE parent_id = ? AND user_id = ?
|
||||
ORDER BY position ASC, name ASC
|
||||
args: ["{{input.id}}", "{{auth.user_id}}"]
|
||||
|
||||
output:
|
||||
status: 200
|
||||
body:
|
||||
success: true
|
||||
data:
|
||||
id: "{{steps.get_project.result.id}}"
|
||||
name: "{{steps.get_project.result.name}}"
|
||||
description: "{{steps.get_project.result.description}}"
|
||||
parent_id: "{{steps.get_project.result.parent_id}}"
|
||||
position: "{{steps.get_project.result.position}}"
|
||||
created_at: "{{steps.get_project.result.created_at}}"
|
||||
tags: "{{steps.get_tags.result}}"
|
||||
children: "{{steps.get_children.result}}"
|
||||
115
config/scenarios/prokov/projects/update.yaml
Normal file
115
config/scenarios/prokov/projects/update.yaml
Normal file
@@ -0,0 +1,115 @@
|
||||
# Scénario: Modifier un projet
|
||||
name: projects_update
|
||||
version: "1.0"
|
||||
description: Met à jour un projet existant
|
||||
|
||||
input:
|
||||
required:
|
||||
- id
|
||||
optional:
|
||||
- name
|
||||
- description
|
||||
- parent_id
|
||||
- position
|
||||
- tags
|
||||
validation:
|
||||
id:
|
||||
type: int
|
||||
name:
|
||||
type: string
|
||||
min_length: 1
|
||||
max_length: 100
|
||||
description:
|
||||
type: string
|
||||
max_length: 65535
|
||||
parent_id:
|
||||
type: int
|
||||
position:
|
||||
type: int
|
||||
|
||||
steps:
|
||||
- id: get_project
|
||||
service: db
|
||||
action: query_one
|
||||
params:
|
||||
query: "SELECT * FROM projects WHERE id = ? AND user_id = ?"
|
||||
args: ["{{input.id}}", "{{auth.user_id}}"]
|
||||
on_error: abort
|
||||
error_message: "Projet non trouvé"
|
||||
error_status: 404
|
||||
|
||||
- id: check_parent
|
||||
service: db
|
||||
action: query_one
|
||||
condition: "{{input.parent_id != null && input.parent_id != input.id}}"
|
||||
params:
|
||||
query: "SELECT id FROM projects WHERE id = ? AND user_id = ?"
|
||||
args: ["{{input.parent_id}}", "{{auth.user_id}}"]
|
||||
on_error: abort
|
||||
error_message: "Projet parent invalide"
|
||||
error_status: 422
|
||||
|
||||
- id: update_project
|
||||
service: db
|
||||
action: update
|
||||
params:
|
||||
table: projects
|
||||
where:
|
||||
id: "{{input.id}}"
|
||||
data:
|
||||
name: "{{input.name ?? steps.get_project.result.name}}"
|
||||
description: "{{input.description ?? steps.get_project.result.description}}"
|
||||
parent_id: "{{input.parent_id ?? steps.get_project.result.parent_id}}"
|
||||
position: "{{input.position ?? steps.get_project.result.position}}"
|
||||
|
||||
- id: clear_tags
|
||||
service: db
|
||||
action: delete
|
||||
condition: "{{input.tags != null}}"
|
||||
params:
|
||||
table: project_tags
|
||||
where:
|
||||
project_id: "{{input.id}}"
|
||||
|
||||
- id: sync_tags
|
||||
service: db
|
||||
action: exec
|
||||
condition: "{{input.tags != null && input.tags | length > 0}}"
|
||||
foreach: "{{input.tags}}"
|
||||
foreach_as: tag_id
|
||||
params:
|
||||
query: |
|
||||
INSERT INTO project_tags (project_id, tag_id)
|
||||
SELECT ?, id FROM tags WHERE id = ? AND user_id = ?
|
||||
args: ["{{input.id}}", "{{tag_id}}", "{{auth.user_id}}"]
|
||||
|
||||
- id: get_updated
|
||||
service: db
|
||||
action: query_one
|
||||
params:
|
||||
query: "SELECT * FROM projects WHERE id = ?"
|
||||
args: ["{{input.id}}"]
|
||||
|
||||
- id: get_tags
|
||||
service: db
|
||||
action: query
|
||||
params:
|
||||
query: |
|
||||
SELECT t.id, t.name, t.color
|
||||
FROM tags t
|
||||
JOIN project_tags pt ON t.id = pt.tag_id
|
||||
WHERE pt.project_id = ?
|
||||
args: ["{{input.id}}"]
|
||||
|
||||
output:
|
||||
status: 200
|
||||
body:
|
||||
success: true
|
||||
message: "Projet mis à jour"
|
||||
data:
|
||||
id: "{{steps.get_updated.result.id}}"
|
||||
name: "{{steps.get_updated.result.name}}"
|
||||
description: "{{steps.get_updated.result.description}}"
|
||||
parent_id: "{{steps.get_updated.result.parent_id}}"
|
||||
position: "{{steps.get_updated.result.position}}"
|
||||
tags: "{{steps.get_tags.result}}"
|
||||
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}}"
|
||||
55
config/scenarios/prokov/tags/create.yaml
Normal file
55
config/scenarios/prokov/tags/create.yaml
Normal file
@@ -0,0 +1,55 @@
|
||||
# Scénario: Créer un tag
|
||||
name: tags_create
|
||||
version: "1.0"
|
||||
description: Crée un nouveau tag
|
||||
|
||||
input:
|
||||
required:
|
||||
- name
|
||||
optional:
|
||||
- color
|
||||
defaults:
|
||||
color: "#3B82F6"
|
||||
validation:
|
||||
name:
|
||||
type: string
|
||||
min_length: 1
|
||||
max_length: 50
|
||||
color:
|
||||
type: string
|
||||
max_length: 7
|
||||
|
||||
steps:
|
||||
- id: check_unique
|
||||
service: db
|
||||
action: query_one
|
||||
params:
|
||||
query: "SELECT id FROM tags WHERE user_id = ? AND name = ?"
|
||||
args: ["{{auth.user_id}}", "{{input.name}}"]
|
||||
on_success: abort
|
||||
error_message: "Ce tag existe déjà"
|
||||
error_status: 409
|
||||
|
||||
- id: insert_tag
|
||||
service: db
|
||||
action: insert
|
||||
params:
|
||||
table: tags
|
||||
data:
|
||||
user_id: "{{auth.user_id}}"
|
||||
name: "{{input.name}}"
|
||||
color: "{{input.color}}"
|
||||
|
||||
- id: get_tag
|
||||
service: db
|
||||
action: query_one
|
||||
params:
|
||||
query: "SELECT * FROM tags WHERE id = ?"
|
||||
args: ["{{steps.insert_tag.insert_id}}"]
|
||||
|
||||
output:
|
||||
status: 201
|
||||
body:
|
||||
success: true
|
||||
message: "Tag créé"
|
||||
data: "{{steps.get_tag.result}}"
|
||||
36
config/scenarios/prokov/tags/delete.yaml
Normal file
36
config/scenarios/prokov/tags/delete.yaml
Normal file
@@ -0,0 +1,36 @@
|
||||
# Scénario: Supprimer un tag
|
||||
name: tags_delete
|
||||
version: "1.0"
|
||||
description: Supprime un tag (les associations sont supprimées en cascade)
|
||||
|
||||
input:
|
||||
required:
|
||||
- id
|
||||
validation:
|
||||
id:
|
||||
type: int
|
||||
|
||||
steps:
|
||||
- id: check_tag
|
||||
service: db
|
||||
action: query_one
|
||||
params:
|
||||
query: "SELECT id FROM tags WHERE id = ? AND user_id = ?"
|
||||
args: ["{{input.id}}", "{{auth.user_id}}"]
|
||||
on_error: abort
|
||||
error_message: "Tag non trouvé"
|
||||
error_status: 404
|
||||
|
||||
- id: delete_tag
|
||||
service: db
|
||||
action: delete
|
||||
params:
|
||||
table: tags
|
||||
where:
|
||||
id: "{{input.id}}"
|
||||
|
||||
output:
|
||||
status: 200
|
||||
body:
|
||||
success: true
|
||||
message: "Tag supprimé"
|
||||
24
config/scenarios/prokov/tags/list.yaml
Normal file
24
config/scenarios/prokov/tags/list.yaml
Normal file
@@ -0,0 +1,24 @@
|
||||
# Scénario: Liste des tags
|
||||
name: tags_list
|
||||
version: "1.0"
|
||||
description: Retourne tous les tags de l'utilisateur avec compteurs
|
||||
|
||||
steps:
|
||||
- id: get_tags
|
||||
service: db
|
||||
action: query
|
||||
params:
|
||||
query: |
|
||||
SELECT t.*,
|
||||
(SELECT COUNT(*) FROM project_tags pt WHERE pt.tag_id = t.id) as project_count,
|
||||
(SELECT COUNT(*) FROM task_tags tt WHERE tt.tag_id = t.id) as task_count
|
||||
FROM tags t
|
||||
WHERE t.user_id = ?
|
||||
ORDER BY t.name ASC
|
||||
args: ["{{auth.user_id}}"]
|
||||
|
||||
output:
|
||||
status: 200
|
||||
body:
|
||||
success: true
|
||||
data: "{{steps.get_tags.result}}"
|
||||
58
config/scenarios/prokov/tags/show.yaml
Normal file
58
config/scenarios/prokov/tags/show.yaml
Normal file
@@ -0,0 +1,58 @@
|
||||
# Scénario: Détail d'un tag
|
||||
name: tags_show
|
||||
version: "1.0"
|
||||
description: Retourne un tag avec ses projets et tâches associés
|
||||
|
||||
input:
|
||||
required:
|
||||
- id
|
||||
validation:
|
||||
id:
|
||||
type: int
|
||||
|
||||
steps:
|
||||
- id: get_tag
|
||||
service: db
|
||||
action: query_one
|
||||
params:
|
||||
query: "SELECT * FROM tags WHERE id = ? AND user_id = ?"
|
||||
args: ["{{input.id}}", "{{auth.user_id}}"]
|
||||
on_error: abort
|
||||
error_message: "Tag non trouvé"
|
||||
error_status: 404
|
||||
|
||||
- id: get_projects
|
||||
service: db
|
||||
action: query
|
||||
params:
|
||||
query: |
|
||||
SELECT p.id, p.name
|
||||
FROM projects p
|
||||
JOIN project_tags pt ON p.id = pt.project_id
|
||||
WHERE pt.tag_id = ?
|
||||
ORDER BY p.name ASC
|
||||
args: ["{{input.id}}"]
|
||||
|
||||
- id: get_tasks
|
||||
service: db
|
||||
action: query
|
||||
params:
|
||||
query: |
|
||||
SELECT t.id, t.title, t.status_id, s.name as status_name
|
||||
FROM tasks t
|
||||
JOIN task_tags tt ON t.id = tt.task_id
|
||||
LEFT JOIN statuses s ON t.status_id = s.id
|
||||
WHERE tt.tag_id = ?
|
||||
ORDER BY t.created_at DESC
|
||||
args: ["{{input.id}}"]
|
||||
|
||||
output:
|
||||
status: 200
|
||||
body:
|
||||
success: true
|
||||
data:
|
||||
id: "{{steps.get_tag.result.id}}"
|
||||
name: "{{steps.get_tag.result.name}}"
|
||||
color: "{{steps.get_tag.result.color}}"
|
||||
projects: "{{steps.get_projects.result}}"
|
||||
tasks: "{{steps.get_tasks.result}}"
|
||||
68
config/scenarios/prokov/tags/update.yaml
Normal file
68
config/scenarios/prokov/tags/update.yaml
Normal file
@@ -0,0 +1,68 @@
|
||||
# Scénario: Modifier un tag
|
||||
name: tags_update
|
||||
version: "1.0"
|
||||
description: Met à jour un tag existant
|
||||
|
||||
input:
|
||||
required:
|
||||
- id
|
||||
optional:
|
||||
- name
|
||||
- color
|
||||
validation:
|
||||
id:
|
||||
type: int
|
||||
name:
|
||||
type: string
|
||||
min_length: 1
|
||||
max_length: 50
|
||||
color:
|
||||
type: string
|
||||
max_length: 7
|
||||
|
||||
steps:
|
||||
- id: get_tag
|
||||
service: db
|
||||
action: query_one
|
||||
params:
|
||||
query: "SELECT * FROM tags WHERE id = ? AND user_id = ?"
|
||||
args: ["{{input.id}}", "{{auth.user_id}}"]
|
||||
on_error: abort
|
||||
error_message: "Tag non trouvé"
|
||||
error_status: 404
|
||||
|
||||
- id: check_unique
|
||||
service: db
|
||||
action: query_one
|
||||
condition: "{{input.name != null}}"
|
||||
params:
|
||||
query: "SELECT id FROM tags WHERE user_id = ? AND name = ? AND id != ?"
|
||||
args: ["{{auth.user_id}}", "{{input.name}}", "{{input.id}}"]
|
||||
on_success: abort
|
||||
error_message: "Ce tag existe déjà"
|
||||
error_status: 409
|
||||
|
||||
- id: update_tag
|
||||
service: db
|
||||
action: update
|
||||
params:
|
||||
table: tags
|
||||
where:
|
||||
id: "{{input.id}}"
|
||||
data:
|
||||
name: "{{input.name ?? steps.get_tag.result.name}}"
|
||||
color: "{{input.color ?? steps.get_tag.result.color}}"
|
||||
|
||||
- id: get_updated
|
||||
service: db
|
||||
action: query_one
|
||||
params:
|
||||
query: "SELECT * FROM tags WHERE id = ?"
|
||||
args: ["{{input.id}}"]
|
||||
|
||||
output:
|
||||
status: 200
|
||||
body:
|
||||
success: true
|
||||
message: "Tag mis à jour"
|
||||
data: "{{steps.get_updated.result}}"
|
||||
135
config/scenarios/prokov/tasks/create.yaml
Normal file
135
config/scenarios/prokov/tasks/create.yaml
Normal file
@@ -0,0 +1,135 @@
|
||||
# Scénario: Créer une tâche
|
||||
name: tasks_create
|
||||
version: "1.0"
|
||||
description: Crée une nouvelle tâche
|
||||
|
||||
input:
|
||||
required:
|
||||
- project_id
|
||||
- status_id
|
||||
- title
|
||||
optional:
|
||||
- description
|
||||
- priority
|
||||
- date_start
|
||||
- date_end
|
||||
- time_estimated
|
||||
- time_spent
|
||||
- billing
|
||||
- position
|
||||
- tags
|
||||
defaults:
|
||||
priority: 5
|
||||
time_estimated: 0
|
||||
time_spent: 0
|
||||
billing: 0
|
||||
position: 0
|
||||
validation:
|
||||
project_id:
|
||||
type: int
|
||||
status_id:
|
||||
type: int
|
||||
title:
|
||||
type: string
|
||||
min_length: 1
|
||||
max_length: 255
|
||||
description:
|
||||
type: string
|
||||
max_length: 65535
|
||||
priority:
|
||||
type: int
|
||||
date_start:
|
||||
type: string
|
||||
format: date
|
||||
date_end:
|
||||
type: string
|
||||
format: date
|
||||
|
||||
steps:
|
||||
- id: check_project
|
||||
service: db
|
||||
action: query_one
|
||||
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: check_status
|
||||
service: db
|
||||
action: query_one
|
||||
params:
|
||||
query: "SELECT id FROM statuses WHERE id = ? AND user_id = ?"
|
||||
args: ["{{input.status_id}}", "{{auth.user_id}}"]
|
||||
on_error: abort
|
||||
error_message: "Statut invalide"
|
||||
error_status: 422
|
||||
|
||||
- id: insert_task
|
||||
service: db
|
||||
action: insert
|
||||
params:
|
||||
table: tasks
|
||||
data:
|
||||
user_id: "{{auth.user_id}}"
|
||||
project_id: "{{input.project_id}}"
|
||||
status_id: "{{input.status_id}}"
|
||||
title: "{{input.title}}"
|
||||
description: "{{input.description}}"
|
||||
priority: "{{input.priority}}"
|
||||
date_start: "{{input.date_start}}"
|
||||
date_end: "{{input.date_end}}"
|
||||
time_estimated: "{{input.time_estimated}}"
|
||||
time_spent: "{{input.time_spent}}"
|
||||
billing: "{{input.billing}}"
|
||||
position: "{{input.position}}"
|
||||
|
||||
- id: sync_tags
|
||||
service: db
|
||||
action: exec
|
||||
condition: "{{input.tags != null && input.tags | length > 0}}"
|
||||
foreach: "{{input.tags}}"
|
||||
foreach_as: tag_id
|
||||
params:
|
||||
query: |
|
||||
INSERT INTO task_tags (task_id, tag_id)
|
||||
SELECT ?, id FROM tags WHERE id = ? AND user_id = ?
|
||||
args: ["{{steps.insert_task.insert_id}}", "{{tag_id}}", "{{auth.user_id}}"]
|
||||
|
||||
- id: get_task
|
||||
service: db
|
||||
action: query_one
|
||||
params:
|
||||
query: |
|
||||
SELECT t.*, p.name as project_name, s.name as status_name, s.color as status_color
|
||||
FROM tasks t
|
||||
LEFT JOIN projects p ON t.project_id = p.id
|
||||
LEFT JOIN statuses s ON t.status_id = s.id
|
||||
WHERE t.id = ?
|
||||
args: ["{{steps.insert_task.insert_id}}"]
|
||||
|
||||
- id: get_tags
|
||||
service: db
|
||||
action: query
|
||||
params:
|
||||
query: |
|
||||
SELECT t.id, t.name, t.color
|
||||
FROM tags t
|
||||
JOIN task_tags tt ON t.id = tt.tag_id
|
||||
WHERE tt.task_id = ?
|
||||
args: ["{{steps.insert_task.insert_id}}"]
|
||||
|
||||
output:
|
||||
status: 201
|
||||
body:
|
||||
success: true
|
||||
message: "Tâche créée"
|
||||
data:
|
||||
id: "{{steps.get_task.result.id}}"
|
||||
project_id: "{{steps.get_task.result.project_id}}"
|
||||
project_name: "{{steps.get_task.result.project_name}}"
|
||||
status_id: "{{steps.get_task.result.status_id}}"
|
||||
status_name: "{{steps.get_task.result.status_name}}"
|
||||
title: "{{steps.get_task.result.title}}"
|
||||
tags: "{{steps.get_tags.result}}"
|
||||
36
config/scenarios/prokov/tasks/delete.yaml
Normal file
36
config/scenarios/prokov/tasks/delete.yaml
Normal file
@@ -0,0 +1,36 @@
|
||||
# Scénario: Supprimer une tâche
|
||||
name: tasks_delete
|
||||
version: "1.0"
|
||||
description: Supprime une tâche
|
||||
|
||||
input:
|
||||
required:
|
||||
- id
|
||||
validation:
|
||||
id:
|
||||
type: int
|
||||
|
||||
steps:
|
||||
- id: check_task
|
||||
service: db
|
||||
action: query_one
|
||||
params:
|
||||
query: "SELECT id FROM tasks WHERE id = ? AND user_id = ?"
|
||||
args: ["{{input.id}}", "{{auth.user_id}}"]
|
||||
on_error: abort
|
||||
error_message: "Tâche non trouvée"
|
||||
error_status: 404
|
||||
|
||||
- id: delete_task
|
||||
service: db
|
||||
action: delete
|
||||
params:
|
||||
table: tasks
|
||||
where:
|
||||
id: "{{input.id}}"
|
||||
|
||||
output:
|
||||
status: 200
|
||||
body:
|
||||
success: true
|
||||
message: "Tâche supprimée"
|
||||
67
config/scenarios/prokov/tasks/list.yaml
Normal file
67
config/scenarios/prokov/tasks/list.yaml
Normal file
@@ -0,0 +1,67 @@
|
||||
# Scénario: Liste des tâches
|
||||
name: tasks_list
|
||||
version: "1.0"
|
||||
description: Retourne les tâches avec filtres optionnels
|
||||
|
||||
input:
|
||||
optional:
|
||||
- project_id
|
||||
- status_id
|
||||
- tag_id
|
||||
- date_start
|
||||
- date_end
|
||||
validation:
|
||||
project_id:
|
||||
type: int
|
||||
status_id:
|
||||
type: int
|
||||
tag_id:
|
||||
type: int
|
||||
date_start:
|
||||
type: string
|
||||
format: date
|
||||
date_end:
|
||||
type: string
|
||||
format: date
|
||||
|
||||
steps:
|
||||
- id: get_tasks
|
||||
service: db
|
||||
action: query
|
||||
params:
|
||||
query: |
|
||||
SELECT t.*,
|
||||
p.name as project_name,
|
||||
s.name as status_name,
|
||||
s.color as status_color,
|
||||
GROUP_CONCAT(tg.id) as tag_ids,
|
||||
GROUP_CONCAT(tg.name) as tag_names,
|
||||
GROUP_CONCAT(tg.color) as tag_colors
|
||||
FROM tasks t
|
||||
LEFT JOIN projects p ON t.project_id = p.id
|
||||
LEFT JOIN statuses s ON t.status_id = s.id
|
||||
LEFT JOIN task_tags tt ON t.id = tt.task_id
|
||||
LEFT JOIN tags tg ON tt.tag_id = tg.id
|
||||
WHERE t.user_id = ?
|
||||
AND (? IS NULL OR t.project_id = ?)
|
||||
AND (? IS NULL OR t.status_id = ?)
|
||||
AND (? IS NULL OR t.date_start >= ?)
|
||||
AND (? IS NULL OR t.date_end <= ?)
|
||||
GROUP BY t.id
|
||||
ORDER BY t.position ASC, t.priority DESC, t.created_at DESC
|
||||
args:
|
||||
- "{{auth.user_id}}"
|
||||
- "{{input.project_id}}"
|
||||
- "{{input.project_id}}"
|
||||
- "{{input.status_id}}"
|
||||
- "{{input.status_id}}"
|
||||
- "{{input.date_start}}"
|
||||
- "{{input.date_start}}"
|
||||
- "{{input.date_end}}"
|
||||
- "{{input.date_end}}"
|
||||
|
||||
output:
|
||||
status: 200
|
||||
body:
|
||||
success: true
|
||||
data: "{{steps.get_tasks.result | parse_tags}}"
|
||||
61
config/scenarios/prokov/tasks/show.yaml
Normal file
61
config/scenarios/prokov/tasks/show.yaml
Normal file
@@ -0,0 +1,61 @@
|
||||
# Scénario: Détail d'une tâche
|
||||
name: tasks_show
|
||||
version: "1.0"
|
||||
description: Retourne une tâche avec ses tags
|
||||
|
||||
input:
|
||||
required:
|
||||
- id
|
||||
validation:
|
||||
id:
|
||||
type: int
|
||||
|
||||
steps:
|
||||
- id: get_task
|
||||
service: db
|
||||
action: query_one
|
||||
params:
|
||||
query: |
|
||||
SELECT t.*, p.name as project_name, s.name as status_name, s.color as status_color
|
||||
FROM tasks t
|
||||
LEFT JOIN projects p ON t.project_id = p.id
|
||||
LEFT JOIN statuses s ON t.status_id = s.id
|
||||
WHERE t.id = ? AND t.user_id = ?
|
||||
args: ["{{input.id}}", "{{auth.user_id}}"]
|
||||
on_error: abort
|
||||
error_message: "Tâche non trouvée"
|
||||
error_status: 404
|
||||
|
||||
- id: get_tags
|
||||
service: db
|
||||
action: query
|
||||
params:
|
||||
query: |
|
||||
SELECT t.id, t.name, t.color
|
||||
FROM tags t
|
||||
JOIN task_tags tt ON t.id = tt.tag_id
|
||||
WHERE tt.task_id = ?
|
||||
args: ["{{input.id}}"]
|
||||
|
||||
output:
|
||||
status: 200
|
||||
body:
|
||||
success: true
|
||||
data:
|
||||
id: "{{steps.get_task.result.id}}"
|
||||
project_id: "{{steps.get_task.result.project_id}}"
|
||||
project_name: "{{steps.get_task.result.project_name}}"
|
||||
status_id: "{{steps.get_task.result.status_id}}"
|
||||
status_name: "{{steps.get_task.result.status_name}}"
|
||||
status_color: "{{steps.get_task.result.status_color}}"
|
||||
title: "{{steps.get_task.result.title}}"
|
||||
description: "{{steps.get_task.result.description}}"
|
||||
priority: "{{steps.get_task.result.priority}}"
|
||||
date_start: "{{steps.get_task.result.date_start}}"
|
||||
date_end: "{{steps.get_task.result.date_end}}"
|
||||
time_estimated: "{{steps.get_task.result.time_estimated}}"
|
||||
time_spent: "{{steps.get_task.result.time_spent}}"
|
||||
billing: "{{steps.get_task.result.billing}}"
|
||||
position: "{{steps.get_task.result.position}}"
|
||||
created_at: "{{steps.get_task.result.created_at}}"
|
||||
tags: "{{steps.get_tags.result}}"
|
||||
140
config/scenarios/prokov/tasks/update.yaml
Normal file
140
config/scenarios/prokov/tasks/update.yaml
Normal file
@@ -0,0 +1,140 @@
|
||||
# Scénario: Modifier une tâche
|
||||
name: tasks_update
|
||||
version: "1.0"
|
||||
description: Met à jour une tâche existante
|
||||
|
||||
input:
|
||||
required:
|
||||
- id
|
||||
optional:
|
||||
- project_id
|
||||
- status_id
|
||||
- title
|
||||
- description
|
||||
- priority
|
||||
- date_start
|
||||
- date_end
|
||||
- time_estimated
|
||||
- time_spent
|
||||
- billing
|
||||
- position
|
||||
- tags
|
||||
validation:
|
||||
id:
|
||||
type: int
|
||||
project_id:
|
||||
type: int
|
||||
status_id:
|
||||
type: int
|
||||
title:
|
||||
type: string
|
||||
min_length: 1
|
||||
max_length: 255
|
||||
|
||||
steps:
|
||||
- id: get_task
|
||||
service: db
|
||||
action: query_one
|
||||
params:
|
||||
query: "SELECT * FROM tasks WHERE id = ? AND user_id = ?"
|
||||
args: ["{{input.id}}", "{{auth.user_id}}"]
|
||||
on_error: abort
|
||||
error_message: "Tâche non trouvée"
|
||||
error_status: 404
|
||||
|
||||
- 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: check_status
|
||||
service: db
|
||||
action: query_one
|
||||
condition: "{{input.status_id != null}}"
|
||||
params:
|
||||
query: "SELECT id FROM statuses WHERE id = ? AND user_id = ?"
|
||||
args: ["{{input.status_id}}", "{{auth.user_id}}"]
|
||||
on_error: abort
|
||||
error_message: "Statut invalide"
|
||||
error_status: 422
|
||||
|
||||
- id: update_task
|
||||
service: db
|
||||
action: update
|
||||
params:
|
||||
table: tasks
|
||||
where:
|
||||
id: "{{input.id}}"
|
||||
data:
|
||||
project_id: "{{input.project_id ?? steps.get_task.result.project_id}}"
|
||||
status_id: "{{input.status_id ?? steps.get_task.result.status_id}}"
|
||||
title: "{{input.title ?? steps.get_task.result.title}}"
|
||||
description: "{{input.description ?? steps.get_task.result.description}}"
|
||||
priority: "{{input.priority ?? steps.get_task.result.priority}}"
|
||||
date_start: "{{input.date_start ?? steps.get_task.result.date_start}}"
|
||||
date_end: "{{input.date_end ?? steps.get_task.result.date_end}}"
|
||||
time_estimated: "{{input.time_estimated ?? steps.get_task.result.time_estimated}}"
|
||||
time_spent: "{{input.time_spent ?? steps.get_task.result.time_spent}}"
|
||||
billing: "{{input.billing ?? steps.get_task.result.billing}}"
|
||||
position: "{{input.position ?? steps.get_task.result.position}}"
|
||||
|
||||
- id: clear_tags
|
||||
service: db
|
||||
action: delete
|
||||
condition: "{{input.tags != null}}"
|
||||
params:
|
||||
table: task_tags
|
||||
where:
|
||||
task_id: "{{input.id}}"
|
||||
|
||||
- id: sync_tags
|
||||
service: db
|
||||
action: exec
|
||||
condition: "{{input.tags != null && input.tags | length > 0}}"
|
||||
foreach: "{{input.tags}}"
|
||||
foreach_as: tag_id
|
||||
params:
|
||||
query: |
|
||||
INSERT INTO task_tags (task_id, tag_id)
|
||||
SELECT ?, id FROM tags WHERE id = ? AND user_id = ?
|
||||
args: ["{{input.id}}", "{{tag_id}}", "{{auth.user_id}}"]
|
||||
|
||||
- id: get_updated
|
||||
service: db
|
||||
action: query_one
|
||||
params:
|
||||
query: |
|
||||
SELECT t.*, p.name as project_name, s.name as status_name, s.color as status_color
|
||||
FROM tasks t
|
||||
LEFT JOIN projects p ON t.project_id = p.id
|
||||
LEFT JOIN statuses s ON t.status_id = s.id
|
||||
WHERE t.id = ?
|
||||
args: ["{{input.id}}"]
|
||||
|
||||
- id: get_tags
|
||||
service: db
|
||||
action: query
|
||||
params:
|
||||
query: |
|
||||
SELECT t.id, t.name, t.color
|
||||
FROM tags t
|
||||
JOIN task_tags tt ON t.id = tt.tag_id
|
||||
WHERE tt.task_id = ?
|
||||
args: ["{{input.id}}"]
|
||||
|
||||
output:
|
||||
status: 200
|
||||
body:
|
||||
success: true
|
||||
message: "Tâche mise à jour"
|
||||
data:
|
||||
id: "{{steps.get_updated.result.id}}"
|
||||
title: "{{steps.get_updated.result.title}}"
|
||||
status_name: "{{steps.get_updated.result.status_name}}"
|
||||
tags: "{{steps.get_tags.result}}"
|
||||
29
config/sogoctl.yaml
Normal file
29
config/sogoctl.yaml
Normal file
@@ -0,0 +1,29 @@
|
||||
# Configuration du superviseur sogoctl
|
||||
|
||||
supervisor:
|
||||
health_interval: 10s
|
||||
restart_delay: 2s
|
||||
max_restarts: 5
|
||||
|
||||
services:
|
||||
sogoms-db:
|
||||
binary: /opt/sogoms/bin/sogoms-db
|
||||
args:
|
||||
- "-config"
|
||||
- "/config"
|
||||
- "-socket"
|
||||
- "/run/sogoms-db.1.sock"
|
||||
health_socket: /run/sogoms-db.1.sock
|
||||
|
||||
sogoway:
|
||||
binary: /opt/sogoms/bin/sogoway
|
||||
args:
|
||||
- "-config"
|
||||
- "/config"
|
||||
- "-port"
|
||||
- "8080"
|
||||
- "-db-socket"
|
||||
- "/run/sogoms-db.1.sock"
|
||||
health_url: http://localhost:8080/health
|
||||
depends_on:
|
||||
- sogoms-db
|
||||
Reference in New Issue
Block a user