Initial commit

This commit is contained in:
Yaojia Wang
2025-11-03 00:04:07 +01:00
parent 34b701de48
commit 097300e8ec
37 changed files with 3473 additions and 109 deletions

29
lib/api/projects.ts Normal file
View File

@@ -0,0 +1,29 @@
import { api } from './client';
import type { Project, CreateProjectDto, UpdateProjectDto } from '@/types/project';
import type { KanbanBoard } from '@/types/kanban';
export const projectsApi = {
getAll: async (page = 1, pageSize = 20): Promise<Project[]> => {
return api.get(`/projects?page=${page}&pageSize=${pageSize}`);
},
getById: async (id: string): Promise<Project> => {
return api.get(`/projects/${id}`);
},
create: async (data: CreateProjectDto): Promise<Project> => {
return api.post('/projects', data);
},
update: async (id: string, data: UpdateProjectDto): Promise<Project> => {
return api.put(`/projects/${id}`, data);
},
delete: async (id: string): Promise<void> => {
return api.delete(`/projects/${id}`);
},
getKanban: async (id: string): Promise<KanbanBoard> => {
return api.get(`/projects/${id}/kanban`);
},
};