import 'reflect-metadata'; import { ProductController as BaseProductController } from '@whittaker/swift-api'; import { ApplicationContext, InmotionResponse, InmotionRequest } from '@inmotion/core'; import { Validator, ErrorService } from '@inmotion/utils'; export class ProductController extends BaseProductController { constructor(appContext: ApplicationContext) { super(appContext); } public async safeDelete(request: InmotionRequest<{ productGuid: string }>): Promise> { let response = new InmotionResponse(true, null, []); try { const productGuid = request.params.productGuid; Validator.throwIfNil(productGuid, `Missing productGuid`); const resp = await this._productService.safeDelete(productGuid); response.data = null; } catch (e) { response.success = false; response.errors.push(ErrorService.getMessage(e, 'Error in method: safeDelete.')); } return response; } }