feat(tasks): enable sharing task lists with teams and users
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 1m6s
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 1m6s
This commit is contained in:
1 parent
cfc0477b5c
commit
0afa2f9c2d
7 files changed
+686
-173
No files matched your search
+27
-1
@@ -15,6 +15,7 @@ import {
|
||||
SystemSettings,
|
||||
Team,
|
||||
TaskList,
|
||||
TaskListShare,
|
||||
Thought,
|
||||
SubTask,
|
||||
TagDetails,
|
||||
@@ -336,13 +337,18 @@ export const api = {
|
||||
// --- TASK LISTS ---
|
||||
async getTaskLists(): Promise<TaskList[]> {
|
||||
const res = await request<TaskList[]>('/api/v1/task-lists');
|
||||
return ensureArray(res);
|
||||
return ensureArray(res).map((tl) => ({
|
||||
...tl,
|
||||
members: ensureArray(tl.members),
|
||||
shares: ensureArray(tl.shares),
|
||||
}));
|
||||
},
|
||||
|
||||
async createTaskList(payload: {
|
||||
title: string;
|
||||
icon?: string;
|
||||
color?: string;
|
||||
teamId?: string;
|
||||
spaceId?: string;
|
||||
}): Promise<TaskList> {
|
||||
return request<TaskList>('/api/v1/task-lists', {
|
||||
@@ -357,6 +363,7 @@ export const api = {
|
||||
title?: string;
|
||||
icon?: string;
|
||||
color?: string;
|
||||
teamId?: string;
|
||||
spaceId?: string;
|
||||
}
|
||||
): Promise<TaskList> {
|
||||
@@ -370,6 +377,25 @@ export const api = {
|
||||
await request(`/api/v1/task-lists/${id}`, { method: 'DELETE' });
|
||||
},
|
||||
|
||||
async getTaskListShares(id: string): Promise<TaskListShare[]> {
|
||||
const res = await request<TaskListShare[]>(`/api/v1/task-lists/${id}/shares`);
|
||||
return ensureArray(res);
|
||||
},
|
||||
|
||||
async addTaskListShare(
|
||||
id: string,
|
||||
payload: { targetType: 'team' | 'user'; targetId: string }
|
||||
): Promise<TaskListShare> {
|
||||
return request<TaskListShare>(`/api/v1/task-lists/${id}/shares`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
},
|
||||
|
||||
async removeTaskListShare(id: string, shareId: string): Promise<void> {
|
||||
await request(`/api/v1/task-lists/${id}/shares/${shareId}`, { method: 'DELETE' });
|
||||
},
|
||||
|
||||
// --- WORKSPACE FOLDERS ---
|
||||
async getFolders(): Promise<string[]> {
|
||||
const res = await request<string[]>('/api/v1/folders');
|
||||
|
||||
@@ -64,13 +64,34 @@ export interface Thought {
|
||||
triagedAt?: string;
|
||||
}
|
||||
|
||||
export interface TaskListShare {
|
||||
id: string;
|
||||
taskListId: string;
|
||||
targetType: 'team' | 'user';
|
||||
targetId: string;
|
||||
targetName?: string;
|
||||
email?: string;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
export interface TaskListMember {
|
||||
userId: string;
|
||||
displayName: string;
|
||||
email: string;
|
||||
role: string;
|
||||
}
|
||||
|
||||
export interface TaskList {
|
||||
id: string;
|
||||
userId: string;
|
||||
spaceId?: string;
|
||||
spaceName?: string;
|
||||
teamId?: string;
|
||||
teamName?: string;
|
||||
ownerName?: string;
|
||||
members?: SpaceMember[];
|
||||
isOwner?: boolean;
|
||||
members?: TaskListMember[];
|
||||
shares?: TaskListShare[];
|
||||
title: string;
|
||||
icon: string;
|
||||
color: string;
|
||||
|
||||
Reference in new issue
Block a user