Files
fabric_trade_server/dist/notifications/notifications.controller.js
T

104 lines
4.7 KiB
JavaScript
Raw Normal View History

"use strict";
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 __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); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AdminNotificationsController = exports.CustomerNotificationsController = void 0;
const common_1 = require("@nestjs/common");
const notifications_service_1 = require("./notifications.service");
const auth_decorators_1 = require("../common/decorators/auth.decorators");
const current_user_decorator_1 = require("../common/decorators/current-user.decorator");
let CustomerNotificationsController = class CustomerNotificationsController {
notifications;
constructor(notifications) {
this.notifications = notifications;
}
list(user) {
return this.notifications.listForCustomer(user.id);
}
unreadCount(user) {
return this.notifications.unreadCount(user.id);
}
markAllRead(user) {
return this.notifications.markAllRead(user.id);
}
markRead(user, id) {
return this.notifications.markRead(user.id, id);
}
};
exports.CustomerNotificationsController = CustomerNotificationsController;
__decorate([
(0, common_1.Get)(),
__param(0, (0, current_user_decorator_1.CurrentUser)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], CustomerNotificationsController.prototype, "list", null);
__decorate([
(0, common_1.Get)('unread-count'),
__param(0, (0, current_user_decorator_1.CurrentUser)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], CustomerNotificationsController.prototype, "unreadCount", null);
__decorate([
(0, common_1.Patch)('read-all'),
__param(0, (0, current_user_decorator_1.CurrentUser)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], CustomerNotificationsController.prototype, "markAllRead", null);
__decorate([
(0, common_1.Patch)(':id/read'),
__param(0, (0, current_user_decorator_1.CurrentUser)()),
__param(1, (0, common_1.Param)('id')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, String]),
__metadata("design:returntype", void 0)
], CustomerNotificationsController.prototype, "markRead", null);
exports.CustomerNotificationsController = CustomerNotificationsController = __decorate([
(0, common_1.Controller)('notifications'),
(0, auth_decorators_1.AuthType)('customer'),
__metadata("design:paramtypes", [notifications_service_1.NotificationsService])
], CustomerNotificationsController);
let AdminNotificationsController = class AdminNotificationsController {
notifications;
constructor(notifications) {
this.notifications = notifications;
}
markAllRead() {
return this.notifications.markAllAdminRead();
}
markRead(id) {
return this.notifications.markAdminRead(id);
}
};
exports.AdminNotificationsController = AdminNotificationsController;
__decorate([
(0, common_1.Patch)('read-all'),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], AdminNotificationsController.prototype, "markAllRead", null);
__decorate([
(0, common_1.Patch)(':id/read'),
__param(0, (0, common_1.Param)('id')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", void 0)
], AdminNotificationsController.prototype, "markRead", null);
exports.AdminNotificationsController = AdminNotificationsController = __decorate([
(0, common_1.Controller)('admin/notifications'),
(0, auth_decorators_1.AuthType)('admin'),
__metadata("design:paramtypes", [notifications_service_1.NotificationsService])
], AdminNotificationsController);
//# sourceMappingURL=notifications.controller.js.map