summary refs log tree commit diff
path: root/dist/routes/attachments.js
diff options
context:
space:
mode:
Diffstat (limited to 'dist/routes/attachments.js')
-rw-r--r--dist/routes/attachments.js48
1 files changed, 0 insertions, 48 deletions
diff --git a/dist/routes/attachments.js b/dist/routes/attachments.js
deleted file mode 100644
index 4b639448..00000000
--- a/dist/routes/attachments.js
+++ /dev/null
@@ -1,48 +0,0 @@
-"use strict";
-var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
-    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
-    return new (P || (P = Promise))(function (resolve, reject) {
-        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
-        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
-        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
-        step((generator = generator.apply(thisArg, _arguments || [])).next());
-    });
-};
-var __importDefault = (this && this.__importDefault) || function (mod) {
-    return (mod && mod.__esModule) ? mod : { "default": mod };
-};
-Object.defineProperty(exports, "__esModule", { value: true });
-const express_1 = require("express");
-const multer_1 = __importDefault(require("multer"));
-const Snowflake_1 = __importDefault(require("../Snowflake"));
-const multer_ = multer_1.default();
-const router = express_1.Router();
-router.post("/:filename", multer_.single("attachment"), (req, res) => __awaiter(void 0, void 0, void 0, function* () {
-    const { buffer, mimetype } = req.file;
-    const { filename } = req.params;
-    const { db } = req.server;
-    const File = {
-        filename,
-        file: buffer.toString("base64"),
-        id: Snowflake_1.default.generate(),
-        type: mimetype,
-    };
-    if (!(yield db.data.attachments.push(File)))
-        throw new Error("Error uploading file");
-    return res.status(201).send({ success: true, message: "attachment uploaded", id: File.id, filename });
-}));
-router.get("/:hash/:filename", (req, res) => __awaiter(void 0, void 0, void 0, function* () {
-    const { db } = req.server;
-    const { hash, filename } = req.params;
-    const File = yield db.data.attachments({ id: hash, filename: filename }).get();
-    res.set("Content-Type", File.type);
-    return res.send(Buffer.from(File.file, "base64"));
-}));
-router.delete("/:hash/:filename", (req, res) => __awaiter(void 0, void 0, void 0, function* () {
-    const { hash, filename } = req.params;
-    const { db } = req.server;
-    yield db.data.attachments({ id: hash, filename: filename }).delete();
-    return res.send({ success: true, message: "attachment deleted" });
-}));
-exports.default = router;
-//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXR0YWNobWVudHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvcm91dGVzL2F0dGFjaG1lbnRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7O0FBQUEscUNBQWlDO0FBQ2pDLG9EQUE0QjtBQUM1Qiw2REFBcUM7QUFFckMsTUFBTSxPQUFPLEdBQUcsZ0JBQU0sRUFBRSxDQUFDO0FBQ3pCLE1BQU0sTUFBTSxHQUFHLGdCQUFNLEVBQUUsQ0FBQztBQVN4QixNQUFNLENBQUMsSUFBSSxDQUFDLFlBQVksRUFBRSxPQUFPLENBQUMsTUFBTSxDQUFDLFlBQVksQ0FBQyxFQUFFLENBQU8sR0FBRyxFQUFFLEdBQUcsRUFBRSxFQUFFO0lBQzFFLE1BQU0sRUFBRSxNQUFNLEVBQUUsUUFBUSxFQUFFLEdBQUcsR0FBRyxDQUFDLElBQUksQ0FBQztJQUN0QyxNQUFNLEVBQUUsUUFBUSxFQUFFLEdBQUcsR0FBRyxDQUFDLE1BQU0sQ0FBQztJQUNoQyxNQUFNLEVBQUUsRUFBRSxFQUFFLEdBQUcsR0FBRyxDQUFDLE1BQU0sQ0FBQztJQUUxQixNQUFNLElBQUksR0FBZTtRQUN4QixRQUFRO1FBQ1IsSUFBSSxFQUFFLE1BQU0sQ0FBQyxRQUFRLENBQUMsUUFBUSxDQUFDO1FBQy9CLEVBQUUsRUFBRSxtQkFBUyxDQUFDLFFBQVEsRUFBRTtRQUN4QixJQUFJLEVBQUUsUUFBUTtLQUNkLENBQUM7SUFFR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