mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
issue data store
This commit is contained in:
parent
1fffc90cea
commit
5a23cf373e
@ -1,10 +1,13 @@
|
||||
import { IIssueData, IssueData } from "./issue.data.store";
|
||||
import { IWorkspaceData, WorkspaceData } from "./workspace.data.store";
|
||||
|
||||
export class DataStore {
|
||||
workspace: IWorkspaceData;
|
||||
issue: IIssueData;
|
||||
|
||||
constructor() {
|
||||
this.workspace = new WorkspaceData(this);
|
||||
this.issue = new IssueData(this);
|
||||
}
|
||||
|
||||
resetOnSignout() {}
|
||||
|
36
web/store/dataMaps/issue.data.store.ts
Normal file
36
web/store/dataMaps/issue.data.store.ts
Normal file
@ -0,0 +1,36 @@
|
||||
import { makeObservable, observable } from "mobx";
|
||||
import { DataStore } from ".";
|
||||
import { TIssue } from "@plane/types";
|
||||
import { set } from "lodash";
|
||||
|
||||
export interface IIssueData {
|
||||
issueMap: Record<string, any>;
|
||||
|
||||
addIssue: (issue: TIssue) => void;
|
||||
deleteIssue: (issueId: string) => void;
|
||||
getIssuebyId: (issueId: string) => any | undefined;
|
||||
}
|
||||
|
||||
export class IssueData implements IIssueData {
|
||||
issueMap: Record<string, any> = {};
|
||||
|
||||
// data store
|
||||
dataStore;
|
||||
|
||||
constructor(_dataStore: DataStore) {
|
||||
makeObservable(this, {
|
||||
issueMap: observable,
|
||||
});
|
||||
this.dataStore = _dataStore;
|
||||
}
|
||||
|
||||
addIssue = (issue: TIssue) => {
|
||||
set(this.issueMap, [issue.id], "");
|
||||
};
|
||||
|
||||
deleteIssue = (issueId: string) => {
|
||||
delete this.issueMap[issueId];
|
||||
};
|
||||
|
||||
getIssuebyId = (issueId: string) => this.issueMap[issueId];
|
||||
}
|
Loading…
Reference in New Issue
Block a user