UNPKG

@sync-in/server

Version:

The secure, open-source platform for file storage, sharing, collaboration, and sync

88 lines (87 loc) 3.84 kB
/* * 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, "SpacesScheduler", { enumerable: true, get: function() { return SpacesScheduler; } }); const _common = require("@nestjs/common"); const _schedule = require("@nestjs/schedule"); const _spacesmanagerservice = require("./spaces-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); } let SpacesScheduler = class SpacesScheduler { async updatePersonalSpacesQuota() { this.logger.log(`${this.updatePersonalSpacesQuota.name} - START`); try { await this.spacesManager.updatePersonalSpacesQuota(); } catch (e) { this.logger.error(`${this.updatePersonalSpacesQuota.name} - ${e}`); } this.logger.log(`${this.updatePersonalSpacesQuota.name} - END`); } async updateSpacesQuota() { this.logger.log(`${this.updateSpacesQuota.name} - START`); try { await this.spacesManager.updateSpacesQuota(); } catch (e) { this.logger.error(`${this.updateSpacesQuota.name} - ${e}`); } this.logger.log(`${this.updateSpacesQuota.name} - END`); } async deleteExpiredSpaces() { /* Removes spaces that have been disabled for more than 30 days */ this.logger.log(`${this.deleteExpiredSpaces.name} - START`); try { await this.spacesManager.deleteExpiredSpaces(); } catch (e) { this.logger.error(`${this.deleteExpiredSpaces.name} - ${e}`); } this.logger.log(`${this.deleteExpiredSpaces.name} - DONE`); } constructor(spacesManager){ this.spacesManager = spacesManager; this.logger = new _common.Logger(SpacesScheduler.name); } }; _ts_decorate([ (0, _schedule.Timeout)(60000), (0, _schedule.Cron)(_schedule.CronExpression.EVERY_HOUR), _ts_metadata("design:type", Function), _ts_metadata("design:paramtypes", []), _ts_metadata("design:returntype", Promise) ], SpacesScheduler.prototype, "updatePersonalSpacesQuota", null); _ts_decorate([ (0, _schedule.Timeout)(60000), (0, _schedule.Cron)(_schedule.CronExpression.EVERY_HOUR), _ts_metadata("design:type", Function), _ts_metadata("design:paramtypes", []), _ts_metadata("design:returntype", Promise) ], SpacesScheduler.prototype, "updateSpacesQuota", null); _ts_decorate([ (0, _schedule.Cron)(_schedule.CronExpression.EVERY_DAY_AT_4AM), _ts_metadata("design:type", Function), _ts_metadata("design:paramtypes", []), _ts_metadata("design:returntype", Promise) ], SpacesScheduler.prototype, "deleteExpiredSpaces", null); SpacesScheduler = _ts_decorate([ (0, _common.Injectable)(), _ts_metadata("design:type", Function), _ts_metadata("design:paramtypes", [ typeof _spacesmanagerservice.SpacesManager === "undefined" ? Object : _spacesmanagerservice.SpacesManager ]) ], SpacesScheduler); //# sourceMappingURL=spaces-scheduler.service.js.map