fix(gitea) : fetch only branch-specific commits using compare API
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
11
CLAUDE.md
11
CLAUDE.md
@@ -12,22 +12,23 @@ Application de gestion de projet. Monorepo Symfony 8 (API Platform 4) + Nuxt 4.
|
|||||||
## Structure
|
## Structure
|
||||||
|
|
||||||
```
|
```
|
||||||
src/Entity/ # Entités Doctrine (User, Client, Project, Task, TaskStatus, TaskEffort, TaskPriority, TaskTag, TaskGroup, TimeEntry)
|
src/Entity/ # Entités Doctrine (User, Client, Project, Task, TaskStatus, TaskEffort, TaskPriority, TaskTag, TaskGroup, TimeEntry, GiteaConfiguration)
|
||||||
src/ApiResource/ # Ressources API Platform (si découplées des entités)
|
src/ApiResource/ # Ressources API Platform (si découplées des entités)
|
||||||
src/State/ # Providers et Processors API Platform (MeProvider, AppVersionProvider, ActiveTimeEntryProvider, UserPasswordHasherProcessor, TaskNumberProcessor)
|
src/State/ # Providers et Processors API Platform (MeProvider, AppVersionProvider, ActiveTimeEntryProvider, UserPasswordHasherProcessor, TaskNumberProcessor, Gitea*Provider, Gitea*Processor)
|
||||||
src/Repository/ # Repositories Doctrine
|
src/Repository/ # Repositories Doctrine
|
||||||
src/DataFixtures/ # Fixtures
|
src/DataFixtures/ # Fixtures
|
||||||
config/ # Config Symfony (security, api_platform, lexik_jwt, nelmio_cors, doctrine)
|
config/ # Config Symfony (security, api_platform, lexik_jwt, nelmio_cors, doctrine)
|
||||||
config/jwt/ # Clés JWT (private.pem, public.pem)
|
config/jwt/ # Clés JWT (private.pem, public.pem)
|
||||||
migrations/ # Migrations Doctrine
|
migrations/ # Migrations Doctrine
|
||||||
docs/plans/ # Plans d'implémentation
|
docs/plans/ # Plans d'implémentation
|
||||||
|
docs/superpowers/ # Plans et specs superpowers
|
||||||
frontend/ # App Nuxt 4
|
frontend/ # App Nuxt 4
|
||||||
frontend/pages/ # Pages (index, login, projects, projects/[id], projects/[id]/groups, projects/[id]/archives, time-tracking, admin)
|
frontend/pages/ # Pages (index, login, my-tasks, projects, projects/[id], projects/[id]/groups, projects/[id]/archives, time-tracking, admin)
|
||||||
frontend/layouts/ # Layouts (pas "layout")
|
frontend/layouts/ # Layouts (pas "layout")
|
||||||
frontend/components/ # Composants Vue (AppTopNav, AppDrawer, ColorPicker, DataTable, ClientDrawer, ProjectDrawer, ProjectGroupTab, TaskCard, TaskDrawer, TaskModal, TaskEffortDrawer, TaskGroupDrawer, TaskPriorityDrawer, TaskStatusDrawer, TaskTagDrawer, Admin*Tab, SidebarLink, SidebarTimer, TimeEntryBlock, TimeEntryContextMenu, TimeEntryDrawer, TimeEntryList, TimeTrackingCalendar, UserDrawer, ConfirmDeleteStatusModal, ConfirmDeleteTaskModal)
|
frontend/components/ # Composants Vue organisés en sous-dossiers (ui/, client/, project/, task/, user/, admin/, time-tracking/)
|
||||||
frontend/composables/# Composables (useApi, useAppVersion)
|
frontend/composables/# Composables (useApi, useAppVersion)
|
||||||
frontend/stores/ # Stores Pinia (auth, ui, timer)
|
frontend/stores/ # Stores Pinia (auth, ui, timer)
|
||||||
frontend/services/ # Services API (auth, clients, projects, tasks, task-statuses, task-efforts, task-groups, task-priorities, task-tags, users, time-entries)
|
frontend/services/ # Services API (auth, clients, gitea, projects, tasks, task-statuses, task-efforts, task-groups, task-priorities, task-tags, users, time-entries)
|
||||||
frontend/services/dto/ # Types TypeScript
|
frontend/services/dto/ # Types TypeScript
|
||||||
frontend/i18n/locales/ # Fichiers de traduction (langDir résolu depuis i18n/)
|
frontend/i18n/locales/ # Fichiers de traduction (langDir résolu depuis i18n/)
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -133,17 +133,21 @@ final readonly class GiteaApiService
|
|||||||
/**
|
/**
|
||||||
* @return array<array{sha: string, commit: array{message: string, author: array}, created: string}>
|
* @return array<array{sha: string, commit: array{message: string, author: array}, created: string}>
|
||||||
*/
|
*/
|
||||||
public function listCommits(Project $project, string $branch): array
|
public function listBranchCommits(Project $project, string $branch): array
|
||||||
{
|
{
|
||||||
$this->assertProjectHasRepo($project);
|
$this->assertProjectHasRepo($project);
|
||||||
|
|
||||||
return $this->request('GET', sprintf(
|
$defaultBranch = $this->getDefaultBranch($project);
|
||||||
'/api/v1/repos/%s/%s/commits',
|
|
||||||
|
$data = $this->request('GET', sprintf(
|
||||||
|
'/api/v1/repos/%s/%s/compare/%s...%s',
|
||||||
$project->getGiteaOwner(),
|
$project->getGiteaOwner(),
|
||||||
$project->getGiteaRepo(),
|
$project->getGiteaRepo(),
|
||||||
), [
|
$defaultBranch,
|
||||||
'query' => ['sha' => $branch, 'limit' => 30],
|
urlencode($branch),
|
||||||
]);
|
));
|
||||||
|
|
||||||
|
return $data['commits'] ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ final readonly class GiteaBranchProvider implements ProviderInterface
|
|||||||
$dto->name = $branch['name'];
|
$dto->name = $branch['name'];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$commits = $this->giteaApiService->listCommits($project, $branch['name']);
|
$commits = $this->giteaApiService->listBranchCommits($project, $branch['name']);
|
||||||
$dto->commits = array_map(static fn (array $c): array => [
|
$dto->commits = array_map(static fn (array $c): array => [
|
||||||
'sha' => substr($c['sha'] ?? '', 0, 7),
|
'sha' => substr($c['sha'] ?? '', 0, 7),
|
||||||
'message' => $c['commit']['message'] ?? '',
|
'message' => $c['commit']['message'] ?? '',
|
||||||
|
|||||||
Reference in New Issue
Block a user