UNPKG

@opra/common

Version:
42 lines (41 loc) 1.88 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const index_js_1 = require("../../enums/index.js"); const constants_js_1 = require("../constants.js"); const http_operation_js_1 = require("../http/http-operation.js"); const http_operation_decorator_js_1 = require("./http-operation.decorator.js"); const http_operation_entity_decorator_js_1 = require("./http-operation-entity.decorator.js"); /** * HttpOperation.Entity.Delete */ http_operation_js_1.HttpOperation.Entity.Delete = function (arg0, arg1) { let args; if (typeof arg0 === 'object' && !arg0[constants_js_1.DATATYPE_METADATA]) { args = arg0; } else args = { ...arg1, type: arg0 }; /** Initialize the decorator and the chain */ const decoratorChain = []; const decorator = (0, http_operation_decorator_js_1.HttpOperationDecoratorFactory)(decoratorChain, { method: 'DELETE', ...args, composition: 'Entity.Delete', }); decorator .Response(index_js_1.HttpStatusCode.OK, { description: 'Operation is successful. Returns OperationResult with "affected" field.', contentType: index_js_1.MimeTypes.opra_response_json, }) .Response(index_js_1.HttpStatusCode.UNPROCESSABLE_ENTITY, { description: 'The request was well-formed but was unable to process operation due to one or many errors.', contentType: index_js_1.MimeTypes.opra_response_json, }); decoratorChain.push((operationMeta) => { const compositionOptions = (operationMeta.compositionOptions = operationMeta.compositionOptions || {}); compositionOptions.type = (0, http_operation_entity_decorator_js_1.getDataTypeName)(args.type); }); decorator.KeyParam = (0, http_operation_entity_decorator_js_1.createKeyParamDecorator)(decorator, decoratorChain); return decorator; };