chore: linting warning resolved
This commit is contained in:
parent
8acb60baef
commit
902403a54d
14 changed files with 703 additions and 873 deletions
|
|
@ -124,13 +124,7 @@ export class ArchivedIssuesFilter extends IssueFilterHelperStore implements IArc
|
|||
);
|
||||
|
||||
fetchFilters = async (workspaceSlug: string, projectId: string) => {
|
||||
try {
|
||||
const _filters = this.handleIssuesLocalFilters.get(
|
||||
EIssuesStoreType.ARCHIVED,
|
||||
workspaceSlug,
|
||||
projectId,
|
||||
undefined
|
||||
);
|
||||
const _filters = this.handleIssuesLocalFilters.get(EIssuesStoreType.ARCHIVED, workspaceSlug, projectId, undefined);
|
||||
|
||||
const filters: IIssueFilterOptions = this.computedFilters(_filters?.filters);
|
||||
const displayFilters: IIssueDisplayFilterOptions = this.computedDisplayFilters({
|
||||
|
|
@ -151,9 +145,6 @@ export class ArchivedIssuesFilter extends IssueFilterHelperStore implements IArc
|
|||
set(this.filters, [projectId, "displayProperties"], displayProperties);
|
||||
set(this.filters, [projectId, "kanbanFilters"], kanbanFilters);
|
||||
});
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
updateFilters = async (
|
||||
|
|
|
|||
|
|
@ -179,7 +179,6 @@ export class ArchivedIssues extends BaseIssuesStore implements IArchivedIssues {
|
|||
* @returns
|
||||
*/
|
||||
restoreIssue = async (workspaceSlug: string, projectId: string, issueId: string) => {
|
||||
try {
|
||||
// call API to restore the issue
|
||||
const response = await this.issueArchiveService.restoreIssue(workspaceSlug, projectId, issueId);
|
||||
|
||||
|
|
@ -192,9 +191,6 @@ export class ArchivedIssues extends BaseIssuesStore implements IArchivedIssues {
|
|||
});
|
||||
|
||||
return response;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
// Setting them as undefined as they can not performed on Archived issues
|
||||
|
|
|
|||
|
|
@ -127,7 +127,6 @@ export class CycleIssuesFilter extends IssueFilterHelperStore implements ICycleI
|
|||
);
|
||||
|
||||
fetchFilters = async (workspaceSlug: string, projectId: string, cycleId: string) => {
|
||||
try {
|
||||
const _filters = await this.issueFilterService.fetchCycleIssueFilters(workspaceSlug, projectId, cycleId);
|
||||
|
||||
const filters: IIssueFilterOptions = this.computedFilters(_filters?.filters);
|
||||
|
|
@ -157,9 +156,6 @@ export class CycleIssuesFilter extends IssueFilterHelperStore implements ICycleI
|
|||
set(this.filters, [cycleId, "displayProperties"], displayProperties);
|
||||
set(this.filters, [cycleId, "kanbanFilters"], kanbanFilters);
|
||||
});
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
updateFilters = async (
|
||||
|
|
|
|||
|
|
@ -273,14 +273,9 @@ export class CycleIssues extends BaseIssuesStore implements ICycleIssues {
|
|||
* @returns
|
||||
*/
|
||||
override createIssue = async (workspaceSlug: string, projectId: string, data: Partial<TIssue>, cycleId: string) => {
|
||||
try {
|
||||
const response = await super.createIssue(workspaceSlug, projectId, data, cycleId, false);
|
||||
await this.addIssueToCycle(workspaceSlug, projectId, cycleId, [response.id], false);
|
||||
|
||||
return response;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -299,7 +294,6 @@ export class CycleIssues extends BaseIssuesStore implements ICycleIssues {
|
|||
new_cycle_id: string;
|
||||
}
|
||||
) => {
|
||||
try {
|
||||
// call API call to transfer issues
|
||||
const response = await this.cycleService.transferIssues(
|
||||
workspaceSlug as string,
|
||||
|
|
@ -310,11 +304,7 @@ export class CycleIssues extends BaseIssuesStore implements ICycleIssues {
|
|||
// call fetch issues
|
||||
this.paginationOptions &&
|
||||
(await this.fetchIssues(workspaceSlug, projectId, "mutation", this.paginationOptions, cycleId));
|
||||
|
||||
return response;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -327,7 +317,6 @@ export class CycleIssues extends BaseIssuesStore implements ICycleIssues {
|
|||
* @returns
|
||||
*/
|
||||
fetchActiveCycleIssues = async (workspaceSlug: string, projectId: string, perPageCount: number, cycleId: string) => {
|
||||
try {
|
||||
// set loader
|
||||
set(this.activeCycleIds, [cycleId], undefined);
|
||||
|
||||
|
|
@ -353,9 +342,6 @@ export class CycleIssues extends BaseIssuesStore implements ICycleIssues {
|
|||
});
|
||||
|
||||
return response;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -367,7 +353,6 @@ export class CycleIssues extends BaseIssuesStore implements ICycleIssues {
|
|||
* @returns
|
||||
*/
|
||||
fetchNextActiveCycleIssues = async (workspaceSlug: string, projectId: string, cycleId: string) => {
|
||||
try {
|
||||
//get the previous pagination data for the cycle id
|
||||
const activeCycle = get(this.activeCycleIds, [cycleId]);
|
||||
|
||||
|
|
@ -397,9 +382,6 @@ export class CycleIssues extends BaseIssuesStore implements ICycleIssues {
|
|||
);
|
||||
|
||||
return response;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -411,7 +393,6 @@ export class CycleIssues extends BaseIssuesStore implements ICycleIssues {
|
|||
* @returns
|
||||
*/
|
||||
quickAddIssue = async (workspaceSlug: string, projectId: string, data: TIssue, cycleId: string) => {
|
||||
try {
|
||||
// add temporary issue to store list
|
||||
this.addIssue(data);
|
||||
|
||||
|
|
@ -432,9 +413,6 @@ export class CycleIssues extends BaseIssuesStore implements ICycleIssues {
|
|||
}
|
||||
|
||||
return response;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
// Using aliased names as they cannot be overridden in other stores
|
||||
|
|
|
|||
|
|
@ -124,7 +124,6 @@ export class DraftIssuesFilter extends IssueFilterHelperStore implements IDraftI
|
|||
);
|
||||
|
||||
fetchFilters = async (workspaceSlug: string, projectId: string) => {
|
||||
try {
|
||||
const _filters = this.handleIssuesLocalFilters.get(EIssuesStoreType.DRAFT, workspaceSlug, projectId, undefined);
|
||||
|
||||
const filters: IIssueFilterOptions = this.computedFilters(_filters?.filters);
|
||||
|
|
@ -143,9 +142,6 @@ export class DraftIssuesFilter extends IssueFilterHelperStore implements IDraftI
|
|||
set(this.filters, [projectId, "displayProperties"], displayProperties);
|
||||
set(this.filters, [projectId, "kanbanFilters"], kanbanFilters);
|
||||
});
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
updateFilters = async (
|
||||
|
|
|
|||
|
|
@ -517,7 +517,6 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
id?: string,
|
||||
shouldUpdateList = true
|
||||
) {
|
||||
try {
|
||||
// perform an API call
|
||||
const response = await this.issueService.createIssue(workspaceSlug, projectId, data);
|
||||
|
||||
|
|
@ -528,9 +527,6 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
shouldUpdateList && (await this.fetchParentStats(workspaceSlug, projectId));
|
||||
|
||||
return response;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -586,20 +582,13 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
* @returns
|
||||
*/
|
||||
async createDraftIssue(workspaceSlug: string, projectId: string, data: Partial<TIssue>) {
|
||||
try {
|
||||
// call API to create a Draft issue
|
||||
const response = await this.issueDraftService.createDraftIssue(workspaceSlug, projectId, data);
|
||||
|
||||
// call Fetch parent stats
|
||||
this.fetchParentStats(workspaceSlug, projectId);
|
||||
|
||||
// Add issue to store
|
||||
this.addIssue(response);
|
||||
|
||||
return response;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -640,29 +629,20 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
* @param issueId
|
||||
*/
|
||||
async removeIssue(workspaceSlug: string, projectId: string, issueId: string) {
|
||||
try {
|
||||
// Store Before state of the issue
|
||||
const issueBeforeRemoval = clone(this.rootIssueStore.issues.getIssueById(issueId));
|
||||
|
||||
// update parent stats optimistically
|
||||
this.updateParentStats(issueBeforeRemoval, undefined);
|
||||
|
||||
// Male API call
|
||||
await this.issueService.deleteIssue(workspaceSlug, projectId, issueId);
|
||||
|
||||
// Remove from Respective issue Id list
|
||||
runInAction(() => {
|
||||
this.removeIssueFromList(issueId);
|
||||
});
|
||||
|
||||
// call fetch Parent stats
|
||||
this.fetchParentStats(workspaceSlug, projectId);
|
||||
|
||||
// Remove issue from main issue Map store
|
||||
this.rootIssueStore.issues.removeIssue(issueId);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -672,18 +652,13 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
* @param issueId
|
||||
*/
|
||||
async issueArchive(workspaceSlug: string, projectId: string, issueId: string) {
|
||||
try {
|
||||
const issueBeforeArchive = clone(this.rootIssueStore.issues.getIssueById(issueId));
|
||||
|
||||
// update parent stats optimistically
|
||||
this.updateParentStats(issueBeforeArchive, undefined);
|
||||
|
||||
// Male API call
|
||||
const response = await this.issueArchiveService.archiveIssue(workspaceSlug, projectId, issueId);
|
||||
|
||||
// call fetch Parent stats
|
||||
this.fetchParentStats(workspaceSlug, projectId);
|
||||
|
||||
runInAction(() => {
|
||||
// Update the Archived at of the issue from store
|
||||
this.rootIssueStore.issues.updateIssue(issueId, {
|
||||
|
|
@ -692,9 +667,6 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
// Since Archived remove the issue Id from the current store
|
||||
this.removeIssueFromList(issueId);
|
||||
});
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -705,22 +677,17 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
* @returns
|
||||
*/
|
||||
async issueQuickAdd(workspaceSlug: string, projectId: string, data: TIssue) {
|
||||
try {
|
||||
// Add issue to store with a temporary Id
|
||||
this.addIssue(data);
|
||||
|
||||
// call Create issue method
|
||||
const response = await this.createIssue(workspaceSlug, projectId, data);
|
||||
|
||||
runInAction(() => {
|
||||
this.removeIssueFromList(data.id);
|
||||
this.rootIssueStore.issues.removeIssue(data.id);
|
||||
});
|
||||
|
||||
const currentCycleId = data.cycle_id !== "" && data.cycle_id === "None" ? undefined : data.cycle_id;
|
||||
const currentModuleIds =
|
||||
data.module_ids && data.module_ids.length > 0 ? data.module_ids.filter((moduleId) => moduleId != "None") : [];
|
||||
|
||||
const promiseRequests = [];
|
||||
if (currentCycleId) {
|
||||
promiseRequests.push(this.addCycleToIssue(workspaceSlug, projectId, currentCycleId, response.id));
|
||||
|
|
@ -728,15 +695,10 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
if (currentModuleIds.length > 0) {
|
||||
promiseRequests.push(this.changeModulesInIssue(workspaceSlug, projectId, response.id, currentModuleIds, []));
|
||||
}
|
||||
|
||||
if (promiseRequests && promiseRequests.length > 0) {
|
||||
await Promise.all(promiseRequests);
|
||||
}
|
||||
|
||||
return response;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -747,13 +709,10 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
* @returns
|
||||
*/
|
||||
async removeBulkIssues(workspaceSlug: string, projectId: string, issueIds: string[]) {
|
||||
try {
|
||||
// Make API call to bulk delete issues
|
||||
const response = await this.issueService.bulkDeleteIssues(workspaceSlug, projectId, { issue_ids: issueIds });
|
||||
|
||||
// call fetch parent stats
|
||||
this.fetchParentStats(workspaceSlug, projectId);
|
||||
|
||||
// Remove issues from the store
|
||||
runInAction(() => {
|
||||
issueIds.forEach((issueId) => {
|
||||
|
|
@ -762,9 +721,6 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
});
|
||||
});
|
||||
return response;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -774,7 +730,6 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
* @param issueIds
|
||||
*/
|
||||
bulkArchiveIssues = async (workspaceSlug: string, projectId: string, issueIds: string[]) => {
|
||||
try {
|
||||
const response = await this.issueService.bulkArchiveIssues(workspaceSlug, projectId, { issue_ids: issueIds });
|
||||
|
||||
runInAction(() => {
|
||||
|
|
@ -791,9 +746,6 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
this.removeIssueFromList(issueId);
|
||||
});
|
||||
});
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -802,7 +754,6 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
*/
|
||||
bulkUpdateProperties = async (workspaceSlug: string, projectId: string, data: TBulkOperationsPayload) => {
|
||||
const issueIds = data.issue_ids;
|
||||
try {
|
||||
// make request to update issue properties
|
||||
await this.issueService.bulkOperations(workspaceSlug, projectId, data);
|
||||
// update issues in the store
|
||||
|
|
@ -833,9 +784,6 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
this.updateIssueList(issueDetails, issueBeforeUpdate);
|
||||
});
|
||||
});
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -853,7 +801,6 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
issueIds: string[],
|
||||
fetchAddedIssues = true
|
||||
) {
|
||||
try {
|
||||
// Perform an APi call to add issue to cycle
|
||||
await this.issueService.addIssueToCycle(workspaceSlug, projectId, cycleId, {
|
||||
issues: issueIds,
|
||||
|
|
@ -877,9 +824,6 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
issueIds.forEach((issueId) => {
|
||||
this.issueUpdate(workspaceSlug, projectId, issueId, { cycle_id: cycleId }, false);
|
||||
});
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -890,7 +834,6 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
* @param issueId
|
||||
*/
|
||||
async removeIssueFromCycle(workspaceSlug: string, projectId: string, cycleId: string, issueId: string) {
|
||||
try {
|
||||
const issueBeforeRemoval = clone(this.rootIssueStore.issues.getIssueById(issueId));
|
||||
|
||||
// update parent stats optimistically
|
||||
|
|
@ -909,9 +852,6 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
|
||||
// update Issue cycle Id to null by calling current store's update Issue, without making an API call
|
||||
this.issueUpdate(workspaceSlug, projectId, issueId, { cycle_id: null }, false);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1024,7 +964,6 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
issueIds: string[],
|
||||
fetchAddedIssues = true
|
||||
) {
|
||||
try {
|
||||
// Perform an APi call to add issue to module
|
||||
await this.moduleService.addIssuesToModule(workspaceSlug, projectId, moduleId, {
|
||||
issues: issueIds,
|
||||
|
|
@ -1047,9 +986,6 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
const updatedIssueModuleIds = uniq(concat(issueModuleIds, [moduleId]));
|
||||
this.issueUpdate(workspaceSlug, projectId, issueId, { module_ids: updatedIssueModuleIds }, false);
|
||||
});
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1061,14 +997,8 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
* @returns
|
||||
*/
|
||||
async removeIssuesFromModule(workspaceSlug: string, projectId: string, moduleId: string, issueIds: string[]) {
|
||||
try {
|
||||
// Perform an APi call to remove issue to module
|
||||
const response = await this.moduleService.removeIssuesFromModuleBulk(
|
||||
workspaceSlug,
|
||||
projectId,
|
||||
moduleId,
|
||||
issueIds
|
||||
);
|
||||
const response = await this.moduleService.removeIssuesFromModuleBulk(workspaceSlug, projectId, moduleId, issueIds);
|
||||
|
||||
// if module Id is the current Module Id then call fetch parent stats
|
||||
if (this.moduleId === moduleId) this.fetchParentStats(workspaceSlug, projectId);
|
||||
|
|
@ -1088,9 +1018,6 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
});
|
||||
|
||||
return response;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -1103,7 +1030,6 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
async addModulesToIssue(workspaceSlug: string, projectId: string, issueId: string, moduleIds: string[]) {
|
||||
// keep a copy of the original module ids
|
||||
const originalModuleIds = get(this.rootIssueStore.issues.issuesMap, [issueId, "module_ids"]) ?? [];
|
||||
try {
|
||||
//Perform API call
|
||||
await this.moduleService.addModulesToIssue(workspaceSlug, projectId, issueId, {
|
||||
modules: moduleIds,
|
||||
|
|
@ -1125,9 +1051,6 @@ export abstract class BaseIssuesStore implements IBaseIssuesStore {
|
|||
if (moduleIds.includes(this.moduleId ?? "")) {
|
||||
this.fetchParentStats(workspaceSlug, projectId, this.moduleId);
|
||||
}
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -99,19 +99,12 @@ export class IssueAttachmentStore implements IIssueAttachmentStore {
|
|||
};
|
||||
|
||||
fetchAttachments = async (workspaceSlug: string, projectId: string, issueId: string) => {
|
||||
try {
|
||||
const response = await this.issueAttachmentService.getIssueAttachment(workspaceSlug, projectId, issueId);
|
||||
|
||||
this.addAttachments(issueId, response);
|
||||
|
||||
return response;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
createAttachment = async (workspaceSlug: string, projectId: string, issueId: string, data: FormData) => {
|
||||
try {
|
||||
const response = await this.issueAttachmentService.uploadIssueAttachment(workspaceSlug, projectId, issueId, data);
|
||||
const issueAttachmentsCount = this.getAttachmentsByIssueId(issueId)?.length ?? 0;
|
||||
|
||||
|
|
@ -126,13 +119,9 @@ export class IssueAttachmentStore implements IIssueAttachmentStore {
|
|||
}
|
||||
|
||||
return response;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
removeAttachment = async (workspaceSlug: string, projectId: string, issueId: string, attachmentId: string) => {
|
||||
try {
|
||||
const response = await this.issueAttachmentService.deleteIssueAttachment(
|
||||
workspaceSlug,
|
||||
projectId,
|
||||
|
|
@ -153,8 +142,5 @@ export class IssueAttachmentStore implements IIssueAttachmentStore {
|
|||
});
|
||||
|
||||
return response;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,7 +90,6 @@ export class IssueCommentStore implements IIssueCommentStore {
|
|||
issueId: string,
|
||||
loaderType: TCommentLoader = "fetch"
|
||||
) => {
|
||||
try {
|
||||
this.loader = loaderType;
|
||||
|
||||
let props = {};
|
||||
|
|
@ -116,13 +115,9 @@ export class IssueCommentStore implements IIssueCommentStore {
|
|||
});
|
||||
|
||||
return comments;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
createComment = async (workspaceSlug: string, projectId: string, issueId: string, data: Partial<TIssueComment>) => {
|
||||
try {
|
||||
const response = await this.issueCommentService.createIssueComment(workspaceSlug, projectId, issueId, data);
|
||||
|
||||
runInAction(() => {
|
||||
|
|
@ -134,9 +129,6 @@ export class IssueCommentStore implements IIssueCommentStore {
|
|||
});
|
||||
|
||||
return response;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
updateComment = async (
|
||||
|
|
@ -169,7 +161,6 @@ export class IssueCommentStore implements IIssueCommentStore {
|
|||
};
|
||||
|
||||
removeComment = async (workspaceSlug: string, projectId: string, issueId: string, commentId: string) => {
|
||||
try {
|
||||
const response = await this.issueCommentService.deleteIssueComment(workspaceSlug, projectId, issueId, commentId);
|
||||
|
||||
runInAction(() => {
|
||||
|
|
@ -178,8 +169,5 @@ export class IssueCommentStore implements IIssueCommentStore {
|
|||
});
|
||||
|
||||
return response;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,17 +92,12 @@ export class IssueLinkStore implements IIssueLinkStore {
|
|||
};
|
||||
|
||||
fetchLinks = async (workspaceSlug: string, projectId: string, issueId: string) => {
|
||||
try {
|
||||
const response = await this.issueService.fetchIssueLinks(workspaceSlug, projectId, issueId);
|
||||
this.addLinks(issueId, response);
|
||||
return response;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
createLink = async (workspaceSlug: string, projectId: string, issueId: string, data: Partial<TIssueLink>) => {
|
||||
try {
|
||||
const response = await this.issueService.createIssueLink(workspaceSlug, projectId, issueId, data);
|
||||
const issueLinkCount = this.getLinksByIssueId(issueId)?.length ?? 0;
|
||||
runInAction(() => {
|
||||
|
|
@ -112,13 +107,9 @@ export class IssueLinkStore implements IIssueLinkStore {
|
|||
link_count: issueLinkCount + 1, // increment link count
|
||||
});
|
||||
});
|
||||
|
||||
// fetching activity
|
||||
this.rootIssueDetailStore.activity.fetchActivities(workspaceSlug, projectId, issueId);
|
||||
return response;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
updateLink = async (
|
||||
|
|
@ -128,7 +119,6 @@ export class IssueLinkStore implements IIssueLinkStore {
|
|||
linkId: string,
|
||||
data: Partial<TIssueLink>
|
||||
) => {
|
||||
try {
|
||||
runInAction(() => {
|
||||
Object.keys(data).forEach((key) => {
|
||||
set(this.linkMap, [linkId, key], data[key as keyof TIssueLink]);
|
||||
|
|
@ -140,14 +130,9 @@ export class IssueLinkStore implements IIssueLinkStore {
|
|||
// fetching activity
|
||||
this.rootIssueDetailStore.activity.fetchActivities(workspaceSlug, projectId, issueId);
|
||||
return response;
|
||||
} catch (error) {
|
||||
// TODO: fetch issue detail
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
removeLink = async (workspaceSlug: string, projectId: string, issueId: string, linkId: string) => {
|
||||
try {
|
||||
const issueLinkCount = this.getLinksByIssueId(issueId)?.length ?? 0;
|
||||
await this.issueService.deleteIssueLink(workspaceSlug, projectId, issueId, linkId);
|
||||
|
||||
|
|
@ -163,8 +148,5 @@ export class IssueLinkStore implements IIssueLinkStore {
|
|||
|
||||
// fetching activity
|
||||
this.rootIssueDetailStore.activity.fetchActivities(workspaceSlug, projectId, issueId);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,19 +109,12 @@ export class IssueReactionStore implements IIssueReactionStore {
|
|||
|
||||
// actions
|
||||
fetchReactions = async (workspaceSlug: string, projectId: string, issueId: string) => {
|
||||
try {
|
||||
const response = await this.issueReactionService.listIssueReactions(workspaceSlug, projectId, issueId);
|
||||
|
||||
this.addReactions(issueId, response);
|
||||
|
||||
return response;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
createReaction = async (workspaceSlug: string, projectId: string, issueId: string, reaction: string) => {
|
||||
try {
|
||||
const response = await this.issueReactionService.createIssueReaction(workspaceSlug, projectId, issueId, {
|
||||
reaction,
|
||||
});
|
||||
|
|
@ -137,9 +130,6 @@ export class IssueReactionStore implements IIssueReactionStore {
|
|||
// fetching activity
|
||||
this.rootIssueDetailStore.activity.fetchActivities(workspaceSlug, projectId, issueId);
|
||||
return response;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
removeReaction = async (
|
||||
|
|
@ -149,7 +139,6 @@ export class IssueReactionStore implements IIssueReactionStore {
|
|||
reaction: string,
|
||||
userId: string
|
||||
) => {
|
||||
try {
|
||||
const userReactions = this.reactionsByUser(issueId, userId);
|
||||
const currentReaction = find(userReactions, { actor: userId, reaction: reaction });
|
||||
|
||||
|
|
@ -165,8 +154,5 @@ export class IssueReactionStore implements IIssueReactionStore {
|
|||
// fetching activity
|
||||
this.rootIssueDetailStore.activity.fetchActivities(workspaceSlug, projectId, issueId);
|
||||
return response;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,13 +113,10 @@ export class IssueSubIssuesStore implements IIssueSubIssuesStore {
|
|||
};
|
||||
|
||||
fetchSubIssues = async (workspaceSlug: string, projectId: string, parentIssueId: string) => {
|
||||
try {
|
||||
const response = await this.issueService.subIssues(workspaceSlug, projectId, parentIssueId);
|
||||
const subIssuesStateDistribution = response?.state_distribution ?? {};
|
||||
const subIssues = (response.sub_issues ?? []) as TIssue[];
|
||||
|
||||
this.rootIssueDetailStore.rootIssueStore.issues.addIssue(subIssues);
|
||||
|
||||
// fetch other issues states and members when sub-issues are from different project
|
||||
if (subIssues && subIssues.length > 0) {
|
||||
const otherProjectIds = uniq(
|
||||
|
|
@ -127,13 +124,11 @@ export class IssueSubIssuesStore implements IIssueSubIssuesStore {
|
|||
) as string[];
|
||||
this.fetchOtherProjectProperties(workspaceSlug, otherProjectIds);
|
||||
}
|
||||
|
||||
if (subIssues) {
|
||||
this.rootIssueDetailStore.rootIssueStore.issues.updateIssue(parentIssueId, {
|
||||
sub_issues_count: subIssues.length,
|
||||
});
|
||||
}
|
||||
|
||||
runInAction(() => {
|
||||
set(this.subIssuesStateDistribution, parentIssueId, subIssuesStateDistribution);
|
||||
set(
|
||||
|
|
@ -142,15 +137,10 @@ export class IssueSubIssuesStore implements IIssueSubIssuesStore {
|
|||
subIssues.map((issue) => issue.id)
|
||||
);
|
||||
});
|
||||
|
||||
return response;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
createSubIssues = async (workspaceSlug: string, projectId: string, parentIssueId: string, issueIds: string[]) => {
|
||||
try {
|
||||
const response = await this.issueService.addSubIssues(workspaceSlug, projectId, parentIssueId, {
|
||||
sub_issue_ids: issueIds,
|
||||
});
|
||||
|
|
@ -192,9 +182,6 @@ export class IssueSubIssuesStore implements IIssueSubIssuesStore {
|
|||
);
|
||||
|
||||
return;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
updateSubIssue = async (
|
||||
|
|
@ -206,7 +193,6 @@ export class IssueSubIssuesStore implements IIssueSubIssuesStore {
|
|||
oldIssue: Partial<TIssue> = {},
|
||||
fromModal: boolean = false
|
||||
) => {
|
||||
try {
|
||||
if (!fromModal)
|
||||
await this.rootIssueDetailStore.rootIssueStore.projectIssues.updateIssue(
|
||||
workspaceSlug,
|
||||
|
|
@ -257,13 +243,9 @@ export class IssueSubIssuesStore implements IIssueSubIssuesStore {
|
|||
}
|
||||
|
||||
return;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
removeSubIssue = async (workspaceSlug: string, projectId: string, parentIssueId: string, issueId: string) => {
|
||||
try {
|
||||
await this.rootIssueDetailStore.rootIssueStore.projectIssues.updateIssue(workspaceSlug, projectId, issueId, {
|
||||
parent_id: null,
|
||||
});
|
||||
|
|
@ -296,13 +278,9 @@ export class IssueSubIssuesStore implements IIssueSubIssuesStore {
|
|||
});
|
||||
|
||||
return;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
deleteSubIssue = async (workspaceSlug: string, projectId: string, parentIssueId: string, issueId: string) => {
|
||||
try {
|
||||
await this.rootIssueDetailStore.rootIssueStore.projectIssues.removeIssue(workspaceSlug, projectId, issueId);
|
||||
|
||||
const issue = this.rootIssueDetailStore.issue.getIssueById(issueId);
|
||||
|
|
@ -333,13 +311,9 @@ export class IssueSubIssuesStore implements IIssueSubIssuesStore {
|
|||
});
|
||||
|
||||
return;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
fetchOtherProjectProperties = async (workspaceSlug: string, projectIds: string[]) => {
|
||||
try {
|
||||
if (projectIds.length > 0) {
|
||||
for (const projectId of projectIds) {
|
||||
// fetching other project states
|
||||
|
|
@ -362,8 +336,5 @@ export class IssueSubIssuesStore implements IIssueSubIssuesStore {
|
|||
);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,19 +61,13 @@ export class IssueSubscriptionStore implements IIssueSubscriptionStore {
|
|||
};
|
||||
|
||||
fetchSubscriptions = async (workspaceSlug: string, projectId: string, issueId: string) => {
|
||||
try {
|
||||
const subscription = await this.issueService.getIssueNotificationSubscriptionStatus(
|
||||
workspaceSlug,
|
||||
projectId,
|
||||
issueId
|
||||
);
|
||||
|
||||
this.addSubscription(issueId, subscription?.subscribed);
|
||||
|
||||
return subscription?.subscribed;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
createSubscription = async (workspaceSlug: string, projectId: string, issueId: string) => {
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ export interface ICalendarStore {
|
|||
|
||||
export class CalendarStore implements ICalendarStore {
|
||||
loader: boolean = false;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
error: any | null = null;
|
||||
|
||||
// observables
|
||||
|
|
|
|||
44
yarn.lock
44
yarn.lock
|
|
@ -3819,6 +3819,13 @@
|
|||
"@types/connect" "*"
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/compression@^1.7.5":
|
||||
version "1.7.5"
|
||||
resolved "https://registry.yarnpkg.com/@types/compression/-/compression-1.7.5.tgz#0f80efef6eb031be57b12221c4ba6bc3577808f7"
|
||||
integrity sha512-AAQvK5pxMpaT+nDvhHrsBhLSYG5yQdtkaJE1WYieSNY2mVFKAgmU4ks65rkZD5oqnGCFLyQpUr1CqI4DmUMyDg==
|
||||
dependencies:
|
||||
"@types/express" "*"
|
||||
|
||||
"@types/connect@*":
|
||||
version "3.4.38"
|
||||
resolved "https://registry.yarnpkg.com/@types/connect/-/connect-3.4.38.tgz#5ba7f3bc4fbbdeaff8dded952e5ff2cc53f8d858"
|
||||
|
|
@ -4607,7 +4614,7 @@ abort-controller@^3.0.0:
|
|||
dependencies:
|
||||
event-target-shim "^5.0.0"
|
||||
|
||||
accepts@~1.3.8:
|
||||
accepts@~1.3.5, accepts@~1.3.8:
|
||||
version "1.3.8"
|
||||
resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.8.tgz#0bf0be125b67014adcb0b0921e62db7bffe16b2e"
|
||||
integrity sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==
|
||||
|
|
@ -5216,6 +5223,11 @@ busboy@1.6.0:
|
|||
dependencies:
|
||||
streamsearch "^1.1.0"
|
||||
|
||||
bytes@3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048"
|
||||
integrity sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw==
|
||||
|
||||
bytes@3.1.2:
|
||||
version "3.1.2"
|
||||
resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5"
|
||||
|
|
@ -5583,6 +5595,26 @@ commondir@^1.0.1:
|
|||
resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b"
|
||||
integrity sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==
|
||||
|
||||
compressible@~2.0.16:
|
||||
version "2.0.18"
|
||||
resolved "https://registry.yarnpkg.com/compressible/-/compressible-2.0.18.tgz#af53cca6b070d4c3c0750fbd77286a6d7cc46fba"
|
||||
integrity sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==
|
||||
dependencies:
|
||||
mime-db ">= 1.43.0 < 2"
|
||||
|
||||
compression@^1.7.4:
|
||||
version "1.7.4"
|
||||
resolved "https://registry.yarnpkg.com/compression/-/compression-1.7.4.tgz#95523eff170ca57c29a0ca41e6fe131f41e5bb8f"
|
||||
integrity sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ==
|
||||
dependencies:
|
||||
accepts "~1.3.5"
|
||||
bytes "3.0.0"
|
||||
compressible "~2.0.16"
|
||||
debug "2.6.9"
|
||||
on-headers "~1.0.2"
|
||||
safe-buffer "5.1.2"
|
||||
vary "~1.1.2"
|
||||
|
||||
compute-scroll-into-view@^3.0.2:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/compute-scroll-into-view/-/compute-scroll-into-view-3.1.0.tgz#753f11d972596558d8fe7c6bcbc8497690ab4c87"
|
||||
|
|
@ -7594,6 +7626,11 @@ header-case@^2.0.4:
|
|||
capital-case "^1.0.4"
|
||||
tslib "^2.0.3"
|
||||
|
||||
helmet@^7.1.0:
|
||||
version "7.1.0"
|
||||
resolved "https://registry.yarnpkg.com/helmet/-/helmet-7.1.0.tgz#287279e00f8a3763d5dccbaf1e5ee39b8c3784ca"
|
||||
integrity sha512-g+HZqgfbpXdCkme/Cd/mZkV0aV3BZZZSugecH03kl38m/Kmdx8jKjBikpDj2cr+Iynv4KpYEviojNdTJActJAg==
|
||||
|
||||
help-me@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/help-me/-/help-me-5.0.0.tgz#b1ebe63b967b74060027c2ac61f9be12d354a6f6"
|
||||
|
|
@ -9034,6 +9071,11 @@ mime-db@1.52.0:
|
|||
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70"
|
||||
integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==
|
||||
|
||||
"mime-db@>= 1.43.0 < 2":
|
||||
version "1.53.0"
|
||||
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.53.0.tgz#3cb63cd820fc29896d9d4e8c32ab4fcd74ccb447"
|
||||
integrity sha512-oHlN/w+3MQ3rba9rqFr6V/ypF10LSkdwUysQL7GkXoTgIWeV+tcXGA852TBxH+gsh8UWoyhR1hKcoMJTuWflpg==
|
||||
|
||||
mime-types@^2.1.12, mime-types@^2.1.27, mime-types@^2.1.31, mime-types@~2.1.24, mime-types@~2.1.34:
|
||||
version "2.1.35"
|
||||
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue