Deploy from Lumerel

This commit is contained in:
Lumerel Deploy
2026-02-16 23:47:37 +00:00
commit 8e01be1fcd
20 changed files with 1156 additions and 0 deletions

30
src/Models/Task.php Normal file
View File

@@ -0,0 +1,30 @@
<?php
namespace App\Models;
require_once __DIR__ . '/../../db.php';
class Task {
private $pdo;
public function __construct() {
global $pdo;
$this->pdo = $pdo;
}
public function create($name, $description, $projectId, $userId, $status = 'created') {
$stmt = $this->pdo->prepare("INSERT INTO tasks (name, description, project_id, user_id, status) VALUES (?, ?, ?, ?, ?)");
$stmt->execute([$name, $description, $projectId, $userId, $status]);
return $this->pdo->lastInsertId();
}
public function getProjectTasks($projectId) {
$stmt = $this->pdo->prepare("SELECT * FROM tasks WHERE project_id = ? ORDER BY created_at DESC");
$stmt->execute([$projectId]);
return $stmt->fetchAll();
}
public function updateTaskStatus($taskId, $status) {
$stmt = $this->pdo->prepare("UPDATE tasks SET status = ? WHERE id = ?");
return $stmt->execute([$status, $taskId]);
}
}