reset to setup module state
Remove Task Manager implementation to match `# Setup module` in module.md. Backend src/ reduced to Kernel.php + empty Entity/, all migrations deleted, database dropped and recreated. Frontend components/views/services/stores removed, App.vue/router/style.css reduced to skeletons. CLAUDE.md shortened to Setup-stand. Old backend/plan.md, plan2.md removed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,61 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Api;
|
||||
|
||||
use App\DTO\Request\CreateCategoryRequest;
|
||||
use App\DTO\Request\UpdateCategoryRequest;
|
||||
use App\Entity\Category;
|
||||
use App\Repository\CategoryRepository;
|
||||
use App\Service\CategoryManager;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
#[Route('/api/categories', name: 'categories.')]
|
||||
class CategoryController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private CategoryRepository $categoryRepository,
|
||||
private CategoryManager $categoryManager,
|
||||
) {}
|
||||
|
||||
#[Route('', name: 'index', methods: ['GET'])]
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
$categories = $this->categoryRepository->findAll();
|
||||
|
||||
return $this->json($categories, context: ['groups' => ['category:read']]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'show', methods: ['GET'])]
|
||||
public function show(Category $category): JsonResponse
|
||||
{
|
||||
return $this->json($category, context: ['groups' => ['category:read']]);
|
||||
}
|
||||
|
||||
#[Route('', name: 'create', methods: ['POST'])]
|
||||
public function create(#[MapRequestPayload] CreateCategoryRequest $dto): JsonResponse
|
||||
{
|
||||
$category = $this->categoryManager->createCategory($dto);
|
||||
|
||||
return $this->json($category, Response::HTTP_CREATED, context: ['groups' => ['category:read']]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'update', methods: ['PUT'])]
|
||||
public function update(#[MapRequestPayload] UpdateCategoryRequest $dto, Category $category): JsonResponse
|
||||
{
|
||||
$category = $this->categoryManager->updateCategory($category, $dto);
|
||||
|
||||
return $this->json($category, context: ['groups' => ['category:read']]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'delete', methods: ['DELETE'])]
|
||||
public function delete(Category $category): JsonResponse
|
||||
{
|
||||
$this->categoryManager->deleteCategory($category);
|
||||
|
||||
return $this->json(null, Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Api;
|
||||
|
||||
use App\DTO\Request\CreateTaskRequest;
|
||||
use App\DTO\Request\UpdateTaskRequest;
|
||||
use App\Entity\Task;
|
||||
use App\Repository\TaskRepository;
|
||||
use App\Service\TaskGenerator;
|
||||
use App\Service\TaskManager;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
#[Route('/api/tasks')]
|
||||
class TaskController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private TaskManager $taskManager,
|
||||
private TaskGenerator $taskGenerator,
|
||||
private TaskRepository $taskRepository,
|
||||
) {}
|
||||
|
||||
#[Route('', name: 'tasks.index', methods: ['GET'])]
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
$today = new \DateTimeImmutable('today');
|
||||
$end = $today->modify('+6 days');
|
||||
$this->taskGenerator->generateForRange($today, $end);
|
||||
|
||||
$tasks = $this->taskRepository->findAllWithRelations();
|
||||
|
||||
return $this->json($tasks, context: ['groups' => ['task:read', 'category:read']]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'tasks.show', methods: ['GET'])]
|
||||
public function show(Task $task): JsonResponse
|
||||
{
|
||||
return $this->json($task, context: ['groups' => ['task:read', 'category:read']]);
|
||||
}
|
||||
|
||||
#[Route('', name: 'tasks.create', methods: ['POST'])]
|
||||
public function create(#[MapRequestPayload] CreateTaskRequest $dto): JsonResponse
|
||||
{
|
||||
$task = $this->taskManager->createTask($dto);
|
||||
|
||||
return $this->json($task, Response::HTTP_CREATED, context: ['groups' => ['task:read', 'category:read']]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'tasks.update', methods: ['PUT'])]
|
||||
public function update(#[MapRequestPayload] UpdateTaskRequest $dto, Task $task): JsonResponse
|
||||
{
|
||||
$task = $this->taskManager->updateTask($task, $dto);
|
||||
|
||||
return $this->json($task, context: ['groups' => ['task:read', 'category:read']]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'tasks.delete', methods: ['DELETE'])]
|
||||
public function delete(Task $task): JsonResponse
|
||||
{
|
||||
$this->taskManager->deleteTask($task);
|
||||
|
||||
return $this->json(null, Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
|
||||
#[Route('/{id}/toggle', name: 'tasks.toggle', methods: ['PATCH'])]
|
||||
public function toggle(Task $task): JsonResponse
|
||||
{
|
||||
$task = $this->taskManager->toggleTask($task);
|
||||
|
||||
return $this->json($task, context: ['groups' => ['task:read', 'category:read']]);
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Api;
|
||||
|
||||
use App\DTO\Request\CreateSchemaRequest;
|
||||
use App\DTO\Request\UpdateSchemaRequest;
|
||||
use App\Entity\TaskSchema;
|
||||
use App\Repository\TaskSchemaRepository;
|
||||
use App\Service\TaskSchemaManager;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;
|
||||
use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
#[Route('/api/schemas')]
|
||||
class TaskSchemaController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private TaskSchemaRepository $schemaRepository,
|
||||
private TaskSchemaManager $schemaManager,
|
||||
) {}
|
||||
|
||||
#[Route('', name: 'schemas.index', methods: ['GET'])]
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
$schemas = $this->schemaRepository->findBy([], ['createdAt' => 'DESC']);
|
||||
|
||||
return $this->json($schemas, context: ['groups' => ['schema:read', 'category:read']]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'schemas.show', methods: ['GET'])]
|
||||
public function show(TaskSchema $schema): JsonResponse
|
||||
{
|
||||
return $this->json($schema, context: ['groups' => ['schema:read', 'category:read']]);
|
||||
}
|
||||
|
||||
#[Route('', name: 'schemas.create', methods: ['POST'])]
|
||||
public function create(#[MapRequestPayload] CreateSchemaRequest $dto): JsonResponse
|
||||
{
|
||||
$result = $this->schemaManager->createSchema($dto);
|
||||
|
||||
if (is_array($result)) {
|
||||
return $this->json($result, Response::HTTP_CREATED, context: ['groups' => ['task:read', 'category:read']]);
|
||||
}
|
||||
|
||||
return $this->json($result, Response::HTTP_CREATED, context: ['groups' => ['schema:read', 'category:read']]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'schemas.update', methods: ['PUT'])]
|
||||
public function update(#[MapRequestPayload] UpdateSchemaRequest $dto, TaskSchema $schema): JsonResponse
|
||||
{
|
||||
$schema = $this->schemaManager->updateSchema($schema, $dto);
|
||||
|
||||
return $this->json($schema, context: ['groups' => ['schema:read', 'category:read']]);
|
||||
}
|
||||
|
||||
#[Route('/{id}', name: 'schemas.delete', methods: ['DELETE'])]
|
||||
public function delete(TaskSchema $schema, Request $request): JsonResponse
|
||||
{
|
||||
$deleteTasks = (bool) $request->query->get('deleteTasks', false);
|
||||
$this->schemaManager->deleteSchema($schema, $deleteTasks);
|
||||
|
||||
return $this->json(null, Response::HTTP_NO_CONTENT);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user