|
|
@ -194,12 +194,17 @@ export default class ProjectUser { |
|
|
|
const { isNoneList } = cachedList; |
|
|
|
const { isNoneList } = cachedList; |
|
|
|
if (!isNoneList && cachedProjectList?.length) { |
|
|
|
if (!isNoneList && cachedProjectList?.length) { |
|
|
|
cachedProjectList = cachedProjectList.filter((p) => p.id !== projectId); |
|
|
|
cachedProjectList = cachedProjectList.filter((p) => p.id !== projectId); |
|
|
|
|
|
|
|
// delete the whole list first so that the old one won't be included
|
|
|
|
|
|
|
|
await NocoCache.del(`${CacheScope.USER_PROJECT}:${userId}:list`); |
|
|
|
|
|
|
|
if (cachedProjectList.length > 0) { |
|
|
|
|
|
|
|
// set the updated list (i.e. excluding the to-be-deleted project id)
|
|
|
|
await NocoCache.setList( |
|
|
|
await NocoCache.setList( |
|
|
|
CacheScope.USER_PROJECT, |
|
|
|
CacheScope.USER_PROJECT, |
|
|
|
[userId], |
|
|
|
[userId], |
|
|
|
cachedProjectList, |
|
|
|
cachedProjectList, |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
await NocoCache.del(`${CacheScope.PROJECT_USER}:${projectId}:${userId}`); |
|
|
|
await NocoCache.del(`${CacheScope.PROJECT_USER}:${projectId}:${userId}`); |
|
|
|
return await ncMeta.metaDelete(null, null, MetaTable.PROJECT_USERS, { |
|
|
|
return await ncMeta.metaDelete(null, null, MetaTable.PROJECT_USERS, { |
|
|
|