Update
This commit is contained in:
1 parent
3d9674bd5a
commit
d1da86beab
20 files changed
+6109
-923
No files matched your search
+61
-2
@@ -2,6 +2,7 @@ import type {
|
||||
AdminUser,
|
||||
AuthUser,
|
||||
BillingStatus,
|
||||
DashboardPreference,
|
||||
Organization,
|
||||
PeriodOverview,
|
||||
PeriodType,
|
||||
@@ -100,6 +101,30 @@ export function updateCurrentUser(payload: {
|
||||
});
|
||||
}
|
||||
|
||||
export function getDashboardPreference() {
|
||||
return request<{ preference: Partial<DashboardPreference> }>("/api/dashboard/preferences");
|
||||
}
|
||||
|
||||
export function saveDashboardPreference(preference: DashboardPreference) {
|
||||
return request<{ preference: Partial<DashboardPreference> }>("/api/dashboard/preferences", {
|
||||
method: "PUT",
|
||||
body: JSON.stringify({ preference })
|
||||
});
|
||||
}
|
||||
|
||||
export function addFavoriteTicket(ticketNumber: string) {
|
||||
return request<{ preference: Partial<DashboardPreference> }>("/api/dashboard/favorites", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ ticketNumber })
|
||||
});
|
||||
}
|
||||
|
||||
export function removeFavoriteTicket(ticketNumber: string) {
|
||||
return request<{ preference: Partial<DashboardPreference> }>(`/api/dashboard/favorites/${encodeURIComponent(ticketNumber)}`, {
|
||||
method: "DELETE"
|
||||
});
|
||||
}
|
||||
|
||||
export function getSetupStatus() {
|
||||
return request<{ required: boolean }>("/api/setup/status");
|
||||
}
|
||||
@@ -294,8 +319,14 @@ export function deleteRecurringBilling(billingId: string) {
|
||||
});
|
||||
}
|
||||
|
||||
export function getProjects() {
|
||||
return request<{ projects: ProjectSummary[] }>("/api/projects");
|
||||
export function getProjects(includeClosed = false) {
|
||||
const params = new URLSearchParams();
|
||||
|
||||
if (includeClosed) {
|
||||
params.set("includeClosed", "true");
|
||||
}
|
||||
|
||||
return request<{ projects: ProjectSummary[] }>(`/api/projects${params.size ? `?${params}` : ""}`);
|
||||
}
|
||||
|
||||
export function getProject(projectId: string) {
|
||||
@@ -312,6 +343,7 @@ export function createProject(payload: {
|
||||
startsOn?: string | null;
|
||||
endsOn?: string | null;
|
||||
hourBudgetMinutes?: number | null;
|
||||
manualConsumptionMinutes?: number | null;
|
||||
}) {
|
||||
return request<{ project: ProjectSummary }>("/api/projects", {
|
||||
method: "POST",
|
||||
@@ -331,6 +363,7 @@ export function updateProject(
|
||||
startsOn?: string | null;
|
||||
endsOn?: string | null;
|
||||
hourBudgetMinutes?: number | null;
|
||||
manualConsumptionMinutes?: number | null;
|
||||
}
|
||||
) {
|
||||
return request<{ project: ProjectSummary }>(`/api/projects/${projectId}`, {
|
||||
@@ -339,6 +372,19 @@ export function updateProject(
|
||||
});
|
||||
}
|
||||
|
||||
export function updateProjectStatus(projectId: string, closed: boolean) {
|
||||
return request<{ project: { id: string; ticket_id: string; closed_at: string | null } }>(`/api/projects/${projectId}/status`, {
|
||||
method: "PATCH",
|
||||
body: JSON.stringify({ closed })
|
||||
});
|
||||
}
|
||||
|
||||
export function deleteProject(projectId: string) {
|
||||
return request<{ deleted: { id: string; ticket_id: string } }>(`/api/projects/${projectId}`, {
|
||||
method: "DELETE"
|
||||
});
|
||||
}
|
||||
|
||||
export function getTodos(status?: TodoStatus | "all") {
|
||||
const params = new URLSearchParams();
|
||||
|
||||
@@ -355,6 +401,8 @@ export function createTicketTodo(
|
||||
title: string;
|
||||
description: string;
|
||||
priority: TodoPriority;
|
||||
startsOn?: string | null;
|
||||
endsOn?: string | null;
|
||||
}
|
||||
) {
|
||||
return request<{ todo: TicketTodo }>(`/api/tickets/${ticketId}/todos`, {
|
||||
@@ -370,6 +418,8 @@ export function updateTodo(
|
||||
description: string;
|
||||
priority: TodoPriority;
|
||||
status: TodoStatus;
|
||||
startsOn?: string | null;
|
||||
endsOn?: string | null;
|
||||
}
|
||||
) {
|
||||
return request<{ todo: TicketTodo }>(`/api/todos/${todoId}`, {
|
||||
@@ -378,6 +428,13 @@ export function updateTodo(
|
||||
});
|
||||
}
|
||||
|
||||
export function updateTodoOrder(todoIds: string[]) {
|
||||
return request<{ ok: boolean }>("/api/todos/order", {
|
||||
method: "PUT",
|
||||
body: JSON.stringify({ todoIds })
|
||||
});
|
||||
}
|
||||
|
||||
export function deleteTodo(todoId: string) {
|
||||
return request<{ deleted: { id: string } }>(`/api/todos/${todoId}`, {
|
||||
method: "DELETE"
|
||||
@@ -406,6 +463,7 @@ export function updateTicket(
|
||||
title?: string | null;
|
||||
organizationId: string;
|
||||
workType: WorkType;
|
||||
removeProjectData?: boolean;
|
||||
}
|
||||
) {
|
||||
return request<{ ticket: TicketMeta }>(`/api/tickets/${ticketId}`, {
|
||||
@@ -420,6 +478,7 @@ export function updateSessionDetails(
|
||||
organizationId: string;
|
||||
activity: string;
|
||||
workType: WorkType;
|
||||
removeProjectData?: boolean;
|
||||
startedAt: string;
|
||||
endedAt: string;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user