client part of setMultiState
This commit is contained in:
parent
cb3e6c4e47
commit
6cd250a36d
@ -95,9 +95,7 @@ export class MotionMultiselectService {
|
|||||||
}));
|
}));
|
||||||
const selectedChoice = await this.choiceService.open(title, choices);
|
const selectedChoice = await this.choiceService.open(title, choices);
|
||||||
if (selectedChoice) {
|
if (selectedChoice) {
|
||||||
for (const motion of motions) {
|
await this.repo.setMultiState(motions, selectedChoice.items as number);
|
||||||
await this.repo.setState(motion, selectedChoice.items as number);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,6 +168,20 @@ export class MotionRepositoryService extends BaseRepository<ViewMotion, Motion>
|
|||||||
await this.httpService.put(restPath, { state: stateId });
|
await this.httpService.put(restPath, { state: stateId });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the state of motions in bulk
|
||||||
|
*
|
||||||
|
* @param viewMotion target motion
|
||||||
|
* @param stateId the number that indicates the state
|
||||||
|
*/
|
||||||
|
public async setMultiState(viewMotions: ViewMotion[], stateId: number): Promise<void> {
|
||||||
|
const restPath = `/rest/motions/motion/manage_multiple_state/`;
|
||||||
|
const motionsIdMap: { id: number; state: number }[] = viewMotions.map(motion => {
|
||||||
|
return { id: motion.id, state: stateId };
|
||||||
|
});
|
||||||
|
await this.httpService.post(restPath, { motions: motionsIdMap });
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the recommenders state of a motion
|
* Set the recommenders state of a motion
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user