Skip to content

📚 The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

Remove dist folder

Veauville Raphael48c2dad1ec09
diff --git a/backend/dist/app.js b/backend/dist/app.js
deleted file mode 100644
index 5b2aab47..00000000
--- a/backend/dist/app.js
+++ /dev/null
@@ -1,105 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.App = void 0;
-const tslib_1 = require("tslib");
-const fs_1 = require("fs");
-const path_1 = require("path");
-const express_1 = tslib_1.__importDefault(require("express"));
-const db_1 = tslib_1.__importDefault(require("./models/db"));
-const Logger_1 = tslib_1.__importDefault(require("./utils/Logger"));
-const functions_1 = require("./utils/functions");
-const Snowflake_1 = require("./utils/Snowflake");
-class App {
- constructor() {
- Object.defineProperty(this, "app", {
- enumerable: true,
- configurable: true,
- writable: true,
- value: void 0
- });
- Object.defineProperty(this, "port", {
- enumerable: true,
- configurable: true,
- writable: true,
- value: void 0
- });
- Object.defineProperty(this, "snowflake", {
- enumerable: true,
- configurable: true,
- writable: true,
- value: void 0
- });
- Object.defineProperty(this, "db", {
- enumerable: true,
- configurable: true,
- writable: true,
- value: void 0
- });
- Object.defineProperty(this, "uploads_dir", {
- enumerable: true,
- configurable: true,
- writable: true,
- value: void 0
- });
- Logger_1.default.debug(`Starting in ${process.env.NODE_ENV} mode...`);
- this.app = (0, express_1.default)();
- this.port = process.env.PORT || '3000';
- this.snowflake = new Snowflake_1.Snowflake(1661327668261);
- this.db = (0, db_1.default)('localhost', process.env.DATABASE_USER, process.env.DATABASE_PASSWORD, 'alexandrie');
- this.uploads_dir = (0, path_1.join)(__dirname, '../../uploads');
- }
- async handleRoutes() {
- const directories = (0, fs_1.readdirSync)((0, path_1.join)(__dirname, 'routes'));
- for (const dir of directories) {
- const routes = (0, fs_1.readdirSync)((0, path_1.join)(__dirname, `routes/${dir}`)).filter(file => file.endsWith('.js'));
- for (const file of routes) {
- const getFile = (await Promise.resolve(`${(0, path_1.join)(__dirname, `routes/${dir}/${file}`)}`).then(s => tslib_1.__importStar(require(s)))).default;
- const fileInfos = getFile(this);
- this.app.use(`/api/v${fileInfos.version}/${fileInfos.route}`, fileInfos.router());
- Logger_1.default.info(`Loaded route:`, `/api/v${fileInfos.version}/${fileInfos.route}`);
- }
- }
- }
- handleMiddlewares() {
- this.app.use(express_1.default.urlencoded({ extended: true, limit: '5mb' }));
- this.app.use(express_1.default.json({ limit: '5mb' }));
- this.app.use(function (req, res, next) {
- const origin = req.headers.origin;
- if (!origin || ![process.env.DOMAIN_CLIENT, process.env.DOMAIN_DASHBOARD].includes(origin))
- return next();
- res.setHeader('Access-Control-Allow-Origin', origin);
- res.setHeader('Access-Control-Allow-Headers', 'Access-Control-Allow-Headers, Origin,Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers');
- res.setHeader('Access-Control-Allow-Credentials', 'true');
- res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');
- next();
- });
- if (process.env.NODE_ENV !== 'production') {
- Logger_1.default.warn('Morgan is enabled in development mode.');
- const morgan = require('morgan')('dev');
- this.app.use(morgan);
- }
- }
- async start() {
- this.handleMiddlewares();
- await this.handleRoutes();
- const staticOptions = {
- dotfiles: 'ignore',
- etag: false,
- index: false,
- maxAge: '7d',
- redirect: false,
- setHeaders: function (res) {
- res.set('x-timestamp', Date.now().toString());
- },
- };
- this.app.use('/static', express_1.default.static((0, path_1.join)(__dirname, '../../uploads'), staticOptions));
- this.app.listen(this.port, () => {
- Logger_1.default.success(`Started on port ${this.port}`);
- });
- this.app.all('*', (_, res) => {
- res.status(404).json((0, functions_1.checkAndChange)(new Error('404 not found')));
- });
- }
-}
-exports.App = App;
-//# sourceMappingURL=app.js.map
\ No newline at end of file
diff --git a/backend/dist/app.js.map b/backend/dist/app.js.map
deleted file mode 100644
index 4d1cae51..00000000
--- a/backend/dist/app.js.map
+++ /dev/null
@@ -1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AG,CAAC,CAAC,IAAI,CAAC,IAAA,0BAAc,EAAC,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AArED,kBAqEC","sourcesContent":["import { readdirSync } from 'fs';\nimport { join } from 'path';\nimport express from 'express';\nimport { Pool } from 'mysql2';\nimport type { Request, Response } from 'express';\n\nimport type { Iroute } from './types';\n\nimport db from './models/db';\nimport Logger from './utils/Logger';\nimport { checkAndChange } from './utils/functions';\nimport { Snowflake } from './utils/Snowflake';\n\nexport class App {\n private app;\n public port: string;\n public snowflake: Snowflake;\n public db: Pool;\n public uploads_dir: string;\n constructor() {\n Logger.debug(`Starting in ${process.env.NODE_ENV} mode...`);\n this.app = express();\n this.port = process.env.PORT || '3000';\n this.snowflake = new Snowflake(1661327668261);\n this.db = db('localhost', process.env.DATABASE_USER, process.env.DATABASE_PASSWORD, 'alexandrie');\n this.uploads_dir = join(__dirname, '../../uploads');\n }\n private async handleRoutes() {\n const directories = readdirSync(join(__dirname, 'routes'));\n for (const dir of directories) {\n const routes = readdirSync(join(__dirname, `routes/${dir}`)).filter(file => file.endsWith('.js'));\n for (const file of routes) {\n const getFile = (await import(join(__dirname, `routes/${dir}/${file}`))).default;\n const fileInfos = getFile(this) as Iroute;\n this.app.use(`/api/v${fileInfos.version}/${fileInfos.route}`, fileInfos.router());\n Logger.info(`Loaded route:`, `/api/v${fileInfos.version}/${fileInfos.route}`);\n }\n }\n }\n private handleMiddlewares(): void {\n this.app.use(express.urlencoded({ extended: true, limit: '5mb' }));\n this.app.use(express.json({ limit: '5mb' }));\n this.app.use(function (req: Request, res: Response, next: Function) {\n const origin = req.headers.origin;\n if (!origin || ![process.env.DOMAIN_CLIENT, process.env.DOMAIN_DASHBOARD].includes(origin)) return next();\n res.setHeader('Access-Control-Allow-Origin', origin);\n res.setHeader(\n 'Access-Control-Allow-Headers',\n 'Access-Control-Allow-Headers, Origin,Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers',\n );\n res.setHeader('Access-Control-Allow-Credentials', 'true');\n res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');\n next();\n });\n if (process.env.NODE_ENV !== 'production') {\n Logger.warn('Morgan is enabled in development mode.');\n const morgan = require('morgan')('dev');\n this.app.use(morgan);\n }\n }\n public async start() {\n this.handleMiddlewares();\n await this.handleRoutes();\n const staticOptions = {\n dotfiles: 'ignore',\n etag: false,\n index: false,\n maxAge: '7d',\n redirect: false,\n setHeaders: function (res: Response) {\n res.set('x-timestamp', Date.now().toString());\n },\n };\n this.app.use('/static', express.static(join(__dirname, '../../uploads'), staticOptions));\n\n this.app.listen(this.port, () => {\n Logger.success(`Started on port ${this.port}`);\n });\n this.app.all('*', (_: Request, res: Response) => {\n res.status(404).json(checkAndChange(new Error('404 not found')));\n });\n }\n}\n"]}
\ No newline at end of file
diff --git a/backend/dist/classes/Base.js b/backend/dist/classes/Base.js
deleted file mode 100644
index 9ca0d272..00000000
--- a/backend/dist/classes/Base.js
+++ /dev/null
@@ -1,18 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-class Base {
- constructor(app) {
- // Define the app main class
- Object.defineProperty(this, "app", {
- enumerable: true,
- configurable: true,
- writable: true,
- value: void 0
- });
- if (!app)
- throw new Error("App is not defined");
- this.app = app;
- }
-}
-exports.default = Base;
-//# sourceMappingURL=Base.js.map
\ No newline at end of file
diff --git a/backend/dist/classes/Base.js.map b/backend/dist/classes/Base.js.map
deleted file mode 100644
index 504d73d8..00000000
--- a/backend/dist/classes/Base.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"Base.js","sourceRoot":"","sources":["../../classes/Base.ts"],"names":[],"mappings":";;AAEA,MAAqB,IAAI;IAIvB,YAAY,GAAQ;QAHpB,4BAA4B;QACnB;;;;;WAAS;QAGhB,IAAI,CAAC,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;QAChD,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;CACF;AARD,uBAQC","sourcesContent":["import { App } from \"../app\";\n\nexport default class Base {\n // Define the app main class\n readonly app: App;\n\n constructor(app: App) {\n if (!app) throw new Error(\"App is not defined\");\n this.app = app;\n }\n}\n"]}
\ No newline at end of file
diff --git a/backend/dist/classes/Categories.js b/backend/dist/classes/Categories.js
deleted file mode 100644
index 946c60a0..00000000
--- a/backend/dist/classes/Categories.js
+++ /dev/null
@@ -1,59 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-const tslib_1 = require("tslib");
-const Base_1 = tslib_1.__importDefault(require("./Base"));
-class CategoriesDB extends Base_1.default {
- constructor(app) {
- super(app);
- }
- getAll() {
- return new Promise((resolve, reject) => {
- this.app.db.query('SELECT * FROM `categories` ORDER BY `order`', [], (err, themes) => {
- if (err)
- return reject('Internal database error.');
- resolve(themes);
- });
- });
- }
- add(data) {
- return new Promise((resolve, reject) => {
- const id = this.app.snowflake.generate().toString();
- if (!data.name)
- return reject(new Error('[MISSING_KEY] : name must be provided'));
- this.app.db.query('INSERT INTO categories (`id`, `name`,`icon`, `order`, `parent_id`) VALUES (?, ?, ?, ?, ?)', [id, data.name, data.icon, data.order, data.parent_id], err => {
- if (err)
- return reject('Internal database error.');
- else
- resolve({ id, ...data });
- });
- });
- }
- update(data) {
- return new Promise((resolve, reject) => {
- if (!data.id)
- return reject(new Error('[MISSING_KEY] : id must be provided'));
- if (!data.name)
- return reject(new Error('[MISSING_KEY] : name must be provided'));
- this.app.db.query('UPDATE categories SET name = ?, icon = ?, `order` = ?, parent_id = ? WHERE id = ?', [data.name, data.icon, data.order, data.parent_id, data.id], err => {
- if (err)
- return reject('Internal database error.');
- else
- resolve(data);
- });
- });
- }
- delete(id) {
- return new Promise((resolve, reject) => {
- if (!id)
- return reject(new Error('[MISSING_KEY] : id must be provided'));
- this.app.db.query('DELETE FROM categories WHERE id = ?', [id], err => {
- if (err)
- return reject('Internal database error.');
- else
- resolve(true);
- });
- });
- }
-}
-exports.default = CategoriesDB;
-//# sourceMappingURL=Categories.js.map
\ No newline at end of file
diff --git a/backend/dist/classes/Categories.js.map b/backend/dist/classes/Categories.js.map
deleted file mode 100644
index 4986434d..00000000
--- a/backend/dist/classes/Categories.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"Categories.js","sourceRoot":"","sources":["../../classes/Categories.ts"],"names":[],"mappings":";;;AAAA,0DAA0B;AAI1B,MAAqB,YAAa,SAAQ,cAAI;IAC5C,YAAY,GAAQ;QAClB,KAAK,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;IAEM,MAAM;QACX,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAe,6CAA6C,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;gBACjG,IAAI,GAAG;oBAAE,OAAO,MAAM,CAAC,0BAA0B,CAAC,CAAC;gBACnD,OAAO,CAAC,MAAM,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,GAAG,CAAC,IAA0B;QACnC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC;YACpD,IAAI,CAAC,IAAI,CAAC,IAAI;gBAAE,OAAO,MAAM,CAAC,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC,CAAC;YAClF,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CACf,2FAA2F,EAC3F,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK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nE,IAAI,GAAG;oBAAE,OAAO,MAAM,CAAC,0BAA0B,CAAC,CAAC;;oBAC9C,OAAO,CAAC,IAAI,CAAC,CAAC;YACrB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAtDD,+BAsDC","sourcesContent":["import Base from './Base';\nimport type { App } from '../app';\nimport type { Category, CategoryDB } from '../types';\n\nexport default class CategoriesDB extends Base {\n constructor(app: App) {\n super(app);\n }\n\n public getAll(): Promise<Category[]> {\n return new Promise((resolve, reject) => {\n this.app.db.query<CategoryDB[]>('SELECT * FROM `categories` ORDER BY `order`', [], (err, themes) => {\n if (err) return reject('Internal database error.');\n resolve(themes);\n });\n });\n }\n\n public add(data: Omit<Category, 'id'>): Promise<Category> {\n return new Promise((resolve, reject) => {\n const id = this.app.snowflake.generate().toString();\n if (!data.name) return reject(new Error('[MISSING_KEY] : name must be provided'));\n this.app.db.query(\n 'INSERT INTO categories (`id`, `name`,`icon`, `order`, `parent_id`) VALUES (?, ?, ?, ?, ?)',\n [id, data.name, data.icon, data.order, data.parent_id],\n err => {\n if (err) return reject('Internal database error.');\n else resolve({ id, ...data });\n },\n );\n });\n }\n\n update(data: Category): Promise<Category> {\n return new Promise((resolve, reject) => {\n if (!data.id) return reject(new Error('[MISSING_KEY] : id must be provided'));\n if (!data.name) return reject(new Error('[MISSING_KEY] : name must be provided'));\n\n this.app.db.query(\n 'UPDATE categories SET name = ?, icon = ?, `order` = ?, parent_id = ? WHERE id = ?',\n [data.name, data.icon, data.order, data.parent_id, data.id],\n err => {\n if (err) return reject('Internal database error.');\n else resolve(data);\n },\n );\n });\n }\n\n public delete(id: Category['id']): Promise<boolean> {\n return new Promise((resolve, reject) => {\n if (!id) return reject(new Error('[MISSING_KEY] : id must be provided'));\n this.app.db.query('DELETE FROM categories WHERE id = ?', [id], err => {\n if (err) return reject('Internal database error.');\n else resolve(true);\n });\n });\n }\n}\n"]}
\ No newline at end of file
diff --git a/backend/dist/classes/DocumentsManager.js b/backend/dist/classes/DocumentsManager.js
deleted file mode 100644
index 71f5f810..00000000
--- a/backend/dist/classes/DocumentsManager.js
+++ /dev/null
@@ -1,113 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-const tslib_1 = require("tslib");
-const Base_1 = tslib_1.__importDefault(require("./Base"));
-class DocumentsManager extends Base_1.default {
- constructor(app) {
- super(app);
- }
- getAll(all) {
- // If all is true, return all documents, else return only public documents (accessibility = 1)
- return new Promise((resolve, reject) => {
- this.app.db.query(`SELECT * FROM documents ${all == 'true' ? '' : 'WHERE `accessibility` = 1'} ORDER BY \`name\``, (err, result) => {
- if (err)
- return reject('Internal database error.');
- resolve(result);
- });
- });
- }
- getAllByCategory(category) {
- return new Promise((resolve, reject) => {
- if (!category)
- return reject(new Error('[MISSING_KEY] : category must be provided'));
- this.app.db.query('SELECT * FROM documents WHERE category = ? AND `accessibility` = 1 ORDER BY `name`', [category], (err, result) => {
- if (err)
- return reject('Internal database error.');
- resolve(result);
- });
- });
- }
- get(id) {
- return new Promise((resolve, reject) => {
- if (!id)
- return reject(new Error('[MISSING_KEY] : id must be provided'));
- this.app.db.query('SELECT * FROM documents WHERE id = ?', [id], (err, result) => {
- if (err)
- return reject('Internal database error.');
- if (!result[0])
- return reject('Document not found.');
- resolve(result[0]);
- });
- });
- }
- add(data) {
- return new Promise((resolve, reject) => {
- const time = Date.now().toString();
- const id = this.app.snowflake.generate().toString();
- if (!data.name)
- return reject(new Error('[MISSING_KEY] : name must be provided'));
- if (!data.accessibility && data.accessibility != 0)
- return reject(new Error('[MISSING_KEY] : accessibility must be provided'));
- if (!data.author_id)
- return reject(new Error('[MISSING_KEY] : author_id must be provided'));
- this.app.db.query('INSERT INTO documents (`id`, `name`, `description`, `tags`, `category`, `accessibility`, `content_markdown`, `content_html`, `author_id`, `created_timestamp`, `updated_timestamp`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', [
- id,
- data.name,
- data.description,
- data.tags,
- data.category,
- data.accessibility,
- data.content_markdown,
- data.content_html,
- data.author_id,
- time,
- time,
- ], err => {
- if (err)
- return reject('Internal database error.');
- resolve({ id, ...data, created_timestamp: time, updated_timestamp: time });
- });
- });
- }
- put(id, data) {
- return new Promise((resolve, reject) => {
- if (!id)
- return reject(new Error('[MISSING_KEY] : id must be provided'));
- if (!data.name)
- return reject(new Error('[MISSING_KEY] : name must be provided'));
- if (!data.accessibility && data.accessibility != 0)
- return reject(new Error('[MISSING_KEY] : accessibility must be provided'));
- if (!data.author_id)
- return reject(new Error('[MISSING_KEY] : author_id must be provided'));
- const time = Date.now().toString();
- this.app.db.query('UPDATE documents SET name = ?, description = ?, tags = ?, category = ?, accessibility = ?, content_markdown = ?, content_html = ?, updated_timestamp = ? WHERE id = ?', [
- data.name,
- data.description,
- data.tags,
- data.category,
- data.accessibility,
- data.content_markdown,
- data.content_html,
- time,
- id,
- ], err => {
- if (err)
- return reject('Internal database error.');
- resolve({ id, ...data, updated_timestamp: time });
- });
- });
- }
- delete(id) {
- return new Promise((resolve, reject) => {
- if (!id)
- return reject(new Error('[MISSING_KEY] : id must be provided'));
- this.app.db.query('DELETE FROM documents WHERE id = ?', [id], err => {
- if (err)
- return reject('Internal database error.');
- resolve(true);
- });
- });
- }
-}
-exports.default = DocumentsManager;
-//# sourceMappingURL=DocumentsManager.js.map
\ No newline at end of file
diff --git a/backend/dist/classes/DocumentsManager.js.map b/backend/dist/classes/DocumentsManager.js.map
deleted file mode 100644
index b3e8fc02..00000000
--- a/backend/dist/classes/DocumentsManager.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"DocumentsManager.js","sourceRoot":"","sources":["../../classes/DocumentsManager.ts"],"names":[],"mappings":";;;AAAA,0DAA0B;AAI1B,MAAqB,gBAAiB,SAAQ,cAAI;IAChD,YAAY,GAAQ;QAClB,KAAK,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;IAEM,MAAM,CAAC,GAAY;QACxB,8FAA8F;QAC9F,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AE,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC;YACpD,CAAC,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,MAAM,CAAC,EAAU;QACtB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,IAAI,CAAC,EAAE;gBAAE,OAAO,MAAM,CAAC,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC,CAAC;YACzE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAe,oCAAoC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE;gBAChF,IAAI,GAAG;oBAAE,OAAO,MAAM,CAAC,0BAA0B,CAAC,CAAC;gBACnD,OAAO,CAAC,IAAI,CAAC,CAAC;YAChB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA9GD,mCA8GC","sourcesContent":["import Base from './Base';\nimport type { App } from '../app';\nimport type { Document, DocumentDB } from '../types';\n\nexport default class DocumentsManager extends Base {\n constructor(app: App) {\n super(app);\n }\n\n public getAll(all?: string) {\n // If all is true, return all documents, else return only public documents (accessibility = 1)\n return new Promise<Document[]>((resolve, reject) => {\n this.app.db.query<DocumentDB[]>(\n `SELECT * FROM documents ${all == 'true' ? '' : 'WHERE `accessibility` = 1'} ORDER BY \\`name\\``,\n (err, result) => {\n if (err) return reject('Internal database error.');\n resolve(result);\n },\n );\n });\n }\n\n public getAllByCategory(category: string) {\n return new Promise<Document[]>((resolve, reject) => {\n if (!category) return reject(new Error('[MISSING_KEY] : category must be provided'));\n this.app.db.query<DocumentDB[]>(\n 'SELECT * FROM documents WHERE category = ? AND `accessibility` = 1 ORDER BY `name`',\n [category],\n (err, result) => {\n if (err) return reject('Internal database error.');\n resolve(result);\n },\n );\n });\n }\n get(id: string) {\n return new Promise<Document>((resolve, reject) => {\n if (!id) return reject(new Error('[MISSING_KEY] : id must be provided'));\n this.app.db.query<DocumentDB[]>('SELECT * FROM documents WHERE id = ?', [id], (err, result) => {\n if (err) return reject('Internal database error.');\n if (!result[0]) return reject('Document not found.');\n resolve(result[0]);\n });\n });\n }\n public add(data: Omit<Document, 'id' | 'created_timestamp' | 'updated_timestamp'>) {\n return new Promise((resolve, reject) => {\n const time = Date.now().toString();\n const id = this.app.snowflake.generate().toString();\n if (!data.name) return reject(new Error('[MISSING_KEY] : name must be provided'));\n if (!data.accessibility && data.accessibility != 0)\n return reject(new Error('[MISSING_KEY] : accessibility must be provided'));\n if (!data.author_id) return reject(new Error('[MISSING_KEY] : author_id must be provided'));\n\n this.app.db.query<DocumentDB[]>(\n 'INSERT INTO documents (`id`, `name`, `description`, `tags`, `category`, `accessibility`, `content_markdown`, `content_html`, `author_id`, `created_timestamp`, `updated_timestamp`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)',\n [\n id,\n data.name,\n data.description,\n data.tags,\n data.category,\n data.accessibility,\n data.content_markdown,\n data.content_html,\n data.author_id,\n time,\n time,\n ],\n err => {\n if (err) return reject('Internal database error.');\n resolve({ id, ...data, created_timestamp: time, updated_timestamp: time });\n },\n );\n });\n }\n public put(id: string, data: Omit<Document, 'id' | 'created_timestamp' | 'updated_timestamp'>) {\n return new Promise((resolve, reject) => {\n if (!id) return reject(new Error('[MISSING_KEY] : id must be provided'));\n if (!data.name) return reject(new Error('[MISSING_KEY] : name must be provided'));\n if (!data.accessibility && data.accessibility != 0)\n return reject(new Error('[MISSING_KEY] : accessibility must be provided'));\n if (!data.author_id) return reject(new Error('[MISSING_KEY] : author_id must be provided'));\n const time = Date.now().toString();\n this.app.db.query<DocumentDB[]>(\n 'UPDATE documents SET name = ?, description = ?, tags = ?, category = ?, accessibility = ?, content_markdown = ?, content_html = ?, updated_timestamp = ? WHERE id = ?',\n [\n data.name,\n data.description,\n data.tags,\n data.category,\n data.accessibility,\n data.content_markdown,\n data.content_html,\n time,\n id,\n ],\n err => {\n if (err) return reject('Internal database error.');\n resolve({ id, ...data, updated_timestamp: time });\n },\n );\n });\n }\n\n public delete(id: string) {\n return new Promise((resolve, reject) => {\n if (!id) return reject(new Error('[MISSING_KEY] : id must be provided'));\n this.app.db.query<DocumentDB[]>('DELETE FROM documents WHERE id = ?', [id], err => {\n if (err) return reject('Internal database error.');\n resolve(true);\n });\n });\n }\n}\n"]}
\ No newline at end of file
diff --git a/backend/dist/classes/Users.js b/backend/dist/classes/Users.js
deleted file mode 100644
index b0ded962..00000000
--- a/backend/dist/classes/Users.js
+++ /dev/null
@@ -1,30 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-const tslib_1 = require("tslib");
-const Base_1 = tslib_1.__importDefault(require("./Base"));
-const bcrypt_1 = require("bcrypt");
-class MemberClass extends Base_1.default {
- constructor(app) {
- super(app);
- }
- auth(username, password) {
- return new Promise((resolve, reject) => {
- if (!username || (username && username.trim() === ''))
- return reject('Username must be provided.');
- if (!password || (password && password.trim() === ''))
- return reject('Password must be provided.');
- this.app.db.query('SELECT * FROM users WHERE username = ? LIMIT 1', [username], async (err, results) => {
- if (err)
- return reject('Internal database error.');
- if (!results[0])
- return reject('Bad username/password.');
- const valid = await (0, bcrypt_1.compare)(password, results[0].password);
- if (!valid)
- return reject('Bad username/password.');
- resolve(results[0]);
- });
- });
- }
-}
-exports.default = MemberClass;
-//# sourceMappingURL=Users.js.map
\ No newline at end of file
diff --git a/backend/dist/classes/Users.js.map b/backend/dist/classes/Users.js.map
deleted file mode 100644
index 65f27302..00000000
--- a/backend/dist/classes/Users.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"Users.js","sourceRoot":"","sources":["../../classes/Users.ts"],"names":[],"mappings":";;;AAAA,0DAA0B;AAC1B,mCAAiC;AAIjC,MAAqB,WAAY,SAAQ,cAAI;IAC3C,YAAY,GAAQ;QAClB,KAAK,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;IACM,IAAI,CAAC,QAAgB,EAAE,QAAgB;QAC5C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;gBAAE,OAAO,MAAM,CAAC,4BAA4B,CAAC,CAAC;YACnG,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;gBAAE,OAAO,MAAM,CAAC,4BAA4B,CAAC,CAAC;YACnG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAW,gDAAgD,EAAE,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE;gBAC/G,IAAI,GAAG;oBAAE,OAAO,MAAM,CAAC,0BAA0B,CAAC,CAAC;gBACnD,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;oBAAE,OAAO,MAAM,CAAC,wBAAwB,CAAC,CAAC;gBACzD,MAAM,KAAK,GAAG,MAAM,IAAA,gBAAO,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;gBAC3D,IAAI,CAAC,KAAK;oBAAE,OAAO,MAAM,CAAC,wBAAwB,CAAC,CAAC;gBACpD,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;YACtB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAjBD,8BAiBC","sourcesContent":["import Base from './Base';\nimport { compare } from 'bcrypt';\nimport type { IObject, UserDB } from '../types';\nimport type { App } from '../app';\n\nexport default class MemberClass extends Base {\n constructor(app: App) {\n super(app);\n }\n public auth(username: string, password: string): Promise<IObject> {\n return new Promise((resolve, reject) => {\n if (!username || (username && username.trim() === '')) return reject('Username must be provided.');\n if (!password || (password && password.trim() === '')) return reject('Password must be provided.');\n this.app.db.query<UserDB[]>('SELECT * FROM users WHERE username = ? LIMIT 1', [username], async (err, results) => {\n if (err) return reject('Internal database error.');\n if (!results[0]) return reject('Bad username/password.');\n const valid = await compare(password, results[0].password);\n if (!valid) return reject('Bad username/password.');\n resolve(results[0]);\n });\n });\n }\n}\n"]}
\ No newline at end of file
diff --git a/backend/dist/controllers/auth.controller.js b/backend/dist/controllers/auth.controller.js
deleted file mode 100644
index 6263a91f..00000000
--- a/backend/dist/controllers/auth.controller.js
+++ /dev/null
@@ -1,43 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-const tslib_1 = require("tslib");
-const Users_1 = tslib_1.__importDefault(require("../classes/Users"));
-const functions_1 = require("../utils/functions");
-const jsonwebtoken_1 = require("jsonwebtoken");
-const COOKIE_CONFIG = {
- maxAge: 3600000 * 3,
- httpOnly: true,
- domain: process.env.FRONT_DOMAIN,
- secure: process.env.NODE_ENV == 'production' ? true : false,
- sameSite: 'lax',
-};
-class Authentification {
- constructor(app) {
- Object.defineProperty(this, "Users", {
- enumerable: true,
- configurable: true,
- writable: true,
- value: void 0
- });
- this.Users = new Users_1.default(app);
- }
- authentification(_, req, res) {
- this.Users.auth(req.body.username, req.body.password)
- .then(result => {
- const token = (0, jsonwebtoken_1.sign)({ expiresIn: '6h', userId: result.id }, process.env.JWT_SECRET || '');
- res.cookie('user_token', `${token}`, COOKIE_CONFIG); //process.env.NODE_ENV == 'production' ? 'None' : 'lax'
- res.cookie('user_id', `${result.id}`, COOKIE_CONFIG); //process.env.NODE_ENV == 'production' ? 'None' : 'lax'
- res.cookie('user_auth', `true`, { ...COOKIE_CONFIG, httpOnly: false }); //process.env.NODE_ENV == 'production' ? 'None' : 'lax'
- res.status(200).json((0, functions_1.success)({ auth: true }));
- })
- .catch(e => res.json((0, functions_1.error)(e)));
- }
- disconnection(_, __, res) {
- res.clearCookie('user_auth', { domain: process.env.FRONT_DOMAIN });
- res.clearCookie('user_id', { domain: process.env.FRONT_DOMAIN });
- res.clearCookie('user_token', { domain: process.env.FRONT_DOMAIN });
- res.status(200).json((0, functions_1.success)('success'));
- }
-}
-exports.default = Authentification;
-//# sourceMappingURL=auth.controller.js.map
\ No newline at end of file
diff --git a/backend/dist/controllers/auth.controller.js.map b/backend/dist/controllers/auth.controller.js.map
deleted file mode 100644
index a9f4187f..00000000
--- a/backend/dist/controllers/auth.controller.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"auth.controller.js","sourceRoot":"","sources":["../../controllers/auth.controller.ts"],"names":[],"mappings":";;;AAAA,qEAA4C;AAC5C,kDAAoD;AACpD,+CAAoC;AAIpC,MAAM,aAAa,GAAkB;IACnC,MAAM,EAAE,OAAO,GAAG,CAAC;IACnB,QAAQ,EAAE,IAAI;IACd,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY;IAChC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK;IAC3D,QAAQ,EAAE,KAAK;CAChB,CAAC;AAEF,MAAqB,gBAAgB;IAEnC,YAAY,GAAQ;QADpB;;;;;WAAoB;QAElB,IAAI,CAAC,KAAK,GAAG,IAAI,eAAY,CAAC,GAAG,CAAC,CAAC;IACrC,CAAC;IACD,gBAAgB,CAAC,CAAM,EAAE,GAAY,EAAE,GAAa;QAClD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;aAClD,IAAI,CAAC,MAAM,CAAC,EAAE;YACb,MAAM,KAAK,GAAG,IAAA,mBAAI,EAAC,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC;YACzF,GAAG,CAAC,MAAM,CAAC,YAAY,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,CAAC,CAAC,CAAC,uDAAuD;YAC5G,GAAG,CAAC,MAAM,CAAC,SAAS,EAAE,GAAG,MAAM,CAAC,EAAE,EAAE,EAAE,aAAa,CAAC,CAAC,CAAC,uDAAuD;YAC7G,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,GAAG,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,uDAAuD;YAC/H,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAA,mBAAO,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAChD,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,IAAA,iBAAK,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,CAAC;IACD,aAAa,CAAC,CAAM,EAAE,EAAW,EAAE,GAAa;QAC9C,GAAG,CAAC,WAAW,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC;QACnE,GAAG,CAAC,WAAW,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC;QACjE,GAAG,CAAC,WAAW,CAAC,YAAY,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC;QACpE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAA,mBAAO,EAAC,SAAS,CAAC,CAAC,CAAC;IAC3C,CAAC;CACF;AAtBD,mCAsBC","sourcesContent":["import UsersManager from '../classes/Users';\nimport { success, error } from '../utils/functions';\nimport { sign } from 'jsonwebtoken';\nimport type { CookieOptions, Request, Response } from 'express';\nimport type { App } from '../app';\n\nconst COOKIE_CONFIG: CookieOptions = {\n maxAge: 3600000 * 3,\n httpOnly: true,\n domain: process.env.FRONT_DOMAIN,\n secure: process.env.NODE_ENV == 'production' ? true : false,\n sameSite: 'lax',\n};\n\nexport default class Authentification {\n Users: UsersManager;\n constructor(app: App) {\n this.Users = new UsersManager(app);\n }\n authentification(_: App, req: Request, res: Response): void {\n this.Users.auth(req.body.username, req.body.password)\n .then(result => {\n const token = sign({ expiresIn: '6h', userId: result.id }, process.env.JWT_SECRET || '');\n res.cookie('user_token', `${token}`, COOKIE_CONFIG); //process.env.NODE_ENV == 'production' ? 'None' : 'lax'\n res.cookie('user_id', `${result.id}`, COOKIE_CONFIG); //process.env.NODE_ENV == 'production' ? 'None' : 'lax'\n res.cookie('user_auth', `true`, { ...COOKIE_CONFIG, httpOnly: false }); //process.env.NODE_ENV == 'production' ? 'None' : 'lax'\n res.status(200).json(success({ auth: true }));\n })\n .catch(e => res.json(error(e)));\n }\n disconnection(_: App, __: Request, res: Response): void {\n res.clearCookie('user_auth', { domain: process.env.FRONT_DOMAIN });\n res.clearCookie('user_id', { domain: process.env.FRONT_DOMAIN });\n res.clearCookie('user_token', { domain: process.env.FRONT_DOMAIN });\n res.status(200).json(success('success'));\n }\n}\n"]}
\ No newline at end of file
diff --git a/backend/dist/controllers/backups.controller.js b/backend/dist/controllers/backups.controller.js
deleted file mode 100644
index 4465c1fb..00000000
--- a/backend/dist/controllers/backups.controller.js
+++ /dev/null
@@ -1,47 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-const fs_1 = require("fs");
-const child_process_1 = require("child_process");
-const functions_1 = require("../utils/functions");
-class CategoriesController {
- constructor(app) {
- Object.defineProperty(this, "app", {
- enumerable: true,
- configurable: true,
- writable: true,
- value: void 0
- });
- this.app = app;
- }
- async add(_, res) {
- // Clean the uploads directory
- const files = (0, fs_1.readdirSync)(this.app.uploads_dir + '/backups');
- for (const file of files) {
- if (file.endsWith('.sql'))
- (0, fs_1.unlinkSync)(`${this.app.uploads_dir}/backups/${file}`);
- }
- const name = `backup-${new Date().toISOString().split('T')[0]}-${Date.now()}`;
- const mysqldump = (0, child_process_1.spawn)('mysqldump', [
- '-u',
- `${process.env.DATABASE_USER}`,
- `-p${process.env.DATABASE_PASSWORD}`,
- 'alexandrie',
- ]);
- const wstream = (0, fs_1.createWriteStream)(`${this.app.uploads_dir}/backups/${name}.sql`);
- const backupPromise = new Promise((resolve, reject) => {
- mysqldump.stdout
- .pipe(wstream)
- .on('finish', function () {
- resolve();
- })
- .on('error', function (err) {
- reject(err.message);
- });
- });
- backupPromise
- .then(() => res.json((0, functions_1.success)({ url: `/backups/${name}.sql` })))
- .catch((err) => res.json((0, functions_1.error)(err.message)));
- }
-}
-exports.default = CategoriesController;
-//# sourceMappingURL=backups.controller.js.map
\ No newline at end of file
diff --git a/backend/dist/controllers/backups.controller.js.map b/backend/dist/controllers/backups.controller.js.map
deleted file mode 100644
index 1ec4ae3f..00000000
--- a/backend/dist/controllers/backups.controller.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"backups.controller.js","sourceRoot":"","sources":["../../controllers/backups.controller.ts"],"names":[],"mappings":";;AAAA,2BAAgE;AAChE,iDAAsC;AAItC,kDAAoD;AAEpD,MAAqB,oBAAoB;IAEvC,YAAY,GAAQ;QADpB;;;;;WAAS;QAEP,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,CAAU,EAAE,GAAa;QACjC,8BAA8B;QAC9B,MAAM,KAAK,GAAG,IAAA,gBAAW,EAAC,IAAI,CAAC,GAAG,CAAC,WAAW,GAAG,UAAU,CAAC,CAAC;QAC7D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;YACxB,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;gBAAE,IAAA,eAAU,EAAC,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,YAAY,IAAI,EAAE,CAAC,CAAC;SAClF;QACD,MAAM,IAAI,GAAG,UAAU,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;QAC9E,MAAM,SAAS,GAAG,IAAA,qBAAK,EAAC,WAAW,EAAE;YACnC,IAAI;YACJ,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE;YAC9B,KAAK,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE;YACpC,YAAY;SACb,CAAC,CAAC;QAEH,MAAM,OAAO,GAAG,IAAA,sBAAiB,EAAC,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,YAAY,IAAI,MAAM,CAAC,CAAC;QACjF,MAAM,aAAa,GAAG,IAAI,OAAO,CAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACnE,SAAS,CAAC,MAAM;iBACb,IAAI,CAAC,OAAO,CAAC;iBACb,EAAE,CAAC,QAAQ,EAAE;gBACZ,OAAO,EAAE,CAAC;YACZ,CAAC,CAAC;iBACD,EAAE,CAAC,OAAO,EAAE,UAAU,GAAG;gBACxB,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACtB,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;QACH,aAAa;aACV,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,IAAA,mBAAO,EAAC,EAAE,GAAG,EAAE,YAAY,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC;aAC9D,KAAK,CAAC,CAAC,GAAU,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,IAAA,iBAAK,EAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACzD,CAAC;CACF;AAnCD,uCAmCC","sourcesContent":["import { createWriteStream, unlinkSync, readdirSync } from 'fs';\nimport { spawn } from 'child_process';\n\nimport type { Request, Response } from 'express';\nimport type { App } from '../app';\nimport { error, success } from '../utils/functions';\n\nexport default class CategoriesController {\n app: App;\n constructor(app: App) {\n this.app = app;\n }\n\n async add(_: Request, res: Response) {\n // Clean the uploads directory\n const files = readdirSync(this.app.uploads_dir + '/backups');\n for (const file of files) {\n if (file.endsWith('.sql')) unlinkSync(`${this.app.uploads_dir}/backups/${file}`);\n }\n const name = `backup-${new Date().toISOString().split('T')[0]}-${Date.now()}`;\n const mysqldump = spawn('mysqldump', [\n '-u',\n `${process.env.DATABASE_USER}`,\n `-p${process.env.DATABASE_PASSWORD}`,\n 'alexandrie',\n ]);\n\n const wstream = createWriteStream(`${this.app.uploads_dir}/backups/${name}.sql`);\n const backupPromise = new Promise<void | string>((resolve, reject) => {\n mysqldump.stdout\n .pipe(wstream)\n .on('finish', function () {\n resolve();\n })\n .on('error', function (err) {\n reject(err.message);\n });\n });\n backupPromise\n .then(() => res.json(success({ url: `/backups/${name}.sql` })))\n .catch((err: Error) => res.json(error(err.message)));\n }\n}\n"]}
\ No newline at end of file
diff --git a/backend/dist/controllers/categories.controller.js b/backend/dist/controllers/categories.controller.js
deleted file mode 100644
index 626c937d..00000000
--- a/backend/dist/controllers/categories.controller.js
+++ /dev/null
@@ -1,55 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-const tslib_1 = require("tslib");
-const Categories_1 = tslib_1.__importDefault(require("../classes/Categories"));
-const functions_1 = require("../utils/functions");
-class CategoriesController {
- constructor(app) {
- Object.defineProperty(this, "app", {
- enumerable: true,
- configurable: true,
- writable: true,
- value: void 0
- });
- Object.defineProperty(this, "db_c", {
- enumerable: true,
- configurable: true,
- writable: true,
- value: void 0
- });
- this.app = app;
- this.db_c = new Categories_1.default(app);
- }
- getAll(_, res) {
- this.db_c
- .getAll()
- .then((result) => res.status(200).json((0, functions_1.success)(result)))
- .catch((err) => res.status(500).json((0, functions_1.error)(err.message)));
- }
- add(req, res) {
- this.db_c
- .add({ name: req.body.name, icon: req.body.icon, order: req.body.order, parent_id: req.body.parent_id })
- .then(r => res.status(201).json((0, functions_1.success)(r)))
- .catch(err => res.status(500).json((0, functions_1.error)(err.message)));
- }
- update(req, res) {
- this.db_c
- .update({
- id: req.params.id,
- name: req.body.name,
- icon: req.body.icon,
- order: req.body.order,
- parent_id: req.body.parent_id,
- })
- .then(r => res.status(200).json((0, functions_1.success)(r)))
- .catch(err => res.status(500).json((0, functions_1.error)(err.message)));
- }
- delete(req, res) {
- this.db_c
- .delete(req.params.id)
- .then(r => res.status(200).json((0, functions_1.success)(r)))
- .catch(err => res.status(500).json((0, functions_1.error)(err.message)));
- }
-}
-exports.default = CategoriesController;
-//# sourceMappingURL=categories.controller.js.map
\ No newline at end of file
diff --git a/backend/dist/controllers/categories.controller.js.map b/backend/dist/controllers/categories.controller.js.map
deleted file mode 100644
index 6d1784ba..00000000
--- a/backend/dist/controllers/categories.controller.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"categories.controller.js","sourceRoot":"","sources":["../../controllers/categories.controller.ts"],"names":[],"mappings":";;;AAAA,+EAAsD;AACtD,kDAAoD;AAIpD,MAAqB,oBAAoB;IAGvC,YAAY,GAAQ;QAFpB;;;;;WAAS;QACT;;;;;WAAwB;QAEtB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,oBAAiB,CAAC,GAAG,CAAC,CAAC;IACzC,CAAC;IACD,MAAM,CAAC,CAAU,EAAE,GAAa;QAC9B,IAAI,CAAC,IAAI;aACN,MAAM,EAAE;aACR,IAAI,CAAC,CAAC,MAAW,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAA,mBAAO,EAAC,MAAM,CAAC,CAAC,CAAC;aAC5D,KAAK,CAAC,CAAC,GAAU,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAA,iBAAK,EAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACrE,CAAC;IAED,GAAG,CAAC,GAAY,EAAE,GAAa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;QAChC,IAAI,CAAC,IAAI;aACN,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,EAAG,CAAC;aACtB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAA,mBAAO,EAAC,CAAC,CAAC,CAAC,CAAC;aAC3C,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAA,iBAAK,EAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC5D,CAAC;CACF;AAxCD,uCAwCC","sourcesContent":["import CategoriesManager from '../classes/Categories';\nimport { error, success } from '../utils/functions';\nimport type { Request, Response } from 'express';\nimport type { App } from '../app';\n\nexport default class CategoriesController {\n app: App;\n db_c: CategoriesManager;\n constructor(app: App) {\n this.app = app;\n this.db_c = new CategoriesManager(app);\n }\n getAll(_: Request, res: Response) {\n this.db_c\n .getAll()\n .then((result: any) => res.status(200).json(success(result)))\n .catch((err: Error) => res.status(500).json(error(err.message)));\n }\n\n add(req: Request, res: Response) {\n this.db_c\n .add({ name: req.body.name, icon: req.body.icon, order: req.body.order, parent_id: req.body.parent_id })\n .then(r => res.status(201).json(success(r)))\n .catch(err => res.status(500).json(error(err.message)));\n }\n\n update(req: Request, res: Response) {\n this.db_c\n .update({\n id: req.params.id!,\n name: req.body.name,\n icon: req.body.icon,\n order: req.body.order,\n parent_id: req.body.parent_id,\n })\n .then(r => res.status(200).json(success(r)))\n .catch(err => res.status(500).json(error(err.message)));\n }\n\n delete(req: Request, res: Response) {\n this.db_c\n .delete(req.params.id!)\n .then(r => res.status(200).json(success(r)))\n .catch(err => res.status(500).json(error(err.message)));\n }\n}\n"]}
\ No newline at end of file
diff --git a/backend/dist/controllers/cdn.controller.js b/backend/dist/controllers/cdn.controller.js
deleted file mode 100644
index b2aa8ab1..00000000
--- a/backend/dist/controllers/cdn.controller.js
+++ /dev/null
@@ -1,30 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.convertImagetoWebp = void 0;
-const tslib_1 = require("tslib");
-const path_1 = require("path");
-const fs_1 = require("fs");
-const sharp_1 = tslib_1.__importDefault(require("sharp"));
-const functions_1 = require("../utils/functions");
-function convertImagetoWebp(_, req, res) {
- if (typeof req.files != 'object' || !('file' in req.files) || !req.files.file[0]) {
- res.status(400).json((0, functions_1.error)('No file provided.'));
- return;
- }
- const filename = req.files['file'][0].filename;
- if (!filename) {
- res.status(400).json((0, functions_1.error)('No file provided.'));
- return;
- }
- const path = (0, path_1.join)(__dirname, `../../../uploads/images/${filename}`);
- if ((0, fs_1.existsSync)(path)) {
- (0, sharp_1.default)(path)
- .toFile((0, path_1.join)(__dirname, `../../../uploads/webp/${filename.split('.')[0]}.webp`))
- .then(() => res.status(200).json((0, functions_1.success)(`/webp/${filename.split('.')[0]}.webp`)))
- .catch(_ => res.status(500).json((0, functions_1.error)('Error while converting image to webp.')));
- }
- else
- res.status(404).json((0, functions_1.error)('File not found.'));
-}
-exports.convertImagetoWebp = convertImagetoWebp;
-//# sourceMappingURL=cdn.controller.js.map
\ No newline at end of file
diff --git a/backend/dist/controllers/cdn.controller.js.map b/backend/dist/controllers/cdn.controller.js.map
deleted file mode 100644
index f8028244..00000000
--- a/backend/dist/controllers/cdn.controller.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"cdn.controller.js","sourceRoot":"","sources":["../../controllers/cdn.controller.ts"],"names":[],"mappings":";;;;AAAA,+BAA4B;AAC5B,2BAAgC;AAChC,0DAA0B;AAC1B,kDAAoD;AAIpD,SAAgB,kBAAkB,CAAC,CAAM,EAAE,GAAY,EAAE,GAAa;IACpE,IAAI,OAAO,GAAG,CAAC,KAAK,IAAI,QAAQ,IAAI,CAAC,CAAC,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC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p';\nimport { error, success } from '../utils/functions';\nimport type { Request, Response } from 'express';\nimport type { App } from '../app';\n\nexport function convertImagetoWebp(_: App, req: Request, res: Response) {\n if (typeof req.files != 'object' || !('file' in req.files) || !req.files.file[0]) {\n res.status(400).json(error('No file provided.'));\n return;\n }\n\n const filename = req.files['file'][0].filename;\n\n if (!filename) {\n res.status(400).json(error('No file provided.'));\n return;\n }\n\n const path = join(__dirname, `../../../uploads/images/${filename}`);\n\n if (existsSync(path)) {\n sharp(path)\n .toFile(join(__dirname, `../../../uploads/webp/${filename.split('.')[0]}.webp`))\n .then(() => res.status(200).json(success(`/webp/${filename.split('.')[0]}.webp`)))\n .catch(_ => res.status(500).json(error('Error while converting image to webp.')));\n } else res.status(404).json(error('File not found.'));\n}\n"]}
\ No newline at end of file
diff --git a/backend/dist/controllers/documents.controller.js b/backend/dist/controllers/documents.controller.js
deleted file mode 100644
index 536ac547..00000000
--- a/backend/dist/controllers/documents.controller.js
+++ /dev/null
@@ -1,97 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-const tslib_1 = require("tslib");
-const DocumentsManager_1 = tslib_1.__importDefault(require("../classes/DocumentsManager"));
-const functions_1 = require("../utils/functions");
-class DocumentsController {
- constructor(app) {
- Object.defineProperty(this, "app", {
- enumerable: true,
- configurable: true,
- writable: true,
- value: void 0
- });
- Object.defineProperty(this, "db_a", {
- enumerable: true,
- configurable: true,
- writable: true,
- value: void 0
- });
- this.app = app;
- this.db_a = new DocumentsManager_1.default(app);
- }
- getAllDocuments(req, res) {
- if (req.query.category) {
- this.db_a
- .getAllByCategory(req.query.category.toString())
- .then((value) => res.status(200).json((0, functions_1.success)(value)))
- .catch((err) => res.status(500).json((0, functions_1.error)(err.message)));
- }
- else {
- this.db_a
- .getAll(req.query.all?.toString())
- .then((result) => {
- // Select fields
- if (req.query.fields) {
- const Qfields = req.query.fields.toString().split(',');
- if (Qfields.length) {
- result = result.map((item) => {
- const filtered = {};
- Qfields.forEach(field => {
- if (item[field])
- filtered[field] = item[field];
- });
- return filtered;
- });
- }
- }
- res.status(200).json((0, functions_1.success)(result));
- })
- .catch(e => res.status(500).json((0, functions_1.error)(e)));
- }
- }
- getDocument(req, res) {
- this.db_a
- .get(req.params.id)
- .then(r => res.status(200).json((0, functions_1.success)(r)))
- .catch(e => res.status(500).json((0, functions_1.error)(e)));
- }
- add(req, res) {
- this.db_a
- .add({
- name: req.body.name,
- description: req.body.description,
- tags: req.body.tags,
- category: req.body.category,
- accessibility: req.body.accessibility,
- content_markdown: req.body.content_markdown,
- content_html: req.body.content_html,
- author_id: req.cookies.user_id,
- })
- .then(r => res.status(201).json((0, functions_1.success)(r)))
- .catch(err => res.status(500).json((0, functions_1.error)(err.message)));
- }
- updateDocument(req, res) {
- this.db_a
- .put(req.params.id, {
- name: req.body.name,
- description: req.body.description,
- tags: req.body.tags,
- category: req.body.category,
- accessibility: req.body.accessibility,
- content_markdown: req.body.content_markdown,
- content_html: req.body.content_html,
- author_id: req.cookies.user_id,
- })
- .then(r => res.status(201).json((0, functions_1.success)(r)))
- .catch(err => res.status(500).json((0, functions_1.error)(err.message)));
- }
- deleteDocument(req, res) {
- this.db_a
- .delete(req.params.id)
- .then(r => res.status(201).json((0, functions_1.success)(r)))
- .catch((err) => res.status(500).json((0, functions_1.error)(err.message)));
- }
-}
-exports.default = DocumentsController;
-//# sourceMappingURL=documents.controller.js.map
\ No newline at end of file
diff --git a/backend/dist/controllers/documents.controller.js.map b/backend/dist/controllers/documents.controller.js.map
deleted file mode 100644
index de383654..00000000
--- a/backend/dist/controllers/documents.controller.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"documents.controller.js","sourceRoot":"","sources":["../../controllers/documents.controller.ts"],"names":[],"mappings":";;;AAAA,2FAA2D;AAC3D,kDAAoD;AAKpD,MAAqB,mBAAmB;IAGtC,YAAY,GAAQ;QAFpB;;;;;WAAS;QACT;;;;;WAAuB;QAErB,IAAI,CAAC,GAAG,GAAG,GAAG,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AAM,CAAC,GAAG,CAAC,MAAM,CAAC,EAAY,CAAC;aAC/B,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAA,mBAAO,EAAC,CAAC,CAAC,CAAC,CAAC;aAC3C,KAAK,CAAC,CAAC,GAAU,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAA,iBAAK,EAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACrE,CAAC;CACF;AA/ED,sCA+EC","sourcesContent":["import DocumentsManager from '../classes/DocumentsManager';\nimport { error, success } from '../utils/functions';\nimport type { Response, Request } from 'express';\nimport type { App } from '../app';\nimport type { Document } from '../types';\n\nexport default class DocumentsController {\n app: App;\n db_a: DocumentsManager;\n constructor(app: App) {\n this.app = app;\n this.db_a = new DocumentsManager(app);\n }\n\n getAllDocuments(req: Request, res: Response) {\n if (req.query.category) {\n this.db_a\n .getAllByCategory(req.query.category.toString())\n .then((value: any) => res.status(200).json(success(value)))\n .catch((err: Error) => res.status(500).json(error(err.message)));\n } else {\n this.db_a\n .getAll(req.query.all?.toString())\n .then((result: Partial<Document>[]) => {\n // Select fields\n if (req.query.fields) {\n const Qfields: string[] = req.query.fields.toString().split(',');\n\n if (Qfields.length) {\n result = result.map((item: Partial<Document>) => {\n const filtered = {} as any;\n Qfields.forEach(field => {\n if (item[field as keyof Document]) filtered[field as keyof Document] = item[field as keyof Document];\n });\n return filtered;\n });\n }\n }\n res.status(200).json(success(result));\n })\n .catch(e => res.status(500).json(error(e)));\n }\n }\n getDocument(req: Request, res: Response) {\n this.db_a\n .get(req.params.id as string)\n .then(r => res.status(200).json(success(r)))\n .catch(e => res.status(500).json(error(e)));\n }\n add(req: Request, res: Response): void {\n this.db_a\n .add({\n name: req.body.name,\n description: req.body.description,\n tags: req.body.tags,\n category: req.body.category,\n accessibility: req.body.accessibility,\n content_markdown: req.body.content_markdown,\n content_html: req.body.content_html,\n author_id: req.cookies.user_id,\n })\n .then(r => res.status(201).json(success(r)))\n .catch(err => res.status(500).json(error(err.message)));\n }\n updateDocument(req: Request, res: Response) {\n this.db_a\n .put(req.params.id as string, {\n name: req.body.name,\n description: req.body.description,\n tags: req.body.tags,\n category: req.body.category,\n accessibility: req.body.accessibility,\n content_markdown: req.body.content_markdown,\n content_html: req.body.content_html,\n author_id: req.cookies.user_id,\n })\n .then(r => res.status(201).json(success(r)))\n .catch(err => res.status(500).json(error(err.message)));\n }\n deleteDocument(req: Request, res: Response) {\n this.db_a\n .delete(req.params.id as string)\n .then(r => res.status(201).json(success(r)))\n .catch((err: Error) => res.status(500).json(error(err.message)));\n }\n}\n"]}
\ No newline at end of file
diff --git a/backend/dist/controllers/index.js b/backend/dist/controllers/index.js
deleted file mode 100644
index 234ea8cd..00000000
--- a/backend/dist/controllers/index.js
+++ /dev/null
@@ -1,8 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-const tslib_1 = require("tslib");
-tslib_1.__exportStar(require("./documents.controller"), exports);
-tslib_1.__exportStar(require("./auth.controller"), exports);
-tslib_1.__exportStar(require("./categories.controller"), exports);
-tslib_1.__exportStar(require("./cdn.controller"), exports);
-//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/backend/dist/controllers/index.js.map b/backend/dist/controllers/index.js.map
deleted file mode 100644
index 9d5c90ac..00000000
--- a/backend/dist/controllers/index.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"index.js","sourceRoot":"","sources":["../../controllers/index.ts"],"names":[],"mappings":";;;AAAA,iEAAuC;AACvC,4DAAkC;AAClC,kEAAwC;AACxC,2DAAiC","sourcesContent":["export * from './documents.controller';\nexport * from './auth.controller';\nexport * from './categories.controller';\nexport * from './cdn.controller';\n"]}
\ No newline at end of file
diff --git a/backend/dist/main.js b/backend/dist/main.js
deleted file mode 100644
index 4cb17d89..00000000
--- a/backend/dist/main.js
+++ /dev/null
@@ -1,11 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-const path_1 = require("path");
-const app_1 = require("./app");
-const dotenv_1 = require("dotenv");
-(0, dotenv_1.config)({
- path: (0, path_1.resolve)(__dirname, '../.env'),
-});
-const server = new app_1.App();
-server.start();
-//# sourceMappingURL=main.js.map
\ No newline at end of file
diff --git a/backend/dist/main.js.map b/backend/dist/main.js.map
deleted file mode 100644
index d9278c8e..00000000
--- a/backend/dist/main.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"main.js","sourceRoot":"","sources":["../main.ts"],"names":[],"mappings":";;AAAA,+BAA+B;AAE/B,+BAA4B;AAC5B,mCAAgC;AAEhC,IAAA,eAAM,EAAC;IACL,IAAI,EAAE,IAAA,cAAO,EAAC,SAAS,EAAE,SAAS,CAAC;CACpC,CAAC,CAAC;AAEH,MAAM,MAAM,GAAQ,IAAI,SAAG,EAAE,CAAC;AAC9B,MAAM,CAAC,KAAK,EAAE,CAAC","sourcesContent":["import { resolve } from 'path';\n\nimport { App } from './app';\nimport { config } from 'dotenv';\n\nconfig({\n path: resolve(__dirname, '../.env'),\n});\n\nconst server: App = new App();\nserver.start();\n"]}
\ No newline at end of file
diff --git a/backend/dist/middlewares/auth.js b/backend/dist/middlewares/auth.js
deleted file mode 100644
index 5bd62bc4..00000000
--- a/backend/dist/middlewares/auth.js
+++ /dev/null
@@ -1,32 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-const jsonwebtoken_1 = require("jsonwebtoken");
-const functions_1 = require("../utils/functions");
-exports.default = (req, res, next) => {
- try {
- const cookies = req.headers.cookie;
- if (cookies) {
- req.cookies = cookies.split(';').reduce((obj, c) => {
- var n = c.trim().split('=');
- obj[n[0]] = n[1].trim();
- return obj;
- }, {});
- }
- if (!req.cookies)
- throw 'Missing cookies';
- if (!req.cookies.user_token)
- throw 'Missing token cookie.';
- if (!req.cookies.user_id)
- throw 'Missing token cookie.';
- if (!process.env.JWT_SECRET)
- throw 'Missing JWT_SECRET';
- const decoded = (0, jsonwebtoken_1.verify)(req.cookies.user_token, process.env.JWT_SECRET);
- if (req.cookies.user_id != decoded.userId)
- throw 'Bad user';
- return next();
- }
- catch (err) {
- return res.status(401).json((0, functions_1.error)('Requete non authentifiée'));
- }
-};
-//# sourceMappingURL=auth.js.map
\ No newline at end of file
diff --git a/backend/dist/middlewares/auth.js.map b/backend/dist/middlewares/auth.js.map
deleted file mode 100644
index d941dfb4..00000000
--- a/backend/dist/middlewares/auth.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../middlewares/auth.ts"],"names":[],"mappings":";;AAAA,+CAAsC;AACtC,kDAA2C;AAG3C,kBAAe,CAAC,GAAY,EAAE,GAAa,EAAE,IAAc,EAAE,EAAE;IAC7D,IAAI;QACF,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC;QACnC,IAAI,OAAO,EAAE;YACX,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAQ,EAAE,CAAS,EAAE,EAAE;gBAC9D,IAAI,CAAC,GAAQ,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACjC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;gBACxB,OAAO,GAAG,CAAC;YACb,CAAC,EAAE,EAAE,CAAC,CAAC;SACR;QACD,IAAI,CAAC,GAAG,CAAC,OAAO;YAAE,MAAM,iBAAiB,CAAC;QAC1C,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,UAAU;YAAE,MAAM,uBAAuB,CAAC;QAC3D,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO;YAAE,MAAM,uBAAuB,CAAC;QACxD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU;YAAE,MAAM,oBAAoB,CAAC;QACxD,MAAM,OAAO,GAAQ,IAAA,qBAAM,EAAC,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC5E,IAAI,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM;YAAE,MAAM,UAAU,CAAC;QAC5D,OAAO,IAAI,EAAE,CAAC;KACf;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAA,iBAAK,EAAC,0BAA0B,CAAC,CAAC,CAAC;KAChE;AACH,CAAC,CAAC","sourcesContent":["import { verify } from 'jsonwebtoken';\nimport { error } from '../utils/functions';\nimport type { Request, Response } from 'express';\n\nexport default (req: Request, res: Response, next: Function) => {\n try {\n const cookies = req.headers.cookie;\n if (cookies) {\n req.cookies = cookies.split(';').reduce((obj: any, c: string) => {\n var n: any = c.trim().split('=');\n obj[n[0]] = n[1].trim();\n return obj;\n }, {});\n }\n if (!req.cookies) throw 'Missing cookies';\n if (!req.cookies.user_token) throw 'Missing token cookie.';\n if (!req.cookies.user_id) throw 'Missing token cookie.';\n if (!process.env.JWT_SECRET) throw 'Missing JWT_SECRET';\n const decoded: any = verify(req.cookies.user_token, process.env.JWT_SECRET);\n if (req.cookies.user_id != decoded.userId) throw 'Bad user';\n return next();\n } catch (err) {\n return res.status(401).json(error('Requete non authentifiée'));\n }\n};\n"]}
\ No newline at end of file
diff --git a/backend/dist/middlewares/multer.cdn.js b/backend/dist/middlewares/multer.cdn.js
deleted file mode 100644
index 78a3115e..00000000
--- a/backend/dist/middlewares/multer.cdn.js
+++ /dev/null
@@ -1,45 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-const tslib_1 = require("tslib");
-const path_1 = require("path");
-const multer_1 = tslib_1.__importDefault(require("multer"));
-const tailleMax = 20 * 1024 * 1024; // 20MB
-var MIME_TYPES_IMAGE;
-(function (MIME_TYPES_IMAGE) {
- MIME_TYPES_IMAGE["image/jpg"] = "jpg";
- MIME_TYPES_IMAGE["image/jpeg"] = "jpg";
- MIME_TYPES_IMAGE["image/png"] = "png";
- MIME_TYPES_IMAGE["image/gif"] = "gif";
- MIME_TYPES_IMAGE["image/webp"] = "webp";
- MIME_TYPES_IMAGE["image/svg+xml"] = "svg";
-})(MIME_TYPES_IMAGE || (MIME_TYPES_IMAGE = {}));
-const storage = multer_1.default.diskStorage({
- destination: (_, __, callback) => {
- callback(null, `${(0, path_1.join)(__dirname, `../../../uploads/images`)}`);
- },
- filename: (_, file, callback) => {
- const mimetype = file.mimetype;
- const extension = MIME_TYPES_IMAGE[mimetype];
- const fullName = Date.now().toString() + '.' + extension;
- callback(null, fullName);
- },
-});
-exports.default = (0, multer_1.default)({
- storage: storage,
- limits: {
- fileSize: tailleMax,
- },
- fileFilter: (_, file, cb) => {
- const mimetype = file.mimetype;
- if (MIME_TYPES_IMAGE[mimetype])
- cb(null, true);
- else
- cb(new Error('[BAD_MIMETYPE]'));
- },
-}).fields([
- {
- name: 'file',
- maxCount: 1,
- },
-]);
-//# sourceMappingURL=multer.cdn.js.map
\ No newline at end of file
diff --git a/backend/dist/middlewares/multer.cdn.js.map b/backend/dist/middlewares/multer.cdn.js.map
deleted file mode 100644
index 3959c0a5..00000000
--- a/backend/dist/middlewares/multer.cdn.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"multer.cdn.js","sourceRoot":"","sources":["../../middlewares/multer.cdn.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAC5B,4DAA4B;AAG5B,MAAM,SAAS,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,OAAO;AAE3C,IAAK,gBAOJ;AAPD,WAAK,gBAAgB;IACnB,qCAAmB,CAAA;IACnB,sCAAoB,CAAA;IACpB,qCAAmB,CAAA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{ IObject } from '../types';\n\nconst tailleMax = 20 * 1024 * 1024; // 20MB\n\nenum MIME_TYPES_IMAGE {\n 'image/jpg' = 'jpg',\n 'image/jpeg' = 'jpg',\n 'image/png' = 'png',\n 'image/gif' = 'gif',\n 'image/webp' = 'webp',\n 'image/svg+xml' = 'svg',\n}\n\nconst storage = multer.diskStorage({\n destination: (_, __: Express.Multer.File, callback: Function) => {\n callback(null, `${join(__dirname, `../../../uploads/images`)}`);\n },\n filename: (_, file: IObject, callback: Function) => {\n const mimetype = file.mimetype as unknown as keyof typeof MIME_TYPES_IMAGE;\n const extension = MIME_TYPES_IMAGE[mimetype];\n const fullName = Date.now().toString() + '.' + extension;\n callback(null, fullName);\n },\n});\n\nexport default multer({\n storage: storage,\n limits: {\n fileSize: tailleMax,\n },\n fileFilter: (_, file: IObject, cb: Function) => {\n const mimetype = file.mimetype as unknown as keyof typeof MIME_TYPES_IMAGE;\n if (MIME_TYPES_IMAGE[mimetype]) cb(null, true);\n else cb(new Error('[BAD_MIMETYPE]'));\n },\n}).fields([\n {\n name: 'file',\n maxCount: 1,\n },\n]);\n"]}
\ No newline at end of file
diff --git a/backend/dist/models/db.js b/backend/dist/models/db.js
deleted file mode 100644
index b3c813be..00000000
--- a/backend/dist/models/db.js
+++ /dev/null
@@ -1,13 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-const mysql2_1 = require("mysql2");
-function getConnection(host, user, password, db_name) {
- return (0, mysql2_1.createPool)({
- host: host,
- user: user,
- password: password,
- database: db_name,
- });
-}
-exports.default = getConnection;
-//# sourceMappingURL=db.js.map
\ No newline at end of file
diff --git a/backend/dist/models/db.js.map b/backend/dist/models/db.js.map
deleted file mode 100644
index 4395951e..00000000
--- a/backend/dist/models/db.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"db.js","sourceRoot":"","sources":["../../models/db.ts"],"names":[],"mappings":";;AAAA,mCAAoC;AAEpC,SAAS,aAAa,CAAC,IAAa,EAAE,IAAa,EAAE,QAAiB,EAAE,OAAgB;IACtF,OAAO,IAAA,mBAAU,EAAC;QAChB,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,QAAQ;QAClB,QAAQ,EAAE,OAAO;KAClB,CAAC,CAAC;AACL,CAAC;AAED,kBAAe,aAAa,CAAC","sourcesContent":["import { createPool } from 'mysql2';\n\nfunction getConnection(host?: string, user?: string, password?: string, db_name?: string) {\n return createPool({\n host: host,\n user: user,\n password: password,\n database: db_name,\n });\n}\n\nexport default getConnection;\n"]}
\ No newline at end of file
diff --git a/backend/dist/routes/v1/auth.js b/backend/dist/routes/v1/auth.js
deleted file mode 100644
index 25efd078..00000000
--- a/backend/dist/routes/v1/auth.js
+++ /dev/null
@@ -1,19 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-const tslib_1 = require("tslib");
-const express_1 = require("express");
-const auth_controller_1 = tslib_1.__importDefault(require("../../controllers/auth.controller"));
-const AuthRouter = (0, express_1.Router)();
-exports.default = (client) => {
- return {
- route: 'auth',
- version: 1,
- router() {
- const controller = new auth_controller_1.default(client);
- AuthRouter.post('/', (req, res) => controller.authentification(client, req, res));
- AuthRouter.get('/disconnection', (req, res) => controller.disconnection(client, req, res));
- return AuthRouter;
- },
- };
-};
-//# sourceMappingURL=auth.js.map
\ No newline at end of file
diff --git a/backend/dist/routes/v1/auth.js.map b/backend/dist/routes/v1/auth.js.map
deleted file mode 100644
index 19b45f47..00000000
--- a/backend/dist/routes/v1/auth.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../routes/v1/auth.ts"],"names":[],"mappings":";;;AAAA,qCAAiC;AACjC,gGAAyD;AAGzD,MAAM,UAAU,GAAW,IAAA,gBAAM,GAAE,CAAC;AAEpC,kBAAe,CAAC,MAAW,EAAU,EAAE;IACrC,OAAO;QACL,KAAK,EAAE,MAAM;QACb,OAAO,EAAE,CAAC;QACV,MAAM;YACJ,MAAM,UAAU,GAAG,IAAI,yBAAQ,CAAC,MAAM,CAAC,CAAC;YACxC,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;YAClF,UAAU,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;YAC3F,OAAO,UAAU,CAAC;QACpB,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { Router } from 'express';\nimport AuthCtrl from '../../controllers/auth.controller';\nimport type { Iroute } from '../../types';\nimport type { App } from '../../app';\nconst AuthRouter: Router = Router();\n\nexport default (client: App): Iroute => {\n return {\n route: 'auth',\n version: 1,\n router() {\n const controller = new AuthCtrl(client);\n AuthRouter.post('/', (req, res) => controller.authentification(client, req, res));\n AuthRouter.get('/disconnection', (req, res) => controller.disconnection(client, req, res));\n return AuthRouter;\n },\n };\n};\n"]}
\ No newline at end of file
diff --git a/backend/dist/routes/v1/backup.js b/backend/dist/routes/v1/backup.js
deleted file mode 100644
index c2ffdbb7..00000000
--- a/backend/dist/routes/v1/backup.js
+++ /dev/null
@@ -1,19 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-const tslib_1 = require("tslib");
-const express_1 = require("express");
-const backups_controller_1 = tslib_1.__importDefault(require("../../controllers/backups.controller"));
-const auth_1 = tslib_1.__importDefault(require("../../middlewares/auth"));
-const BackupsRouter = (0, express_1.Router)();
-exports.default = (client) => {
- const controller = new backups_controller_1.default(client);
- return {
- route: 'backups',
- version: 1,
- router() {
- BackupsRouter.post('', auth_1.default, (req, res) => controller.add(req, res));
- return BackupsRouter;
- },
- };
-};
-//# sourceMappingURL=backup.js.map
\ No newline at end of file
diff --git a/backend/dist/routes/v1/backup.js.map b/backend/dist/routes/v1/backup.js.map
deleted file mode 100644
index 1fdbf58e..00000000
--- a/backend/dist/routes/v1/backup.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"backup.js","sourceRoot":"","sources":["../../../routes/v1/backup.ts"],"names":[],"mappings":";;;AAAA,qCAAiC;AACjC,sGAA+D;AAC/D,0EAA6C;AAI7C,MAAM,aAAa,GAAW,IAAA,gBAAM,GAAE,CAAC;AAEvC,kBAAe,CAAC,MAAW,EAAU,EAAE;IACrC,MAAM,UAAU,GAAG,IAAI,4BAAW,CAAC,MAAM,CAAC,CAAC;IAC3C,OAAO;QACL,KAAK,EAAE,SAAS;QAChB,OAAO,EAAE,CAAC;QACV,MAAM;YACJ,aAAa,CAAC,IAAI,CAAC,EAAE,EAAE,cAAO,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;YACxE,OAAO,aAAa,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { Router } from 'express';\nimport BackupsCtrl from '../../controllers/backups.controller';\nimport authMid from '../../middlewares/auth';\nimport type { App } from '../../app';\nimport type { Iroute } from '../../types';\n\nconst BackupsRouter: Router = Router();\n\nexport default (client: App): Iroute => {\n const controller = new BackupsCtrl(client);\n return {\n route: 'backups',\n version: 1,\n router() {\n BackupsRouter.post('', authMid, (req, res) => controller.add(req, res));\n return BackupsRouter;\n },\n };\n};\n"]}
\ No newline at end of file
diff --git a/backend/dist/routes/v1/categories.js b/backend/dist/routes/v1/categories.js
deleted file mode 100644
index b381cb3a..00000000
--- a/backend/dist/routes/v1/categories.js
+++ /dev/null
@@ -1,22 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-const tslib_1 = require("tslib");
-const express_1 = require("express");
-const categories_controller_1 = tslib_1.__importDefault(require("../../controllers/categories.controller"));
-const auth_1 = tslib_1.__importDefault(require("../../middlewares/auth"));
-const CategoriesRouter = (0, express_1.Router)();
-exports.default = (client) => {
- const controller = new categories_controller_1.default(client);
- return {
- route: 'categories',
- version: 1,
- router() {
- CategoriesRouter.get('/', (req, res) => controller.getAll(req, res));
- CategoriesRouter.post('', auth_1.default, (req, res) => controller.add(req, res));
- CategoriesRouter.patch('/:id', auth_1.default, (req, res) => controller.update(req, res));
- CategoriesRouter.delete('/:id', auth_1.default, (req, res) => controller.delete(req, res));
- return CategoriesRouter;
- },
- };
-};
-//# sourceMappingURL=categories.js.map
\ No newline at end of file
diff --git a/backend/dist/routes/v1/categories.js.map b/backend/dist/routes/v1/categories.js.map
deleted file mode 100644
index bd740c83..00000000
--- a/backend/dist/routes/v1/categories.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"categories.js","sourceRoot":"","sources":["../../../routes/v1/categories.ts"],"names":[],"mappings":";;;AAAA,qCAAiC;AACjC,4GAAqE;AACrE,0EAA6C;AAI7C,MAAM,gBAAgB,GAAW,IAAA,gBAAM,GAAE,CAAC;AAE1C,kBAAe,CAAC,MAAW,EAAU,EAAE;IACrC,MAAM,UAAU,GAAG,IAAI,+BAAc,CAAC,MAAM,CAAC,CAAC;IAC9C,OAAO;QACL,KAAK,EAAE,YAAY;QACnB,OAAO,EAAE,CAAC;QACV,MAAM;YACJ,gBAAgB,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;YACrE,gBAAgB,CAAC,IAAI,CAAC,EAAE,EAAE,cAAO,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;YAC3E,gBAAgB,CAAC,KAAK,CAAC,MAAM,EAAE,cAAO,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;YACnF,gBAAgB,CAAC,MAAM,CAAC,MAAM,EAAE,cAAO,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;YACpF,OAAO,gBAAgB,CAAC;QAC1B,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { Router } from 'express';\nimport CategoriesCtrl from '../../controllers/categories.controller';\nimport authMid from '../../middlewares/auth';\nimport type { App } from '../../app';\nimport type { Iroute } from '../../types';\n\nconst CategoriesRouter: Router = Router();\n\nexport default (client: App): Iroute => {\n const controller = new CategoriesCtrl(client);\n return {\n route: 'categories',\n version: 1,\n router() {\n CategoriesRouter.get('/', (req, res) => controller.getAll(req, res));\n CategoriesRouter.post('', authMid, (req, res) => controller.add(req, res));\n CategoriesRouter.patch('/:id', authMid, (req, res) => controller.update(req, res));\n CategoriesRouter.delete('/:id', authMid, (req, res) => controller.delete(req, res));\n return CategoriesRouter;\n },\n };\n};\n"]}
\ No newline at end of file
diff --git a/backend/dist/routes/v1/cdn.js b/backend/dist/routes/v1/cdn.js
deleted file mode 100644
index c5bef66c..00000000
--- a/backend/dist/routes/v1/cdn.js
+++ /dev/null
@@ -1,35 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-const tslib_1 = require("tslib");
-const express_1 = require("express");
-const CDNCtrl = tslib_1.__importStar(require("../../controllers/cdn.controller"));
-const auth_1 = tslib_1.__importDefault(require("../../middlewares/auth"));
-const multer_cdn_1 = tslib_1.__importDefault(require("../../middlewares/multer.cdn"));
-const multer_1 = tslib_1.__importDefault(require("multer"));
-const functions_1 = require("../../utils/functions");
-const CDNRouter = (0, express_1.Router)();
-exports.default = (app) => {
- return {
- route: 'cdn',
- version: 1,
- router() {
- CDNRouter.post('/image', auth_1.default, multer_cdn_1.default, (req, res) => CDNCtrl.convertImagetoWebp(app, req, res), multerErrors);
- return CDNRouter;
- },
- };
-};
-function multerErrors(err, _, res, next) {
- if (err instanceof multer_1.default.MulterError) {
- if (err.code === 'LIMIT_FILE_SIZE')
- return res.status(400).json((0, functions_1.error)('File size is too large.'));
- else
- res.status(400).json((0, functions_1.error)(err.message));
- }
- if (err) {
- if (err.message === '[BAD_MIMETYPE]')
- return res.status(400).json((0, functions_1.error)('Only images and vectors are alowed.'));
- return res.status(400).json((0, functions_1.error)(err.message));
- }
- return next();
-}
-//# sourceMappingURL=cdn.js.map
\ No newline at end of file
diff --git a/backend/dist/routes/v1/cdn.js.map b/backend/dist/routes/v1/cdn.js.map
deleted file mode 100644
index 052ef5e1..00000000
--- a/backend/dist/routes/v1/cdn.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"cdn.js","sourceRoot":"","sources":["../../../routes/v1/cdn.ts"],"names":[],"mappings":";;;AAAA,qCAA4E;AAC5E,kFAA4D;AAC5D,0EAA0C;AAC1C,sFAAqD;AAGrD,4DAA4B;AAC5B,qDAA8C;AAC9C,MAAM,SAAS,GAAW,IAAA,gBAAM,GAAE,CAAC;AAEnC,kBAAe,CAAC,GAAQ,EAAU,EAAE;IAClC,OAAO;QACL,KAAK,EAAE,KAAK;QACZ,OAAO,EAAE,CAAC;QACV,MAAM;YACJ,SAAS,CAAC,IAAI,CACZ,QAAQ,EACR,cAAI,EACJ,oBAAS,EACT,CAAC,GAAY,EAAE,GAAa,EAAE,EAAE,CAAC,OAAO,CAAC,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAC1E,YAAY,CACb,CAAC;YACF,OAAO,SAAS,CAAC;QACnB,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,SAAS,YAAY,CAAC,GAAQ,EAAE,CAAU,EAAE,GAAa,EAAE,IAAkB;IAC3E,IAAI,GAAG,YAAY,gBAAM,CAAC,WAAW,EAAE;QACrC,IAAI,GAAG,CAAC,IAAI,KAAK,iBAAiB;YAAE,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAA,iBAAK,EAAC,yBAAyB,CAAC,CAAC,CAAC;;YAC7F,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAA,iBAAK,EAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;KAC/C;IACD,IAAI,GAAG,EAAE;QACP,IAAI,GAAG,CAAC,OAAO,KAAK,gBAAgB;YAAE,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAA,iBAAK,EAAC,qCAAqC,CAAC,CAAC,CAAC;QAChH,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAA,iBAAK,EAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;KACjD;IACD,OAAO,IAAI,EAAE,CAAC;AAChB,CAAC","sourcesContent":["import { Router, type Request, type Response, NextFunction } from 'express';\nimport * as CDNCtrl from '../../controllers/cdn.controller';\nimport auth from '../../middlewares/auth';\nimport multerCdn from '../../middlewares/multer.cdn';\nimport type { Iroute } from '../../types';\nimport type { App } from '../../app';\nimport multer from 'multer';\nimport { error } from '../../utils/functions';\nconst CDNRouter: Router = Router();\n\nexport default (app: App): Iroute => {\n return {\n route: 'cdn',\n version: 1,\n router() {\n CDNRouter.post(\n '/image',\n auth,\n multerCdn,\n (req: Request, res: Response) => CDNCtrl.convertImagetoWebp(app, req, res),\n multerErrors,\n );\n return CDNRouter;\n },\n };\n};\n\nfunction multerErrors(err: any, _: Request, res: Response, next: NextFunction) {\n if (err instanceof multer.MulterError) {\n if (err.code === 'LIMIT_FILE_SIZE') return res.status(400).json(error('File size is too large.'));\n else res.status(400).json(error(err.message));\n }\n if (err) {\n if (err.message === '[BAD_MIMETYPE]') return res.status(400).json(error('Only images and vectors are alowed.'));\n return res.status(400).json(error(err.message));\n }\n return next();\n}\n"]}
\ No newline at end of file
diff --git a/backend/dist/routes/v1/documents.js b/backend/dist/routes/v1/documents.js
deleted file mode 100644
index 9afc84e4..00000000
--- a/backend/dist/routes/v1/documents.js
+++ /dev/null
@@ -1,23 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-const tslib_1 = require("tslib");
-const express_1 = require("express");
-const documents_controller_1 = tslib_1.__importDefault(require("../../controllers/documents.controller"));
-const auth_1 = tslib_1.__importDefault(require("../../middlewares/auth"));
-const DocumentsRouter = (0, express_1.Router)();
-exports.default = (client) => {
- const controller = new documents_controller_1.default(client);
- return {
- route: 'documents',
- version: 1,
- router() {
- DocumentsRouter.get('/', (req, res) => controller.getAllDocuments(req, res));
- DocumentsRouter.get('/:id', (req, res) => controller.getDocument(req, res));
- DocumentsRouter.post('/', auth_1.default, (req, res) => controller.add(req, res));
- DocumentsRouter.patch('/:id', auth_1.default, (req, res) => controller.updateDocument(req, res));
- DocumentsRouter.delete('/:id', auth_1.default, (req, res) => controller.deleteDocument(req, res));
- return DocumentsRouter;
- },
- };
-};
-//# sourceMappingURL=documents.js.map
\ No newline at end of file
diff --git a/backend/dist/routes/v1/documents.js.map b/backend/dist/routes/v1/documents.js.map
deleted file mode 100644
index af8a8b5d..00000000
--- a/backend/dist/routes/v1/documents.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"documents.js","sourceRoot":"","sources":["../../../routes/v1/documents.ts"],"names":[],"mappings":";;;AAAA,qCAAiC;AACjC,0GAAmE;AACnE,0EAA6C;AAI7C,MAAM,eAAe,GAAW,IAAA,gBAAM,GAAE,CAAC;AAEzC,kBAAe,CAAC,MAAW,EAAU,EAAE;IACrC,MAAM,UAAU,GAAG,IAAI,8BAAa,CAAC,MAAM,CAAC,CAAC;IAC7C,OAAO;QACL,KAAK,EAAE,WAAW;QAClB,OAAO,EAAE,CAAC;QACV,MAAM;YACJ,eAAe,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;YAC7E,eAAe,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;YAC5E,eAAe,CAAC,IAAI,CAAC,GAAG,EAAE,cAAO,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;YAC3E,eAAe,CAAC,KAAK,CAAC,MAAM,EAAE,cAAO,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;YAC1F,eAAe,CAAC,MAAM,CAAC,MAAM,EAAE,cAAO,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;YAC3F,OAAO,eAAe,CAAC;QACzB,CAAC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { Router } from 'express';\nimport DocumentsCtrl from '../../controllers/documents.controller';\nimport authMid from '../../middlewares/auth';\nimport type { App } from '../../app';\nimport type { Iroute } from '../../types';\n\nconst DocumentsRouter: Router = Router();\n\nexport default (client: App): Iroute => {\n const controller = new DocumentsCtrl(client);\n return {\n route: 'documents',\n version: 1,\n router() {\n DocumentsRouter.get('/', (req, res) => controller.getAllDocuments(req, res));\n DocumentsRouter.get('/:id', (req, res) => controller.getDocument(req, res));\n DocumentsRouter.post('/', authMid, (req, res) => controller.add(req, res));\n DocumentsRouter.patch('/:id', authMid, (req, res) => controller.updateDocument(req, res));\n DocumentsRouter.delete('/:id', authMid, (req, res) => controller.deleteDocument(req, res));\n return DocumentsRouter;\n },\n };\n};\n"]}
\ No newline at end of file
diff --git a/backend/dist/utils/Logger.js b/backend/dist/utils/Logger.js
deleted file mode 100644
index 55a778f9..00000000
--- a/backend/dist/utils/Logger.js
+++ /dev/null
@@ -1,35 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-class Logger {
- static info(message, details) {
- console.log(Logger.colors.info, message, Logger.colors.reset, details ? details : '');
- }
- static warn(message, details) {
- console.log(Logger.colors.warn, message, Logger.colors.reset, details ? details : '');
- }
- static error(message, details) {
- console.log(Logger.colors.error, message, Logger.colors.reset, details ? details : '');
- }
- static debug(message, details) {
- console.log(Logger.colors.debug, message, Logger.colors.reset, details ? details : '');
- }
- static success(message, details) {
- console.log(Logger.colors.success, message, Logger.colors.reset, details ? details : '');
- }
-}
-// Info, Warning, Error, Debug, Success
-Object.defineProperty(Logger, "colors", {
- enumerable: true,
- configurable: true,
- writable: true,
- value: {
- info: '\x1b[36m%s\x1b[0m',
- warn: '\x1b[33m%s\x1b[0m',
- error: '\x1b[31m%s\x1b[0m',
- debug: '\x1b[34m%s\x1b[0m',
- success: '\x1b[32m%s\x1b[0m',
- reset: '\x1b[0m',
- }
-});
-exports.default = Logger;
-//# sourceMappingURL=Logger.js.map
\ No newline at end of file
diff --git a/backend/dist/utils/Logger.js.map b/backend/dist/utils/Logger.js.map
deleted file mode 100644
index 491d8c76..00000000
--- a/backend/dist/utils/Logger.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"Logger.js","sourceRoot":"","sources":["../../utils/Logger.ts"],"names":[],"mappings":";;AAAA,MAAqB,MAAM;IAWlB,MAAM,CAAC,IAAI,CAAC,OAAe,EAAE,OAAgB;QAClD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CA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sourcesContent":["export default class Logger {\n // Info, Warning, Error, Debug, Success\n private static colors = {\n info: '\\x1b[36m%s\\x1b[0m',\n warn: '\\x1b[33m%s\\x1b[0m',\n error: '\\x1b[31m%s\\x1b[0m',\n debug: '\\x1b[34m%s\\x1b[0m',\n success: '\\x1b[32m%s\\x1b[0m',\n reset: '\\x1b[0m',\n };\n\n public static info(message: string, details?: string): void {\n console.log(Logger.colors.info, message, Logger.colors.reset, details ? details : '');\n }\n\n public static warn(message: string, details?: string): void {\n console.log(Logger.colors.warn, message, Logger.colors.reset, details ? details : '');\n }\n\n public static error(message: string, details?: string): void {\n console.log(Logger.colors.error, message, Logger.colors.reset, details ? details : '');\n }\n\n public static debug(message: string, details?: string): void {\n console.log(Logger.colors.debug, message, Logger.colors.reset, details ? details : '');\n }\n\n public static success(message: string, details?: string): void {\n console.log(Logger.colors.success, message, Logger.colors.reset, details ? details : '');\n }\n}\n"]}
\ No newline at end of file
diff --git a/backend/dist/utils/Snowflake.js b/backend/dist/utils/Snowflake.js
deleted file mode 100644
index 82437eba..00000000
--- a/backend/dist/utils/Snowflake.js
+++ /dev/null
@@ -1,117 +0,0 @@
-"use strict";
-var _Snowflake_increment, _Snowflake_epoch;
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.Snowflake = void 0;
-const tslib_1 = require("tslib");
-const ProcessId = 1n;
-const WorkerId = 0n;
-/**
- * A class for generating and deconstructing Twitter snowflakes.
- *
- * A {@link https://developer.twitter.com/en/docs/twitter-ids Twitter snowflake}
- * is a 64-bit unsigned integer with 4 result that have a fixed epoch value.
- *
- * If we have a snowflake `266241948824764416` we can represent it as binary:
- * ```
- * 64 22 17 12 0
- * 000000111011000111100001101001000101000000 00001 00000 000000000000
- * number of ms since epoch worker pid increment
- * ```
- */
-class Snowflake {
- /**
- * @param epoch the epoch to use
- */
- constructor(epoch) {
- /**
- * Internal incrementor for generating snowflakes
- * @internal
- */
- _Snowflake_increment.set(this, 0n);
- /**
- * Internal reference of the epoch passed in the constructor
- * @internal
- */
- _Snowflake_epoch.set(this, void 0);
- /**
- * Alias for {@link deconstruct}
- */
- // eslint-disable-next-line @typescript-eslint/unbound-method, @typescript-eslint/no-invalid-this
- Object.defineProperty(this, "decode", {
- enumerable: true,
- configurable: true,
- writable: true,
- value: this.deconstruct
- });
- tslib_1.__classPrivateFieldSet(this, _Snowflake_epoch, BigInt(epoch instanceof Date ? epoch.getTime() : epoch), "f");
- }
- /**
- * The epoch for this snowflake.
- */
- get epoch() {
- return tslib_1.__classPrivateFieldGet(this, _Snowflake_epoch, "f");
- }
- /**
- * Generates a snowflake given an epoch and optionally a timestamp
- * @param options options to pass into the generator, see {@link SnowflakeGenerateOptions}
- *
- * **note** when `increment` is not provided it defaults to the private `increment` of the instance
- * @example
- * ```typescript
- * const epoch = new Date('2000-01-01T00:00:00.000Z');
- * const snowflake = new Snowflake(epoch).generate();
- * ```
- * @returns A unique snowflake
- */
- generate({ increment, timestamp = Date.now(), workerId = WorkerId, processId = ProcessId, } = {}) {
- var _a, _b;
- if (timestamp instanceof Date)
- timestamp = BigInt(timestamp.getTime());
- else if (typeof timestamp === 'number')
- timestamp = BigInt(timestamp);
- else if (typeof timestamp !== 'bigint') {
- throw new TypeError(`"timestamp" argument must be a number, bigint, or Date (received ${typeof timestamp})`);
- }
- if (typeof increment === 'bigint' && increment >= 4095n)
- increment = 0n;
- else {
- increment = (tslib_1.__classPrivateFieldSet(this, _Snowflake_increment, (_b = tslib_1.__classPrivateFieldGet(this, _Snowflake_increment, "f"), _a = _b++, _b), "f"), _a);
- if (tslib_1.__classPrivateFieldGet(this, _Snowflake_increment, "f") >= 4095n)
- tslib_1.__classPrivateFieldSet(this, _Snowflake_increment, 0n, "f");
- }
- // timestamp, workerId, processId, increment
- return ((timestamp - tslib_1.__classPrivateFieldGet(this, _Snowflake_epoch, "f")) << 22n) | ((workerId & 31n) << 17n) | ((processId & 31n) << 12n) | increment;
- }
- /**
- * Deconstructs a snowflake given a snowflake ID
- * @param id the snowflake to deconstruct
- * @returns a deconstructed snowflake
- * @example
- * ```typescript
- * const epoch = new Date('2000-01-01T00:00:00.000Z');
- * const snowflake = new Snowflake(epoch).deconstruct('3971046231244935168');
- * ```
- */
- deconstruct(id) {
- const bigIntId = BigInt(id);
- return {
- id: bigIntId,
- timestamp: (bigIntId >> 22n) + tslib_1.__classPrivateFieldGet(this, _Snowflake_epoch, "f"),
- workerId: (bigIntId >> 17n) & 31n,
- processId: (bigIntId >> 12n) & 31n,
- increment: bigIntId & 4095n,
- epoch: tslib_1.__classPrivateFieldGet(this, _Snowflake_epoch, "f"),
- };
- }
- /**
- * Retrieves the timestamp field's value from a snowflake.
- * @param id The snowflake to get the timestamp value from.
- * @returns The UNIX timestamp that is stored in `id`.
- */
- timestampFrom(id) {
- return Number((BigInt(id) >> 22n) + tslib_1.__classPrivateFieldGet(this, _Snowflake_epoch, "f"));
- }
-}
-exports.Snowflake = Snowflake;
-_Snowflake_increment = new WeakMap(), _Snowflake_epoch = new WeakMap();
-//# sourceMappingURL=Snowflake.js.map
\ No newline at end of file
diff --git a/backend/dist/utils/Snowflake.js.map b/backend/dist/utils/Snowflake.js.map
deleted file mode 100644
index 363acdf9..00000000
--- a/backend/dist/utils/Snowflake.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"Snowflake.js","sourceRoot":"","sources":["../../utils/Snowflake.ts"],"names":[],"mappings":";;;;;AAAA,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,MAAM,QAAQ,GAAG,EAAE,CAAC;AAEpB;;;;;;;;;;;;GAYG;AACH,MAAa,SAAS;IAmBpB;;OAEG;IACH,YAAmB,KAA6B;QArBhD;;;WAGG;QACH,+BAAa,EAAE,EAAC;QAEhB;;;WAGG;QACH,mCAAe;QAEf;;WAEG;QACH,iGAAiG;QAC1F;;;;mBAAS,IAAI,CAAC,WAAW;WAAC;QAM/B,+BAAA,IAAI,oBAAU,MAAM,CAAC,KAAK,YAAY,IAAI,CAAC,CAAC,CAAC,KA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E,CAAC,CAAC;QAC5B,OAAO;YACL,EAAE,EAAE,QAAQ;YACZ,SAAS,EAAE,CAAC,QAAQ,IAAI,GAAG,CAAC,GAAG,+BAAA,IAAI,wBAAO;YAC1C,QAAQ,EAAE,CAAC,QAAQ,IAAI,GAAG,CAAC,GAAG,GAAQ;YACtC,SAAS,EAAE,CAAC,QAAQ,IAAI,GAAG,CAAC,GAAG,GAAQ;YACvC,SAAS,EAAE,QAAQ,GAAG,KAAe;YACrC,KAAK,EAAE,+BAAA,IAAI,wBAAO;SACnB,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACI,aAAa,CAAC,EAAmB;QACtC,OAAO,MAAM,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,GAAG,CAAC,GAAG,+BAAA,IAAI,wBAAO,CAAC,CAAC;IACnD,CAAC;CACF;AAjGD,8BAiGC","sourcesContent":["const ProcessId = 1n;\nconst WorkerId = 0n;\n\n/**\n * A class for generating and deconstructing Twitter snowflakes.\n *\n * A {@link https://developer.twitter.com/en/docs/twitter-ids Twitter snowflake}\n * is a 64-bit unsigned integer with 4 result that have a fixed epoch value.\n *\n * If we have a snowflake `266241948824764416` we can represent it as binary:\n * ```\n * 64 22 17 12 0\n * 000000111011000111100001101001000101000000 00001 00000 000000000000\n * number of ms since epoch worker pid increment\n * ```\n */\nexport class Snowflake {\n /**\n * Internal incrementor for generating snowflakes\n * @internal\n */\n #increment = 0n;\n\n /**\n * Internal reference of the epoch passed in the constructor\n * @internal\n */\n #epoch: bigint;\n\n /**\n * Alias for {@link deconstruct}\n */\n // eslint-disable-next-line @typescript-eslint/unbound-method, @typescript-eslint/no-invalid-this\n public decode = this.deconstruct;\n\n /**\n * @param epoch the epoch to use\n */\n public constructor(epoch: number | bigint | Date) {\n this.#epoch = BigInt(epoch instanceof Date ? epoch.getTime() : epoch);\n }\n\n /**\n * The epoch for this snowflake.\n */\n public get epoch(): bigint {\n return this.#epoch;\n }\n\n /**\n * Generates a snowflake given an epoch and optionally a timestamp\n * @param options options to pass into the generator, see {@link SnowflakeGenerateOptions}\n *\n * **note** when `increment` is not provided it defaults to the private `increment` of the instance\n * @example\n * ```typescript\n * const epoch = new Date('2000-01-01T00:00:00.000Z');\n * const snowflake = new Snowflake(epoch).generate();\n * ```\n * @returns A unique snowflake\n */\n public generate({\n increment,\n timestamp = Date.now(),\n workerId = WorkerId,\n processId = ProcessId,\n }: SnowflakeGenerateOptions = {}) {\n if (timestamp instanceof Date) timestamp = BigInt(timestamp.getTime());\n else if (typeof timestamp === 'number') timestamp = BigInt(timestamp);\n else if (typeof timestamp !== 'bigint') {\n throw new TypeError(`\"timestamp\" argument must be a number, bigint, or Date (received ${typeof timestamp})`);\n }\n\n if (typeof increment === 'bigint' && increment >= 4095n) increment = 0n;\n else {\n increment = this.#increment++;\n if (this.#increment >= 4095n) this.#increment = 0n;\n }\n\n // timestamp, workerId, processId, increment\n return ((timestamp - this.#epoch) << 22n) | ((workerId & 0b11111n) << 17n) | ((processId & 0b11111n) << 12n) | increment;\n }\n\n /**\n * Deconstructs a snowflake given a snowflake ID\n * @param id the snowflake to deconstruct\n * @returns a deconstructed snowflake\n * @example\n * ```typescript\n * const epoch = new Date('2000-01-01T00:00:00.000Z');\n * const snowflake = new Snowflake(epoch).deconstruct('3971046231244935168');\n * ```\n */\n public deconstruct(id: string | bigint): DeconstructedSnowflake {\n const bigIntId = BigInt(id);\n return {\n id: bigIntId,\n timestamp: (bigIntId >> 22n) + this.#epoch,\n workerId: (bigIntId >> 17n) & 0b11111n,\n processId: (bigIntId >> 12n) & 0b11111n,\n increment: bigIntId & 0b111111111111n,\n epoch: this.#epoch,\n };\n }\n\n /**\n * Retrieves the timestamp field's value from a snowflake.\n * @param id The snowflake to get the timestamp value from.\n * @returns The UNIX timestamp that is stored in `id`.\n */\n public timestampFrom(id: string | bigint): number {\n return Number((BigInt(id) >> 22n) + this.#epoch);\n }\n}\n\n/**\n * Options for Snowflake#generate\n */\nexport interface SnowflakeGenerateOptions {\n /**\n * Timestamp or date of the snowflake to generate\n * @default Date.now()\n */\n timestamp?: number | bigint | Date;\n\n /**\n * The increment to use\n * @default 0n\n * @remark keep in mind that this bigint is auto-incremented between generate calls\n */\n increment?: bigint;\n\n /**\n * The worker ID to use, will be truncated to 5 bits (0-31)\n * @default 0n\n */\n workerId?: bigint;\n\n /**\n * The process ID to use, will be truncated to 5 bits (0-31)\n * @default 1n\n */\n processId?: bigint;\n}\n\n/**\n * Object returned by Snowflake#deconstruct\n */\nexport interface DeconstructedSnowflake {\n /**\n * The id in BigInt form\n */\n id: bigint;\n\n /**\n * The timestamp stored in the snowflake\n */\n timestamp: bigint;\n\n /**\n * The worker id stored in the snowflake\n */\n workerId: bigint;\n\n /**\n * The process id stored in the snowflake\n */\n processId: bigint;\n\n /**\n * The increment stored in the snowflake\n */\n increment: bigint;\n\n /**\n * The epoch to use in the snowflake\n */\n epoch: bigint;\n}\n"]}
\ No newline at end of file
diff --git a/backend/dist/utils/functions.js b/backend/dist/utils/functions.js
deleted file mode 100644
index 726727ba..00000000
--- a/backend/dist/utils/functions.js
+++ /dev/null
@@ -1,33 +0,0 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.checkAndChange = exports.isErr = exports.error = exports.success = void 0;
-function success(result) {
- const Response = {
- status: 'success',
- timestamp: Date.now(),
- result: result,
- };
- return Response;
-}
-exports.success = success;
-function error(message) {
- const Response = {
- status: 'error',
- timestamp: Date.now(),
- message: message,
- };
- return Response;
-}
-exports.error = error;
-function isErr(param) {
- return param instanceof Error;
-}
-exports.isErr = isErr;
-function checkAndChange(obj) {
- if (isErr(obj))
- return error(obj.message || obj);
- else
- return success(obj);
-}
-exports.checkAndChange = checkAndChange;
-//# sourceMappingURL=functions.js.map
\ No newline at end of file
diff --git a/backend/dist/utils/functions.js.map b/backend/dist/utils/functions.js.map
deleted file mode 100644
index 4b912cc6..00000000
--- a/backend/dist/utils/functions.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../utils/functions.ts"],"names":[],"mappings":";;;AAEA,SAAgB,OAAO,CAAC,MAAW;IACjC,MAAM,QAAQ,GAAc;QAC1B,MAAM,EAAE,SAAS;QACjB,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;QACrB,MAAM,EAAE,MAAM;KACf,CAAC;IACF,OAAO,QAAQ,CAAC;AAClB,CAAC;AAPD,0BAOC;AAED,SAAgB,KAAK,CAAC,OAAe;IACnC,MAAM,QAAQ,GAAc;QAC1B,MAAM,EAAE,OAAO;QACf,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;QACrB,OAAO,EAAE,OAAO;KACjB,CAAC;IACF,OAAO,QAAQ,CAAC;AAClB,CAAC;AAPD,sBAOC;AAED,SAAgB,KAAK,CAAC,KAAU;IAC9B,OAAO,KAAK,YAAY,KAAK,CAAC;AAChC,CAAC;AAFD,sBAEC;AAED,SAAgB,cAAc,CAAC,GAAQ;IACrC,IAAI,KAAK,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,CAAC;;QAC5C,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;AAC3B,CAAC;AAHD,wCAGC","sourcesContent":["import type { IResponse } from '../types';\n\nexport function success(result: any): IResponse {\n const Response: IResponse = {\n status: 'success',\n timestamp: Date.now(),\n result: result,\n };\n return Response;\n}\n\nexport function error(message: string): IResponse {\n const Response: IResponse = {\n status: 'error',\n timestamp: Date.now(),\n message: message,\n };\n return Response;\n}\n\nexport function isErr(param: any): Boolean {\n return param instanceof Error;\n}\n\nexport function checkAndChange(obj: any) {\n if (isErr(obj)) return error(obj.message || obj);\n else return success(obj);\n}\n"]}
\ No newline at end of file