-
Notifications
You must be signed in to change notification settings - Fork 119
/
create.ts
27 lines (24 loc) · 1.04 KB
/
create.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { Command } from "../command"
export default class CreateInstanceCommand extends Command {
execute() {
const id_list = this.get_instances_ids()
this.instance_list.get_all().forEach((existing_instance, index, array_of_instances) => {
const { id, creation_ref_id } = existing_instance.get_instance_data()
if (id_list.includes(id) || id_list.includes(creation_ref_id)) {
array_of_instances[index].soft_delete = false
}
});
this.instances.forEach((_, index, array_of_instances) => {
array_of_instances[index].soft_delete = false
})
}
undo() {
const id_list = this.get_instances_ids()
this.instance_list.get().forEach((existing_instance, index, array_of_instances) => {
const { id, creation_ref_id } = existing_instance.get_instance_data()
if (id_list.includes(id) || id_list.includes(creation_ref_id)) {
array_of_instances[index].soft_delete = true
}
});
};
}