feat : add task management with kanban and backlog
Add kanban board with drag-and-drop, backlog section, task/group drawers, DTOs, services, and i18n translations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
9
frontend/services/dto/task-effort.ts
Normal file
9
frontend/services/dto/task-effort.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export type TaskEffort = {
|
||||
id: number
|
||||
'@id'?: string
|
||||
label: string
|
||||
}
|
||||
|
||||
export type TaskEffortWrite = {
|
||||
label: string
|
||||
}
|
||||
17
frontend/services/dto/task-group.ts
Normal file
17
frontend/services/dto/task-group.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import type { Project } from './project'
|
||||
|
||||
export type TaskGroup = {
|
||||
id: number
|
||||
'@id'?: string
|
||||
title: string
|
||||
description: string | null
|
||||
color: string
|
||||
project: Project | null
|
||||
}
|
||||
|
||||
export type TaskGroupWrite = {
|
||||
title: string
|
||||
description: string | null
|
||||
color: string
|
||||
project: string
|
||||
}
|
||||
11
frontend/services/dto/task-priority.ts
Normal file
11
frontend/services/dto/task-priority.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
export type TaskPriority = {
|
||||
id: number
|
||||
'@id'?: string
|
||||
label: string
|
||||
color: string
|
||||
}
|
||||
|
||||
export type TaskPriorityWrite = {
|
||||
label: string
|
||||
color: string
|
||||
}
|
||||
13
frontend/services/dto/task-status.ts
Normal file
13
frontend/services/dto/task-status.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
export type TaskStatus = {
|
||||
id: number
|
||||
'@id'?: string
|
||||
label: string
|
||||
color: string
|
||||
position: number
|
||||
}
|
||||
|
||||
export type TaskStatusWrite = {
|
||||
label: string
|
||||
color: string
|
||||
position: number
|
||||
}
|
||||
11
frontend/services/dto/task-type.ts
Normal file
11
frontend/services/dto/task-type.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
export type TaskType = {
|
||||
id: number
|
||||
'@id'?: string
|
||||
label: string
|
||||
color: string
|
||||
}
|
||||
|
||||
export type TaskTypeWrite = {
|
||||
label: string
|
||||
color: string
|
||||
}
|
||||
31
frontend/services/dto/task.ts
Normal file
31
frontend/services/dto/task.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import type { TaskStatus } from './task-status'
|
||||
import type { TaskEffort } from './task-effort'
|
||||
import type { TaskPriority } from './task-priority'
|
||||
import type { TaskType } from './task-type'
|
||||
import type { TaskGroup } from './task-group'
|
||||
import type { UserData } from './user-data'
|
||||
|
||||
export type Task = {
|
||||
id: number
|
||||
'@id'?: string
|
||||
title: string
|
||||
description: string | null
|
||||
status: TaskStatus | null
|
||||
effort: TaskEffort | null
|
||||
priority: TaskPriority | null
|
||||
assignee: UserData | null
|
||||
group: TaskGroup | null
|
||||
types: TaskType[]
|
||||
}
|
||||
|
||||
export type TaskWrite = {
|
||||
title: string
|
||||
description: string | null
|
||||
status: string | null
|
||||
effort: string | null
|
||||
priority: string | null
|
||||
assignee: string | null
|
||||
group: string | null
|
||||
project: string
|
||||
types: string[]
|
||||
}
|
||||
@@ -10,6 +10,10 @@ export function useProjectService() {
|
||||
return extractHydraMembers(data)
|
||||
}
|
||||
|
||||
async function getById(id: number): Promise<Project> {
|
||||
return api.get<Project>(`/projects/${id}`)
|
||||
}
|
||||
|
||||
async function create(payload: ProjectWrite): Promise<Project> {
|
||||
return api.post<Project>('/projects', payload as Record<string, unknown>, {
|
||||
toastSuccessKey: 'projects.created',
|
||||
@@ -28,5 +32,5 @@ export function useProjectService() {
|
||||
})
|
||||
}
|
||||
|
||||
return { getAll, create, update, remove }
|
||||
return { getAll, getById, create, update, remove }
|
||||
}
|
||||
|
||||
32
frontend/services/task-efforts.ts
Normal file
32
frontend/services/task-efforts.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import type { TaskEffort, TaskEffortWrite } from './dto/task-effort'
|
||||
import type { HydraCollection } from '~/utils/api'
|
||||
import { extractHydraMembers } from '~/utils/api'
|
||||
|
||||
export function useTaskEffortService() {
|
||||
const api = useApi()
|
||||
|
||||
async function getAll(): Promise<TaskEffort[]> {
|
||||
const data = await api.get<HydraCollection<TaskEffort>>('/task_efforts')
|
||||
return extractHydraMembers(data)
|
||||
}
|
||||
|
||||
async function create(payload: TaskEffortWrite): Promise<TaskEffort> {
|
||||
return api.post<TaskEffort>('/task_efforts', payload as Record<string, unknown>, {
|
||||
toastSuccessKey: 'taskEfforts.created',
|
||||
})
|
||||
}
|
||||
|
||||
async function update(id: number, payload: Partial<TaskEffortWrite>): Promise<TaskEffort> {
|
||||
return api.patch<TaskEffort>(`/task_efforts/${id}`, payload as Record<string, unknown>, {
|
||||
toastSuccessKey: 'taskEfforts.updated',
|
||||
})
|
||||
}
|
||||
|
||||
async function remove(id: number): Promise<void> {
|
||||
await api.delete(`/task_efforts/${id}`, {}, {
|
||||
toastSuccessKey: 'taskEfforts.deleted',
|
||||
})
|
||||
}
|
||||
|
||||
return { getAll, create, update, remove }
|
||||
}
|
||||
39
frontend/services/task-groups.ts
Normal file
39
frontend/services/task-groups.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import type { TaskGroup, TaskGroupWrite } from './dto/task-group'
|
||||
import type { HydraCollection } from '~/utils/api'
|
||||
import { extractHydraMembers } from '~/utils/api'
|
||||
|
||||
export function useTaskGroupService() {
|
||||
const api = useApi()
|
||||
|
||||
async function getAll(): Promise<TaskGroup[]> {
|
||||
const data = await api.get<HydraCollection<TaskGroup>>('/task_groups')
|
||||
return extractHydraMembers(data)
|
||||
}
|
||||
|
||||
async function getByProject(projectId: number): Promise<TaskGroup[]> {
|
||||
const data = await api.get<HydraCollection<TaskGroup>>('/task_groups', {
|
||||
project: `/api/projects/${projectId}`,
|
||||
})
|
||||
return extractHydraMembers(data)
|
||||
}
|
||||
|
||||
async function create(payload: TaskGroupWrite): Promise<TaskGroup> {
|
||||
return api.post<TaskGroup>('/task_groups', payload as Record<string, unknown>, {
|
||||
toastSuccessKey: 'taskGroups.created',
|
||||
})
|
||||
}
|
||||
|
||||
async function update(id: number, payload: Partial<TaskGroupWrite>): Promise<TaskGroup> {
|
||||
return api.patch<TaskGroup>(`/task_groups/${id}`, payload as Record<string, unknown>, {
|
||||
toastSuccessKey: 'taskGroups.updated',
|
||||
})
|
||||
}
|
||||
|
||||
async function remove(id: number): Promise<void> {
|
||||
await api.delete(`/task_groups/${id}`, {}, {
|
||||
toastSuccessKey: 'taskGroups.deleted',
|
||||
})
|
||||
}
|
||||
|
||||
return { getAll, getByProject, create, update, remove }
|
||||
}
|
||||
32
frontend/services/task-priorities.ts
Normal file
32
frontend/services/task-priorities.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import type { TaskPriority, TaskPriorityWrite } from './dto/task-priority'
|
||||
import type { HydraCollection } from '~/utils/api'
|
||||
import { extractHydraMembers } from '~/utils/api'
|
||||
|
||||
export function useTaskPriorityService() {
|
||||
const api = useApi()
|
||||
|
||||
async function getAll(): Promise<TaskPriority[]> {
|
||||
const data = await api.get<HydraCollection<TaskPriority>>('/task_priorities')
|
||||
return extractHydraMembers(data)
|
||||
}
|
||||
|
||||
async function create(payload: TaskPriorityWrite): Promise<TaskPriority> {
|
||||
return api.post<TaskPriority>('/task_priorities', payload as Record<string, unknown>, {
|
||||
toastSuccessKey: 'taskPriorities.created',
|
||||
})
|
||||
}
|
||||
|
||||
async function update(id: number, payload: Partial<TaskPriorityWrite>): Promise<TaskPriority> {
|
||||
return api.patch<TaskPriority>(`/task_priorities/${id}`, payload as Record<string, unknown>, {
|
||||
toastSuccessKey: 'taskPriorities.updated',
|
||||
})
|
||||
}
|
||||
|
||||
async function remove(id: number): Promise<void> {
|
||||
await api.delete(`/task_priorities/${id}`, {}, {
|
||||
toastSuccessKey: 'taskPriorities.deleted',
|
||||
})
|
||||
}
|
||||
|
||||
return { getAll, create, update, remove }
|
||||
}
|
||||
32
frontend/services/task-statuses.ts
Normal file
32
frontend/services/task-statuses.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import type { TaskStatus, TaskStatusWrite } from './dto/task-status'
|
||||
import type { HydraCollection } from '~/utils/api'
|
||||
import { extractHydraMembers } from '~/utils/api'
|
||||
|
||||
export function useTaskStatusService() {
|
||||
const api = useApi()
|
||||
|
||||
async function getAll(): Promise<TaskStatus[]> {
|
||||
const data = await api.get<HydraCollection<TaskStatus>>('/task_statuses')
|
||||
return extractHydraMembers(data)
|
||||
}
|
||||
|
||||
async function create(payload: TaskStatusWrite): Promise<TaskStatus> {
|
||||
return api.post<TaskStatus>('/task_statuses', payload as Record<string, unknown>, {
|
||||
toastSuccessKey: 'taskStatuses.created',
|
||||
})
|
||||
}
|
||||
|
||||
async function update(id: number, payload: Partial<TaskStatusWrite>): Promise<TaskStatus> {
|
||||
return api.patch<TaskStatus>(`/task_statuses/${id}`, payload as Record<string, unknown>, {
|
||||
toastSuccessKey: 'taskStatuses.updated',
|
||||
})
|
||||
}
|
||||
|
||||
async function remove(id: number): Promise<void> {
|
||||
await api.delete(`/task_statuses/${id}`, {}, {
|
||||
toastSuccessKey: 'taskStatuses.deleted',
|
||||
})
|
||||
}
|
||||
|
||||
return { getAll, create, update, remove }
|
||||
}
|
||||
32
frontend/services/task-types.ts
Normal file
32
frontend/services/task-types.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import type { TaskType, TaskTypeWrite } from './dto/task-type'
|
||||
import type { HydraCollection } from '~/utils/api'
|
||||
import { extractHydraMembers } from '~/utils/api'
|
||||
|
||||
export function useTaskTypeService() {
|
||||
const api = useApi()
|
||||
|
||||
async function getAll(): Promise<TaskType[]> {
|
||||
const data = await api.get<HydraCollection<TaskType>>('/task_types')
|
||||
return extractHydraMembers(data)
|
||||
}
|
||||
|
||||
async function create(payload: TaskTypeWrite): Promise<TaskType> {
|
||||
return api.post<TaskType>('/task_types', payload as Record<string, unknown>, {
|
||||
toastSuccessKey: 'taskTypes.created',
|
||||
})
|
||||
}
|
||||
|
||||
async function update(id: number, payload: Partial<TaskTypeWrite>): Promise<TaskType> {
|
||||
return api.patch<TaskType>(`/task_types/${id}`, payload as Record<string, unknown>, {
|
||||
toastSuccessKey: 'taskTypes.updated',
|
||||
})
|
||||
}
|
||||
|
||||
async function remove(id: number): Promise<void> {
|
||||
await api.delete(`/task_types/${id}`, {}, {
|
||||
toastSuccessKey: 'taskTypes.deleted',
|
||||
})
|
||||
}
|
||||
|
||||
return { getAll, create, update, remove }
|
||||
}
|
||||
34
frontend/services/tasks.ts
Normal file
34
frontend/services/tasks.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import type { Task, TaskWrite } from './dto/task'
|
||||
import type { HydraCollection } from '~/utils/api'
|
||||
import { extractHydraMembers } from '~/utils/api'
|
||||
|
||||
export function useTaskService() {
|
||||
const api = useApi()
|
||||
|
||||
async function getByProject(projectId: number): Promise<Task[]> {
|
||||
const data = await api.get<HydraCollection<Task>>('/tasks', {
|
||||
project: `/api/projects/${projectId}`,
|
||||
})
|
||||
return extractHydraMembers(data)
|
||||
}
|
||||
|
||||
async function create(payload: TaskWrite): Promise<Task> {
|
||||
return api.post<Task>('/tasks', payload as Record<string, unknown>, {
|
||||
toastSuccessKey: 'tasks.created',
|
||||
})
|
||||
}
|
||||
|
||||
async function update(id: number, payload: Partial<TaskWrite>): Promise<Task> {
|
||||
return api.patch<Task>(`/tasks/${id}`, payload as Record<string, unknown>, {
|
||||
toastSuccessKey: 'tasks.updated',
|
||||
})
|
||||
}
|
||||
|
||||
async function remove(id: number): Promise<void> {
|
||||
await api.delete(`/tasks/${id}`, {}, {
|
||||
toastSuccessKey: 'tasks.deleted',
|
||||
})
|
||||
}
|
||||
|
||||
return { getByProject, create, update, remove }
|
||||
}
|
||||
Reference in New Issue
Block a user