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:
2025-12-15 19:09:00 +01:00
commit 7e27f87d6f
64 changed files with 7951 additions and 0 deletions

View File

@@ -0,0 +1,74 @@
<?php
/**
* Modèle User
*/
declare(strict_types=1);
class User
{
public static function findById(int $id): ?array
{
$db = Database::getInstance();
$stmt = $db->prepare('
SELECT id, email, name, created_at, updated_at
FROM users
WHERE id = :id
');
$stmt->execute(['id' => $id]);
$user = $stmt->fetch();
return $user ?: null;
}
public static function findByEmail(string $email): ?array
{
$db = Database::getInstance();
$stmt = $db->prepare('
SELECT id, email, name, password, created_at, updated_at
FROM users
WHERE email = :email
');
$stmt->execute(['email' => $email]);
$user = $stmt->fetch();
return $user ?: null;
}
public static function update(int $id, array $data): bool
{
$db = Database::getInstance();
$fields = [];
$params = ['id' => $id];
if (isset($data['name'])) {
$fields[] = 'name = :name';
$params['name'] = $data['name'];
}
if (isset($data['email'])) {
$fields[] = 'email = :email';
$params['email'] = $data['email'];
}
if (isset($data['password'])) {
$fields[] = 'password = :password';
$params['password'] = password_hash($data['password'], PASSWORD_DEFAULT);
}
if (empty($fields)) {
return false;
}
$sql = 'UPDATE users SET ' . implode(', ', $fields) . ' WHERE id = :id';
$stmt = $db->prepare($sql);
$stmt->execute($params);
return $stmt->rowCount() > 0;
}
}