UNPKG

@topgroup/diginext

Version:

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

25 lines (24 loc) 1.03 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.MediaService = void 0; const Media_1 = require("../entities/Media"); const cloud_storage_1 = require("../plugins/cloud-storage"); const BaseService_1 = __importDefault(require("./BaseService")); class MediaService extends BaseService_1.default { constructor(ownership) { super(Media_1.mediaSchema, ownership); } async uploadToCloudStorage(file, fileName) { const { workspace } = this.ownership; if (!workspace) throw new Error("Workspace not found"); if (!workspace.settings.cloud_storage) throw new Error("Cloud storage settings not found"); return (0, cloud_storage_1.uploadFileBuffer)(file, fileName, { storage: workspace.settings.cloud_storage }); } } exports.default = MediaService; exports.MediaService = MediaService;