feat : add project archiving feature

Allow projects to be archived/unarchived from the ProjectDrawer, with a
toggle filter on the projects page to show/hide archived projects.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-14 08:58:29 +01:00
parent c0b16ef6dc
commit 0733ac16cd
7 changed files with 157 additions and 15 deletions

View File

@@ -10,6 +10,7 @@ export type Project = {
client: Client | null
giteaOwner: string | null
giteaRepo: string | null
archived: boolean
}
export type ProjectWrite = {
@@ -20,4 +21,5 @@ export type ProjectWrite = {
client: string | null // IRI : "/api/clients/1" ou null
giteaOwner?: string | null
giteaRepo?: string | null
archived?: boolean
}

View File

@@ -5,8 +5,9 @@ import { extractHydraMembers } from '~/utils/api'
export function useProjectService() {
const api = useApi()
async function getAll(): Promise<Project[]> {
const data = await api.get<HydraCollection<Project>>('/projects')
async function getAll(params?: { archived?: boolean }): Promise<Project[]> {
const query = params?.archived !== undefined ? `?archived=${params.archived}` : ''
const data = await api.get<HydraCollection<Project>>(`/projects${query}`)
return extractHydraMembers(data)
}
@@ -20,9 +21,9 @@ export function useProjectService() {
})
}
async function update(id: number, payload: Partial<ProjectWrite>): Promise<Project> {
async function update(id: number, payload: Partial<ProjectWrite>, options?: { toastSuccessKey?: string }): Promise<Project> {
return api.patch<Project>(`/projects/${id}`, payload as Record<string, unknown>, {
toastSuccessKey: 'projects.updated',
toastSuccessKey: options?.toastSuccessKey ?? 'projects.updated',
})
}