UNPKG

@topgroup/diginext

Version:

A BUILD SERVER & CLI to deploy apps to any Kubernetes clusters.

156 lines (155 loc) 6.26 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var __param = (this && this.__param) || function (paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const dist_1 = require("tsoa/dist"); const interfaces = __importStar(require("../interfaces")); const NotificationService_1 = require("../services/NotificationService"); const BaseController_1 = __importDefault(require("./BaseController")); let NotificationController = class NotificationController extends BaseController_1.default { constructor() { super(new NotificationService_1.NotificationService()); } read(queryParams) { return super.read(); } async create(body, queryParams) { try { const data = await this.service.create(body); return interfaces.respondSuccess({ data }); } catch (e) { return interfaces.respondFailure(e.toString()); } } async update(body, queryParams) { try { const data = await super.update(body); return interfaces.respondSuccess({ data }); } catch (e) { return interfaces.respondFailure(e.toString()); } } delete(queryParams) { return super.delete(); } async markAsRead(body, queryParams) { try { const data = await this.service.markAsRead(this.filter, this.options); return interfaces.respondSuccess({ data }); } catch (e) { return interfaces.respondFailure(e.toString()); } } async sendToJojo(body, queryParams) { try { const data = await this.service.sendToJojo(body, this.options); return interfaces.respondSuccess({ data }); } catch (e) { return interfaces.respondFailure(e.toString()); } } }; __decorate([ (0, dist_1.Security)("api_key"), (0, dist_1.Security)("jwt"), (0, dist_1.Get)("/"), __param(0, (0, dist_1.Queries)()), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", void 0) ], NotificationController.prototype, "read", null); __decorate([ (0, dist_1.Security)("api_key"), (0, dist_1.Security)("jwt"), (0, dist_1.Post)("/"), __param(0, (0, dist_1.Body)()), __param(1, (0, dist_1.Queries)()), __metadata("design:type", Function), __metadata("design:paramtypes", [Object, Object]), __metadata("design:returntype", Promise) ], NotificationController.prototype, "create", null); __decorate([ (0, dist_1.Security)("api_key"), (0, dist_1.Security)("jwt"), (0, dist_1.Patch)("/"), __param(0, (0, dist_1.Body)()), __param(1, (0, dist_1.Queries)()), __metadata("design:type", Function), __metadata("design:paramtypes", [Object, Object]), __metadata("design:returntype", Promise) ], NotificationController.prototype, "update", null); __decorate([ (0, dist_1.Security)("api_key"), (0, dist_1.Security)("jwt"), (0, dist_1.Delete)("/"), __param(0, (0, dist_1.Queries)()), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", void 0) ], NotificationController.prototype, "delete", null); __decorate([ (0, dist_1.Security)("api_key"), (0, dist_1.Security)("jwt"), (0, dist_1.Patch)("/read"), __param(0, (0, dist_1.Body)()), __param(1, (0, dist_1.Queries)()), __metadata("design:type", Function), __metadata("design:paramtypes", [Object, Object]), __metadata("design:returntype", Promise) ], NotificationController.prototype, "markAsRead", null); __decorate([ (0, dist_1.Security)("api_key"), (0, dist_1.Security)("jwt"), (0, dist_1.Post)("/jojo"), __param(0, (0, dist_1.Body)()), __param(1, (0, dist_1.Queries)()), __metadata("design:type", Function), __metadata("design:paramtypes", [Object, Object]), __metadata("design:returntype", Promise) ], NotificationController.prototype, "sendToJojo", null); NotificationController = __decorate([ (0, dist_1.Tags)("Notification"), (0, dist_1.Route)("notification"), __metadata("design:paramtypes", []) ], NotificationController); exports.default = NotificationController;