@sync-in/server
Version:
The secure, open-source platform for file storage, sharing, collaboration, and sync
110 lines (109 loc) • 4.66 kB
JavaScript
/*
* Copyright (C) 2012-2025 Johan Legrand <johan.legrand@sync-in.com>
* This file is part of Sync-in | The open source file sync and share solution
* See the LICENSE file for licensing details
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "NotificationsController", {
enumerable: true,
get: function() {
return NotificationsController;
}
});
const _common = require("@nestjs/common");
const _userdecorator = require("../users/decorators/user.decorator");
const _routes = require("./constants/routes");
const _notificationsmanagerservice = require("./services/notifications-manager.service");
function _ts_decorate(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;
}
function _ts_metadata(k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
}
function _ts_param(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
}
let NotificationsController = class NotificationsController {
list(user) {
return this.notificationsManager.list(user);
}
listUnread(user) {
return this.notificationsManager.list(user, true);
}
wasRead(user, notificationId) {
return this.notificationsManager.wasRead(user, notificationId);
}
deleteAll(user) {
return this.notificationsManager.delete(user);
}
delete(user, notificationId) {
return this.notificationsManager.delete(user, notificationId);
}
constructor(notificationsManager){
this.notificationsManager = notificationsManager;
}
};
_ts_decorate([
(0, _common.Get)(),
_ts_param(0, (0, _userdecorator.GetUser)()),
_ts_metadata("design:type", Function),
_ts_metadata("design:paramtypes", [
typeof UserModel === "undefined" ? Object : UserModel
]),
_ts_metadata("design:returntype", typeof Promise === "undefined" ? Object : Promise)
], NotificationsController.prototype, "list", null);
_ts_decorate([
(0, _common.Get)(_routes.NOTIFICATIONS_ROUTE.UNREAD),
_ts_param(0, (0, _userdecorator.GetUser)()),
_ts_metadata("design:type", Function),
_ts_metadata("design:paramtypes", [
typeof UserModel === "undefined" ? Object : UserModel
]),
_ts_metadata("design:returntype", typeof Promise === "undefined" ? Object : Promise)
], NotificationsController.prototype, "listUnread", null);
_ts_decorate([
(0, _common.Patch)(':id'),
_ts_param(0, (0, _userdecorator.GetUser)()),
_ts_param(1, (0, _common.Param)('id', _common.ParseIntPipe)),
_ts_metadata("design:type", Function),
_ts_metadata("design:paramtypes", [
typeof UserModel === "undefined" ? Object : UserModel,
Number
]),
_ts_metadata("design:returntype", void 0)
], NotificationsController.prototype, "wasRead", null);
_ts_decorate([
(0, _common.Delete)(),
_ts_param(0, (0, _userdecorator.GetUser)()),
_ts_metadata("design:type", Function),
_ts_metadata("design:paramtypes", [
typeof UserModel === "undefined" ? Object : UserModel
]),
_ts_metadata("design:returntype", typeof Promise === "undefined" ? Object : Promise)
], NotificationsController.prototype, "deleteAll", null);
_ts_decorate([
(0, _common.Delete)(':id'),
_ts_param(0, (0, _userdecorator.GetUser)()),
_ts_param(1, (0, _common.Param)('id', _common.ParseIntPipe)),
_ts_metadata("design:type", Function),
_ts_metadata("design:paramtypes", [
typeof UserModel === "undefined" ? Object : UserModel,
Number
]),
_ts_metadata("design:returntype", typeof Promise === "undefined" ? Object : Promise)
], NotificationsController.prototype, "delete", null);
NotificationsController = _ts_decorate([
(0, _common.Controller)(_routes.NOTIFICATIONS_ROUTE.BASE),
_ts_metadata("design:type", Function),
_ts_metadata("design:paramtypes", [
typeof _notificationsmanagerservice.NotificationsManager === "undefined" ? Object : _notificationsmanagerservice.NotificationsManager
])
], NotificationsController);
//# sourceMappingURL=notifications.controller.js.map