Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public async updateElement({tx, ty, tz, rx, ry, rz, name, asset}: SpaceElement, elementOid: string, spaceOid: string, userId: string): Promise<void> {
- const space = await this.spaceRepository.findSpaceByOidAndUserId(spaceOid, userId);
- if (space) {
- const element = await this.spaceRepository.findElementByOidAndSpace(elementOid, spaceOid);
- if (element) {
- Object.assign(element, {tx, ty, tz, rx, ry, rz, name});
- if (asset) {
- element.asset = await this.spaceRepository.findAssetByOid(asset.oid);
- }
- return this.spaceRepository.updateElement(element);
- } else {
- throw new Error('The element does not exist for this space');
- }
- } else {
- throw new Error('The space does not exist for this user');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement