fix: remove leftovers of childIds
This commit is contained in:
parent
a2cc9ddc88
commit
bbaddb9406
@ -18,7 +18,6 @@ export interface IProject extends IAbstract {
|
|||||||
subscription: ISubscription
|
subscription: ISubscription
|
||||||
position: number
|
position: number
|
||||||
backgroundBlurHash: string
|
backgroundBlurHash: string
|
||||||
childProjectIds: number[]
|
|
||||||
parentProjectId: number
|
parentProjectId: number
|
||||||
|
|
||||||
created: Date
|
created: Date
|
||||||
|
@ -22,7 +22,6 @@ export default class ProjectModel extends AbstractModel<IProject> implements IPr
|
|||||||
subscription: ISubscription = null
|
subscription: ISubscription = null
|
||||||
position = 0
|
position = 0
|
||||||
backgroundBlurHash = ''
|
backgroundBlurHash = ''
|
||||||
childProjectIds = []
|
|
||||||
parentProjectId = 0
|
parentProjectId = 0
|
||||||
|
|
||||||
created: Date = null
|
created: Date = null
|
||||||
@ -47,8 +46,6 @@ export default class ProjectModel extends AbstractModel<IProject> implements IPr
|
|||||||
this.subscription = new SubscriptionModel(this.subscription)
|
this.subscription = new SubscriptionModel(this.subscription)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.childProjectIds = this.childProjects?.map(p => p.id) || []
|
|
||||||
|
|
||||||
this.created = new Date(this.created)
|
this.created = new Date(this.created)
|
||||||
this.updated = new Date(this.updated)
|
this.updated = new Date(this.updated)
|
||||||
}
|
}
|
||||||
|
@ -110,15 +110,6 @@ export const useProjectStore = defineStore('project', () => {
|
|||||||
const cancel = setModuleLoading(setIsLoading)
|
const cancel = setModuleLoading(setIsLoading)
|
||||||
const projectService = new ProjectService()
|
const projectService = new ProjectService()
|
||||||
|
|
||||||
const oldProject = projects.value[project.id]
|
|
||||||
if (oldProject && oldProject.parentProjectId !== project.parentProjectId && oldProject.parentProjectId > 0) {
|
|
||||||
const parentProject = projects.value[oldProject.parentProjectId]
|
|
||||||
if (parentProject) {
|
|
||||||
const childProjectIndex = parentProject.childProjectIds.findIndex(pId => pId === project.id)
|
|
||||||
parentProject.childProjectIds.splice(childProjectIndex, 1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await projectService.update(project)
|
await projectService.update(project)
|
||||||
setProject(project)
|
setProject(project)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user