"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.sendToContentHub = void 0;
var tslib_1 = require("tslib");
var content_hub_1 = require("../methods/content_hub");
exports.sendToContentHub = {
    rest: {
        method: 'GET',
        fullPath: '/api/pepsico-content/send/content-hub/:approverId'
    },
    handler: function (ctx) {
        return tslib_1.__awaiter(this, void 0, void 0, function () {
            var user, approverId, logger;
            return tslib_1.__generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        user = ctx.meta.user;
                        if (!user.is_space_admin) {
                            throw new Error('无权限!');
                        }
                        approverId = ctx.params.approverId;
                        if (!approverId) {
                            throw new Error('请传入参数approverId');
                        }
                        return [4, this.getLogger()];
                    case 1:
                        logger = _a.sent();
                        ctx.logger = logger;
                        ctx.getObject = this.getObject;
                        return [4, (0, content_hub_1.inventoryApprovalMaterial)(ctx, approverId)];
                    case 2: return [2, _a.sent()];
                }
            });
        });
    }
};
//# sourceMappingURL=sendToContentHub.js.map