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.

Some fixes

Veauville Raphael976cb45af011
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..7b87e07d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+#Public dir
+uploads/images/*
+uploads/webp/*
+!uploads/images/default
+!uploads/webp/default
diff --git a/@alexandrie/migration/dist/index.js b/@alexandrie/migration/dist/index.js
index 3d5b0232..d1095111 100644
--- a/@alexandrie/migration/dist/index.js
+++ b/@alexandrie/migration/dist/index.js
@@ -15,31 +15,66 @@ New categories:
153009590005403654,Mécanique
153009590005403655,Acides & Bases
153009590005403656,Oxydoréduction
+153009590005403657,Général (Ingénierie)
+153009590005403658,Informations
+153009590005403659,Réseaux
+153009590005403660,Modélisation de systèmes
-Old categories:
-10247724590960640,Chimie (Acides & Oxydoréduction)
-135688451642101760,Optique
-1563846779080705,Général
-1564500943704066,Nombres
-1564753356918787,Algèbre
-1564854359953412,Analyse
-1564994986577925,Géométrie
-1565265611460614,Probabilités et statistiques
-1565634844430343,Algorithmie
-38224311751806976,Information
-3993900674977792,Général
-4030806225850368,Matière
-4031642125471745,Énergie
-44031625821949952,Ondes
-51632421858185216,Réseaux
-59881276756201472,Raisonnement
-61787697525559296,Environnement
-8124080637087744,Général
-8124501086703617,Modélisation de systèmes
-9154132401197056,Mécanique
+Old categories: (name, id)
+Général,general
+Nombres,nombres
+Algèbres,algebres
+Analyse,analyse
+Géométrie,geometrie
+Probabilités et statistiques,probalitites-et-statistiques
+Algorithmie,algorithmie
+Information,information
+Général,general
+Matière,matiere
+Énergie,energie
+Ondes,ondes
+Réseaux,reseaux
+Général,general
+Modélisation de systèmes,modelisation
+Mécanique,mecanique
+
*/
+function getNewCategoryID(old_id) {
+ switch (old_id) {
+ case 'general':
+ return '153009357737431040'; // Général (Maths)
+ case 'nombres':
+ return '153009357787762689'; // You can specify a default value for unknown old IDs
+ case 'algebres':
+ return '153009357787762689'; // Algèbre
+ case 'analyse':
+ return '153009357787762690'; // Analyse
+ case 'geometrie':
+ return '153009357787762691'; // Géométrie
+ case 'probalitites-et-statistiques':
+ return '153009357787762692'; // Probabilités et statistiques
+ case 'algorithmie':
+ return '153009590005403648'; // Algorithmie
+ case 'information':
+ return '153009590005403658'; // Informations
+ case 'matiere':
+ return '153009590005403652'; // Matière
+ case 'energie':
+ return '153009590005403650'; // Énergie
+ case 'ondes':
+ return '153009590005403653'; // Ondes
+ case 'reseaux':
+ return '153009590005403659'; // Réseaux
+ case 'modelisation':
+ return '153009590005403660'; // Modélisation de systèmes
+ case 'mecanique':
+ return '153009590005403654'; // Mécanique
+ default:
+ return '153009590005403662'; // You can specify a default value for unknown old IDs
+ }
+}
import { createPool } from 'mysql2';
function getConnection(host, user, password, db_name) {
return createPool({
@@ -66,7 +101,7 @@ function formatArticleToDocument(article) {
name: article.name,
description: article.description,
tags: '',
- category: getNewCategoryID(article.main_category),
+ category: getNewCategoryID(article.sub_category),
accessibility: 1,
content_markdown: article.content_markdown,
content_html: article.content_html,
@@ -75,53 +110,6 @@ function formatArticleToDocument(article) {
updated_timestamp: article.updated_timestamp,
};
}
-// With the old category id return the new category id
-function getNewCategoryID(old_id) {
- switch (old_id) {
- case '10247724590960640':
- return '153009590005403656';
- case '135688451642101760':
- return '153009590005403651';
- case '1563846779080705':
- return '153009357737431040';
- case '1564500943704066':
- return '153009357787762689';
- case '1564753356918787':
- return '153009357787762690';
- case '1564854359953412':
- return '153009357787762691';
- case '1564994986577925':
- return '153009357787762692';
- case '1565265611460614':
- return '153009357787762692';
- case '1565634844430343':
- return '153009590005403648';
- case '38224311751806976':
- return '153009590005403649';
- case '3993900674977792':
- return '153009590005403650';
- case '4030806225850368':
- return '153009590005403651';
- case '4031642125471745':
- return '153009590005403652';
- case '44031625821949952':
- return '153009590005403653';
- case '51632421858185216':
- return '153009590005403654';
- case '59881276756201472':
- return '153009590005403655';
- case '61787697525559296':
- return '153009590005403656';
- case '8124080637087744':
- return '153009590005403648';
- case '8124501086703617':
- return '153009590005403648';
- case '9154132401197056':
- return '153009590005403652';
- default:
- return '153009357737431040';
- }
-}
console.log('Starting migration...');
const articles = await getAllOldArticles();
console.log('Got all articles.');
diff --git a/@alexandrie/migration/dist/index.js.map b/@alexandrie/migration/dist/index.js.map
index 936fddf4..33b83124 100644
--- a/@alexandrie/migration/dist/index.js.map
+++ b/@alexandrie/migration/dist/index.js.map
@@ -1 +1 @@
-{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyCE;AAEF,OAAO,EAAa,UAAU,EAAE,MAAM,QAAQ,CAAC;AAG/C,SAAS,aAAa,CAAC,IAAa,EAAE,IAAa,EAAE,QAAiB,EAAE,OAAgB;IACtF,OAAO,UAAU,CAAC;QAChB,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,QAAQ;QAClB,QAAQ,EAAE,OAAO;KAClB,CAAC,CAAC;AACL,CAAC;AAED,MAAM,MAAM,GAAS,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AACxE,MAAM,MAAM,GAAG,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;AAExE,SAAS,iBAAiB;IACxB,OAAO,IAAI,OAAO,CAAY,OAAO,CAAC,EAAE;QACtC,MAAM,CAAC,KAAK,CAAc,wBAAwB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;YAClE,IAAI,GAAG;gBAAE,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC1B,OAAO,CAAC,MAAM,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AACD,SAAS,uBAAuB,CAAC,OAAgB;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,CAAC,iBAAiB;SAC3B,EACD,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;YACd,IAAI,GAAG;gBAAE,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC1B,OAAO,CAAC,GAAG,CAAC,qBAAqB,QAAQ,CAAC,IAAI,GAAG,CAAC,CAAC;YACnD,OAAO,CAAC,MAAM,CAAC,CAAC;QAClB,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;CACJ;AAED,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;AACnC,MAAM,CAAC,GAAG,EAAE,CAAC;AACb,MAAM,CAAC,GAAG,EAAE,CAAC","sourcesContent":["/*\nNew categories:\n153009357737431040,Général (Maths)\n153009357787762689,Algèbre\n153009357787762690,Analyse\n153009357787762691,Géométrie\n153009357787762692,Probabilités et statistiques\n153009357791956997,Raisonnements\n153009590005403648,Algorithmie\n153009590005403649,Général (Physique)\n153009590005403650,Énergie\n153009590005403651,Optique\n153009590005403652,Matière\n153009590005403653,Ondes\n153009590005403654,Mécanique\n153009590005403655,Acides & Bases\n153009590005403656,Oxydoréduction\n\n\nOld categories:\n10247724590960640,Chimie (Acides & Oxydoréduction)\n135688451642101760,Optique\n1563846779080705,Général\n1564500943704066,Nombres\n1564753356918787,Algèbre\n1564854359953412,Analyse\n1564994986577925,Géométrie\n1565265611460614,Probabilités et statistiques\n1565634844430343,Algorithmie\n38224311751806976,Information\n3993900674977792,Général\n4030806225850368,Matière\n4031642125471745,Énergie\n44031625821949952,Ondes\n51632421858185216,Réseaux\n59881276756201472,Raisonnement \n61787697525559296,Environnement \n8124080637087744,Général\n8124501086703617,Modélisation de systèmes\n9154132401197056,Mécanique\n\n*/\n\nimport { type Pool, createPool } from 'mysql2';\nimport type { Article, ArticleDB, Document, DocumentDB } from './types';\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\nconst old_db: Pool = getConnection('localhost', 'root', 'root', 'docs');\nconst new_db = getConnection('localhost', 'root', 'root', 'alexandrie');\n\nfunction getAllOldArticles() {\n return new Promise<Article[]>(resolve => {\n old_db.query<ArticleDB[]>('SELECT * FROM articles', (err, result) => {\n if (err) console.log(err);\n resolve(result);\n });\n });\n}\nfunction formatArticleToDocument(article: Article): Document {\n return {\n id: article.id,\n name: article.name,\n description: article.description,\n tags: '',\n category: getNewCategoryID(article.main_category),\n accessibility: 1,\n content_markdown: article.content_markdown,\n content_html: article.content_html,\n author_id: '152981937240150016',\n created_timestamp: article.created_timestamp,\n updated_timestamp: article.updated_timestamp,\n };\n}\n\n// With the old category id return the new category id\nfunction getNewCategoryID(old_id: string): string {\n switch (old_id) {\n case '10247724590960640':\n return '153009590005403656';\n case '135688451642101760':\n return '153009590005403651';\n case '1563846779080705':\n return '153009357737431040';\n case '1564500943704066':\n return '153009357787762689';\n case '1564753356918787':\n return '153009357787762690';\n case '1564854359953412':\n return '153009357787762691';\n case '1564994986577925':\n return '153009357787762692';\n case '1565265611460614':\n return '153009357787762692';\n case '1565634844430343':\n return '153009590005403648';\n case '38224311751806976':\n return '153009590005403649';\n case '3993900674977792':\n return '153009590005403650';\n case '4030806225850368':\n return '153009590005403651';\n case '4031642125471745':\n return '153009590005403652';\n case '44031625821949952':\n return '153009590005403653';\n case '51632421858185216':\n return '153009590005403654';\n case '59881276756201472':\n return '153009590005403655';\n case '61787697525559296':\n return '153009590005403656';\n case '8124080637087744':\n return '153009590005403648';\n case '8124501086703617':\n return '153009590005403648';\n case '9154132401197056':\n return '153009590005403652';\n default:\n return '153009357737431040';\n }\n}\n\nconsole.log('Starting migration...');\n\nconst articles = await getAllOldArticles();\nconsole.log('Got all articles.');\nconst documents = articles.map(article => formatArticleToDocument(article));\nconsole.log('Formatted all articles.');\nconsole.log('Starting to insert documents...');\nlet i = 1;\nfor (const document of documents) {\n console.log(`Inserting document ${document.name}... (${i}/${documents.length})`);\n i++;\n await new Promise(resolve => {\n new_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 document.id,\n document.name,\n document.description,\n document.tags,\n document.category,\n document.accessibility,\n document.content_markdown,\n document.content_html,\n document.author_id,\n document.created_timestamp,\n document.updated_timestamp,\n ],\n (err, result) => {\n if (err) console.log(err);\n console.log(`Inserted document ${document.name}.`);\n resolve(result);\n },\n );\n });\n}\n\nconsole.log('Migration finished.');\nnew_db.end();\nold_db.end();\n"]}
\ No newline at end of file
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0CE;AACF,SAAS,gBAAgB,CAAC,MAAc;IACtC,QAAQ,MAAM,EAAE;QACd,KAAK,SAAS;YACZ,OAAO,oBAAoB,CAAC,CAAC,kBAAkB;QACjD,KAAK,SAAS;YACZ,OAAO,oBAAoB,CAAC,CAAC,sDAAsD;QACrF,KAAK,UAAU;YACb,OAAO,oBAAoB,CAAC,CAAC,UAAU;QACzC,KAAK,SAAS;YACZ,OAAO,oBAAoB,CAAC,CAAC,UAAU;QACzC,KAAK,WAAW;YACd,OAAO,oBAAoB,CAAC,CAAC,YAAY;QAC3C,KAAK,8BAA8B;YACjC,OAAO,oBAAoB,CAAC,CAAC,+BAA+B;QAC9D,KAAK,aAAa;YAChB,OAAO,oBAAoB,CAAC,CAAC,cAAc;QAC7C,KAAK,aAAa;YAChB,OAAO,oBAAoB,CAAC,CAAC,eAAe;QAC9C,KAAK,SAAS;YACZ,OAAO,oBAAoB,CAAC,CAAC,UAAU;QACzC,KAAK,SAAS;YACZ,OAAO,oBAAoB,CAAC,CAAC,UAAU;QACzC,KAAK,OAAO;YACV,OAAO,oBAAoB,CAAC,CAAC,QAAQ;QACvC,KAAK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ACd,IAAI,GAAG;gBAAE,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC1B,OAAO,CAAC,GAAG,CAAC,qBAAqB,QAAQ,CAAC,IAAI,GAAG,CAAC,CAAC;YACnD,OAAO,CAAC,MAAM,CAAC,CAAC;QAClB,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;CACJ;AAED,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;AACnC,MAAM,CAAC,GAAG,EAAE,CAAC;AACb,MAAM,CAAC,GAAG,EAAE,CAAC","sourcesContent":["/*\nNew categories:\n153009357737431040,Général (Maths)\n153009357787762689,Algèbre\n153009357787762690,Analyse\n153009357787762691,Géométrie\n153009357787762692,Probabilités et statistiques\n153009357791956997,Raisonnements\n153009590005403648,Algorithmie\n153009590005403649,Général (Physique)\n153009590005403650,Énergie\n153009590005403651,Optique\n153009590005403652,Matière\n153009590005403653,Ondes\n153009590005403654,Mécanique\n153009590005403655,Acides & Bases\n153009590005403656,Oxydoréduction\n153009590005403657,Général (Ingénierie)\n153009590005403658,Informations\n153009590005403659,Réseaux\n153009590005403660,Modélisation de systèmes\n\n\nOld categories: (name, id)\nGénéral,general\nNombres,nombres\nAlgèbres,algebres\nAnalyse,analyse\nGéométrie,geometrie\nProbabilités et statistiques,probalitites-et-statistiques\nAlgorithmie,algorithmie\nInformation,information\nGénéral,general\nMatière,matiere\nÉnergie,energie\nOndes,ondes\nRéseaux,reseaux\nGénéral,general\nModélisation de systèmes,modelisation\nMécanique,mecanique\n\n\n*/\nfunction getNewCategoryID(old_id: string): string {\n switch (old_id) {\n case 'general':\n return '153009357737431040'; // Général (Maths)\n case 'nombres':\n return '153009357787762689'; // You can specify a default value for unknown old IDs\n case 'algebres':\n return '153009357787762689'; // Algèbre\n case 'analyse':\n return '153009357787762690'; // Analyse\n case 'geometrie':\n return '153009357787762691'; // Géométrie\n case 'probalitites-et-statistiques':\n return '153009357787762692'; // Probabilités et statistiques\n case 'algorithmie':\n return '153009590005403648'; // Algorithmie\n case 'information':\n return '153009590005403658'; // Informations\n case 'matiere':\n return '153009590005403652'; // Matière\n case 'energie':\n return '153009590005403650'; // Énergie\n case 'ondes':\n return '153009590005403653'; // Ondes\n case 'reseaux':\n return '153009590005403659'; // Réseaux\n case 'modelisation':\n return '153009590005403660'; // Modélisation de systèmes\n case 'mecanique':\n return '153009590005403654'; // Mécanique\n default:\n return '153009590005403662'; // You can specify a default value for unknown old IDs\n }\n}\nimport { type Pool, createPool } from 'mysql2';\nimport type { Article, ArticleDB, Document, DocumentDB } from './types';\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\nconst old_db: Pool = getConnection('localhost', 'root', 'root', 'docs');\nconst new_db = getConnection('localhost', 'root', 'root', 'alexandrie');\n\nfunction getAllOldArticles() {\n return new Promise<Article[]>(resolve => {\n old_db.query<ArticleDB[]>('SELECT * FROM articles', (err, result) => {\n if (err) console.log(err);\n resolve(result);\n });\n });\n}\nfunction formatArticleToDocument(article: Article): Document {\n return {\n id: article.id,\n name: article.name,\n description: article.description,\n tags: '',\n category: getNewCategoryID(article.sub_category),\n accessibility: 1,\n content_markdown: article.content_markdown,\n content_html: article.content_html,\n author_id: '152981937240150016',\n created_timestamp: article.created_timestamp,\n updated_timestamp: article.updated_timestamp,\n };\n}\n\nconsole.log('Starting migration...');\n\nconst articles = await getAllOldArticles();\nconsole.log('Got all articles.');\nconst documents = articles.map(article => formatArticleToDocument(article));\nconsole.log('Formatted all articles.');\nconsole.log('Starting to insert documents...');\nlet i = 1;\nfor (const document of documents) {\n console.log(`Inserting document ${document.name}... (${i}/${documents.length})`);\n i++;\n await new Promise(resolve => {\n new_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 document.id,\n document.name,\n document.description,\n document.tags,\n document.category,\n document.accessibility,\n document.content_markdown,\n document.content_html,\n document.author_id,\n document.created_timestamp,\n document.updated_timestamp,\n ],\n (err, result) => {\n if (err) console.log(err);\n console.log(`Inserted document ${document.name}.`);\n resolve(result);\n },\n );\n });\n}\n\nconsole.log('Migration finished.');\nnew_db.end();\nold_db.end();\n"]}
\ No newline at end of file
diff --git a/@alexandrie/migration/src/index.ts b/@alexandrie/migration/src/index.ts
index 69da4767..4cb44703 100644
--- a/@alexandrie/migration/src/index.ts
+++ b/@alexandrie/migration/src/index.ts
@@ -15,32 +15,66 @@ New categories:
153009590005403654,Mécanique
153009590005403655,Acides & Bases
153009590005403656,Oxydoréduction
+153009590005403657,Général (Ingénierie)
+153009590005403658,Informations
+153009590005403659,Réseaux
+153009590005403660,Modélisation de systèmes
-Old categories:
-10247724590960640,Chimie (Acides & Oxydoréduction)
-135688451642101760,Optique
-1563846779080705,Général
-1564500943704066,Nombres
-1564753356918787,Algèbre
-1564854359953412,Analyse
-1564994986577925,Géométrie
-1565265611460614,Probabilités et statistiques
-1565634844430343,Algorithmie
-38224311751806976,Information
-3993900674977792,Général
-4030806225850368,Matière
-4031642125471745,Énergie
-44031625821949952,Ondes
-51632421858185216,Réseaux
-59881276756201472,Raisonnement
-61787697525559296,Environnement
-8124080637087744,Général
-8124501086703617,Modélisation de systèmes
-9154132401197056,Mécanique
+Old categories: (name, id)
+Général,general
+Nombres,nombres
+Algèbres,algebres
+Analyse,analyse
+Géométrie,geometrie
+Probabilités et statistiques,probalitites-et-statistiques
+Algorithmie,algorithmie
+Information,information
+Général,general
+Matière,matiere
+Énergie,energie
+Ondes,ondes
+Réseaux,reseaux
+Général,general
+Modélisation de systèmes,modelisation
+Mécanique,mecanique
-*/
+*/
+function getNewCategoryID(old_id: string): string {
+ switch (old_id) {
+ case 'general':
+ return '153009357737431040'; // Général (Maths)
+ case 'nombres':
+ return '153009357787762689'; // You can specify a default value for unknown old IDs
+ case 'algebres':
+ return '153009357787762689'; // Algèbre
+ case 'analyse':
+ return '153009357787762690'; // Analyse
+ case 'geometrie':
+ return '153009357787762691'; // Géométrie
+ case 'probalitites-et-statistiques':
+ return '153009357787762692'; // Probabilités et statistiques
+ case 'algorithmie':
+ return '153009590005403648'; // Algorithmie
+ case 'information':
+ return '153009590005403658'; // Informations
+ case 'matiere':
+ return '153009590005403652'; // Matière
+ case 'energie':
+ return '153009590005403650'; // Énergie
+ case 'ondes':
+ return '153009590005403653'; // Ondes
+ case 'reseaux':
+ return '153009590005403659'; // Réseaux
+ case 'modelisation':
+ return '153009590005403660'; // Modélisation de systèmes
+ case 'mecanique':
+ return '153009590005403654'; // Mécanique
+ default:
+ return '153009590005403662'; // You can specify a default value for unknown old IDs
+ }
+}
import { type Pool, createPool } from 'mysql2';
import type { Article, ArticleDB, Document, DocumentDB } from './types';
@@ -70,7 +104,7 @@ function formatArticleToDocument(article: Article): Document {
name: article.name,
description: article.description,
tags: '',
- category: getNewCategoryID(article.main_category),
+ category: getNewCategoryID(article.sub_category),
accessibility: 1,
content_markdown: article.content_markdown,
content_html: article.content_html,
@@ -80,54 +114,6 @@ function formatArticleToDocument(article: Article): Document {
};
}
-// With the old category id return the new category id
-function getNewCategoryID(old_id: string): string {
- switch (old_id) {
- case '10247724590960640':
- return '153009590005403656';
- case '135688451642101760':
- return '153009590005403651';
- case '1563846779080705':
- return '153009357737431040';
- case '1564500943704066':
- return '153009357787762689';
- case '1564753356918787':
- return '153009357787762690';
- case '1564854359953412':
- return '153009357787762691';
- case '1564994986577925':
- return '153009357787762692';
- case '1565265611460614':
- return '153009357787762692';
- case '1565634844430343':
- return '153009590005403648';
- case '38224311751806976':
- return '153009590005403649';
- case '3993900674977792':
- return '153009590005403650';
- case '4030806225850368':
- return '153009590005403651';
- case '4031642125471745':
- return '153009590005403652';
- case '44031625821949952':
- return '153009590005403653';
- case '51632421858185216':
- return '153009590005403654';
- case '59881276756201472':
- return '153009590005403655';
- case '61787697525559296':
- return '153009590005403656';
- case '8124080637087744':
- return '153009590005403648';
- case '8124501086703617':
- return '153009590005403648';
- case '9154132401197056':
- return '153009590005403652';
- default:
- return '153009357737431040';
- }
-}
-
console.log('Starting migration...');
const articles = await getAllOldArticles();
diff --git a/backend/app.ts b/backend/app.ts
index 66f55e6e..cdefd895 100644
--- a/backend/app.ts
+++ b/backend/app.ts
@@ -69,7 +69,7 @@ export class App {
res.set('x-timestamp', Date.now().toString());
},
};
- this.app.use('/static', express.static(join(__dirname, '../uploads'), staticOptions));
+ this.app.use('/static', express.static(join(__dirname, '../../uploads'), staticOptions));
this.app.listen(this.port, () => {
Logger.success(`Started on port ${this.port}`);
diff --git a/backend/classes/DocumentsManager.ts b/backend/classes/DocumentsManager.ts
index 7b6f2c6c..a98a4eb7 100644
--- a/backend/classes/DocumentsManager.ts
+++ b/backend/classes/DocumentsManager.ts
@@ -7,12 +7,16 @@ export default class DocumentsManager extends Base {
super(app);
}
- public getAll() {
- return new Promise<Document[]>(async (resolve, reject) => {
- this.app.db.query<DocumentDB[]>('SELECT * FROM documents WHERE `accessibility` = 1 ORDER BY `name`', (err, result) => {
- if (err) return reject('Internal database error.');
- resolve(result);
- });
+ public getAll(all?: string) {
+ // If all is true, return all documents, else return only public documents (accessibility = 1)
+ return new Promise<Document[]>((resolve, reject) => {
+ this.app.db.query<DocumentDB[]>(
+ `SELECT * FROM documents ${all == 'true' ? '' : 'WHERE `accessibility` = 1'} ORDER BY \`name\``,
+ (err, result) => {
+ if (err) return reject('Internal database error.');
+ resolve(result);
+ },
+ );
});
}
diff --git a/backend/controllers/cdn.controller.ts b/backend/controllers/cdn.controller.ts
index 18bfd2ef..76368c35 100644
--- a/backend/controllers/cdn.controller.ts
+++ b/backend/controllers/cdn.controller.ts
@@ -18,11 +18,11 @@ export function convertImagetoWebp(_: App, req: Request, res: Response) {
return;
}
- const path = join(__dirname, `../../uploads/images/${filename}`);
+ const path = join(__dirname, `../../../uploads/images/${filename}`);
if (existsSync(path)) {
sharp(path)
- .toFile(join(__dirname, `../../uploads/webp/${filename.split('.')[0]}.webp`))
+ .toFile(join(__dirname, `../../../uploads/webp/${filename.split('.')[0]}.webp`))
.then(() => res.status(200).json(success(`/webp/${filename.split('.')[0]}.webp`)))
.catch(_ => res.status(500).json(error('Error while converting image to webp.')));
} else res.status(404).json(error('File not found.'));
diff --git a/backend/controllers/documents.controller.ts b/backend/controllers/documents.controller.ts
index d3cc4659..bc563130 100644
--- a/backend/controllers/documents.controller.ts
+++ b/backend/controllers/documents.controller.ts
@@ -20,7 +20,7 @@ export default class DocumentsController {
.catch((err: Error) => res.status(500).json(error(err.message)));
} else {
this.db_a
- .getAll()
+ .getAll(req.query.all?.toString())
.then((result: Partial<Document>[]) => {
// Select fields
if (req.query.fields) {
diff --git a/backend/dist/app.js b/backend/dist/app.js
index 38593ceb..f4ce5bb3 100644
--- a/backend/dist/app.js
+++ b/backend/dist/app.js
@@ -85,7 +85,7 @@ class App {
res.set('x-timestamp', Date.now().toString());
},
};
- this.app.use('/static', express_1.default.static((0, path_1.join)(__dirname, '../uploads'), staticOptions));
+ 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}`);
});
diff --git a/backend/dist/app.js.map b/backend/dist/app.js.map
index 1752fe57..120d42ef 100644
--- a/backend/dist/app.js.map
+++ b/backend/dist/app.js.map
@@ -1 +1 @@
-{"version":3,"file":"app.js","sourceRoot":"","sources":["../app.ts"],"names":[],"mappings":";;;;AAAA,2BAAiC;AACjC,+BAA4B;AAC5B,8DAA8B;AAM9B,6DAA6B;AAC7B,oEAAoC;AACpC,iDAAmD;AACnD,iDAA8C;AAE9C,MAAa,GAAG;IAKd;QAJQ;;;;;WAAI;QACL;;;;;WAAa;QACb;;;;;WAAqB;QACrB;;;;;WAAS;QAEd,gBAAM,CAAC,KAAK,CAAC,eAAe,OAAO,CAAC,GAAG,CAAC,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B,EAAE,CAAC;QACzB,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;QAC1B,MAAM,aAAa,GAAG;YACpB,QAAQ,EAAE,QAAQ;YAClB,IAAI,EAAE,KAAK;YACX,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,IAAI;YACZ,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,UAAU,GAAa;gBACjC,GAAG,CAAC,GAAG,CAAC,aAAa,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;YAChD,CAAC;SACF,CAAC;QACF,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,SAAS,EAAE,iBAAO,CAAC,MAAM,CAAC,IAAA,WAAI,EAAC,SAAS,EAAE,YAAY,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC;QAEtF,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE;YAC9B,gBAAM,CAAC,OAAO,CAAC,mBAAmB,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAU,EAAE,GAAa,EAAE,EAAE;YAC9C,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAA,0BAAc,EAAC,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAnED,kBAmEC","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 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 }\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
+{"version":3,"file":"app.js","sourceRoot":"","sources":["../app.ts"],"names":[],"mappings":";;;;AAAA,2BAAiC;AACjC,+BAA4B;AAC5B,8DAA8B;AAM9B,6DAA6B;AAC7B,oEAAoC;AACpC,iDAAmD;AACnD,iDAA8C;AAE9C,MAAa,GAAG;IAKd;QAJQ;;;;;WAAI;QACL;;;;;WAAa;QACb;;;;;WAAqB;QACrB;;;;;WAAS;QAEd,gBAAM,CAAC,KAAK,CAAC,eAAe,OAAO,CAAC,GAAG,CAAC,QAAQ,UAAU,CAAC,CAAC;QAC5D,IAAI,CAAC,GAAG,GAAG,IAAA,iBAAO,GAAE,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,MAAM,CAAC;QACvC,IAAI,CAAC,SAAS,GAAG,IAAI,qBAAS,CAAC,aAAa,CAAC,CAAC;QAC9C,IAAI,CAAC,EAAE,GAAG,IAAA,YAAE,EAAC,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,YAAY,CAAC,CAAC;IACpG,CAAC;IACO,KAAK,CAAC,YAAY;QACxB,MAAM,WAAW,GAAG,IAAA,gBAAW,EAAC,IAAA,WAAI,EAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;QAC3D,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE;YAC7B,MAAM,MAAM,GAAG,IAAA,gBAAW,EAAC,IAAA,WAAI,EAAC,SAAS,EAAE,UAAU,GAAG,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;YAClG,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE;gBACzB,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C,GAAG,CAAC,CAAC,IAAI,CAAC,IAAA,0BAAc,EAAC,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAnED,kBAmEC","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 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 }\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/DocumentsManager.js b/backend/dist/classes/DocumentsManager.js
index b8b3e8e1..71f5f810 100644
--- a/backend/dist/classes/DocumentsManager.js
+++ b/backend/dist/classes/DocumentsManager.js
@@ -6,9 +6,10 @@ class DocumentsManager extends Base_1.default {
constructor(app) {
super(app);
}
- getAll() {
- return new Promise(async (resolve, reject) => {
- this.app.db.query('SELECT * FROM documents WHERE `accessibility` = 1 ORDER BY `name`', (err, result) => {
+ 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);
diff --git a/backend/dist/classes/DocumentsManager.js.map b/backend/dist/classes/DocumentsManager.js.map
index 7c114a1b..b3e8fc02 100644
--- a/backend/dist/classes/DocumentsManager.js.map
+++ b/backend/dist/classes/DocumentsManager.js.map
@@ -1 +1 @@
-{"version":3,"file":"DocumentsManager.js","sourceRoot":"","sources":["../../classes/DocumentsManager.ts"],"names":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AC,0BAA0B,CAAC,CAAC;gBACnD,OAAO,CAAC,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,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;AA1GD,mCA0GC","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() {\n return new Promise<Document[]>(async (resolve, reject) => {\n this.app.db.query<DocumentDB[]>('SELECT * FROM documents WHERE `accessibility` = 1 ORDER BY `name`', (err, result) => {\n if (err) return reject('Internal database error.');\n resolve(result);\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
+{"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,OAAO,IAAI,OAAO,CAAa,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACjD,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CACf,2BAA2B,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,2BAA2B,oBAAoB,EAC/F,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;gBACd,IAAI,GAAG;oBAAE,OAAO,MAAM,CAAC,0BAA0B,CAAC,CAAC;gBACnD,OAAO,CAAC,MAAM,CAAC,CAAC;YAClB,CAAC,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,gBAAgB,CAAC,QAAgB;QACtC,OAAO,IAAI,OAAO,CAAa,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACjD,IAAI,CAAC,QAAQ;gBAAE,OAAO,MAAM,CAAC,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC,CAAC;YACrF,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CACf,oFAAoF,EACpF,CAAC,QAAQ,CAAC,EACV,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;gBACd,IAAI,GAAG;oBAAE,OAAO,MAAM,CAAC,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I,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;YACnC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CACf,uKAAuK,EACvK;gBACE,IAAI,CAAC,IAAI;gBACT,IAAI,CAAC,WAAW;gBAChB,IAAI,CAAC,IAAI;gBACT,IAAI,CAAC,QAAQ;gBACb,IAAI,CAAC,aAAa;gBAClB,IAAI,CAAC,gBAAgB;gBACrB,IAAI,CAAC,YAAY;gBACjB,IAAI;gBACJ,EAAE;aACH,EACD,GAAG,CAAC,EAAE;gBACJ,IAAI,GAAG;oBAAE,OAAO,MAAM,CAAC,0BAA0B,CAAC,CAAC;gBACnD,OAAO,CAAC,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,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/controllers/cdn.controller.js b/backend/dist/controllers/cdn.controller.js
index 84d5f451..b2aa8ab1 100644
--- a/backend/dist/controllers/cdn.controller.js
+++ b/backend/dist/controllers/cdn.controller.js
@@ -16,10 +16,10 @@ function convertImagetoWebp(_, req, res) {
res.status(400).json((0, functions_1.error)('No file provided.'));
return;
}
- const path = (0, path_1.join)(__dirname, `../../uploads/images/${filename}`);
+ 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`))
+ .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.')));
}
diff --git a/backend/dist/controllers/cdn.controller.js.map b/backend/dist/controllers/cdn.controller.js.map
index 92cc87b1..f8028244 100644
--- a/backend/dist/controllers/cdn.controller.js.map
+++ b/backend/dist/controllers/cdn.controller.js.map
@@ -1 +1 @@
-{"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,CAAC,CAAC,EAAE;QAChF,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAA,iBAAK,EAAC,mBAAmB,CAAC,CAAC,CAAC;QACjD,OAAO;KACR;IAED,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAE/C,IAAI,CAAC,QAAQ,EAAE;QACb,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAA,iBAAK,EAAC,mBAAmB,CAAC,CAAC,CAAC;QACjD,OAAO;KACR;IAED,MAAM,IAAI,GAAG,IAAA,WAAI,EAAC,SAAS,EAAE,wBAAwB,QAAQ,EAAE,CAAC,CAAC;IAEjE,IAAI,IAAA,eAAU,EAAC,IAAI,CAAC,EAAE;QACpB,IAAA,eAAK,EAAC,IAAI,CAAC;aACR,MAAM,CAAC,IAAA,WAAI,EAAC,SAAS,EAAE,sBAAsB,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;aAC5E,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAA,mBAAO,EAAC,SAAS,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;aACjF,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAA,iBAAK,EAAC,uCAAuC,CAAC,CAAC,CAAC,CAAC;KACrF;;QAAM,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAA,iBAAK,EAAC,iBAAiB,CAAC,CAAC,CAAC;AACxD,CAAC;AArBD,gDAqBC","sourcesContent":["import { join } from 'path';\nimport { existsSync } from 'fs';\nimport sharp from 'sharp';\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
+{"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,O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AAI,CAAC,IAAA,iBAAK,EAAC,iBAAiB,CAAC,CAAC,CAAC;AACxD,CAAC;AArBD,gDAqBC","sourcesContent":["import { join } from 'path';\nimport { existsSync } from 'fs';\nimport sharp from 'sharp';\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
index d51d2c0f..536ac547 100644
--- a/backend/dist/controllers/documents.controller.js
+++ b/backend/dist/controllers/documents.controller.js
@@ -29,7 +29,7 @@ class DocumentsController {
}
else {
this.db_a
- .getAll()
+ .getAll(req.query.all?.toString())
.then((result) => {
// Select fields
if (req.query.fields) {
diff --git a/backend/dist/controllers/documents.controller.js.map b/backend/dist/controllers/documents.controller.js.map
index aff2f619..de383654 100644
--- a/backend/dist/controllers/documents.controller.js.map
+++ b/backend/dist/controllers/documents.controller.js.map
@@ -1 +1 @@
-{"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,CAAC;QACf,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AAC,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()\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
+{"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,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,0BAAgB,CAAC,GAAG,CAAC,CAAC;IACxC,CAAC;IAED,eAAe,CAAC,GAAY,EAAE,GAAa;QACzC,IAAI,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE;YACtB,IAAI,CAAC,IAAI;iBACN,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;iBAC/C,IAAI,CAAC,CAAC,KAAU,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAA,mBAAO,EAAC,KAAK,CAAC,CAAC,CAAC;iBAC1D,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;SACpE;aAAM;YACL,IAAI,CAAC,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AAG,CAAC,IAAI,CAAC,QAAQ;YAC3B,aAAa,EAAE,GAAG,CAAC,IAAI,CAAC,aAAa;YACrC,gBAAgB,EAAE,GAAG,CAAC,IAAI,CAAC,gBAAgB;YAC3C,YAAY,EAAE,GAAG,CAAC,IAAI,CAAC,YAAY;YACnC,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,OAAO;SAC/B,CAAC;aACD,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;IACD,cAAc,CAAC,GAAY,EAAE,GAAa;QACxC,IAAI,CAAC,IAAI;aACN,MAAM,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/middlewares/multer.cdn.js b/backend/dist/middlewares/multer.cdn.js
index 13aaeb89..78a3115e 100644
--- a/backend/dist/middlewares/multer.cdn.js
+++ b/backend/dist/middlewares/multer.cdn.js
@@ -15,7 +15,7 @@ var MIME_TYPES_IMAGE;
})(MIME_TYPES_IMAGE || (MIME_TYPES_IMAGE = {}));
const storage = multer_1.default.diskStorage({
destination: (_, __, callback) => {
- callback(null, `${(0, path_1.join)(__dirname, `../../uploads/images`)}`);
+ callback(null, `${(0, path_1.join)(__dirname, `../../../uploads/images`)}`);
},
filename: (_, file, callback) => {
const mimetype = file.mimetype;
diff --git a/backend/dist/middlewares/multer.cdn.js.map b/backend/dist/middlewares/multer.cdn.js.map
index 3e139ef6..3959c0a5 100644
--- a/backend/dist/middlewares/multer.cdn.js.map
+++ b/backend/dist/middlewares/multer.cdn.js.map
@@ -1 +1 @@
-{"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;IACnB,qCAAmB,CAAA;IACnB,uCAAqB,CAAA;IACrB,yCAAuB,CAAA;AACzB,CAAC,EAPI,gBAAgB,KAAhB,gBAAgB,QAOpB;AAED,MAAM,OAAO,GAAG,gBAAM,CAAC,WAAW,CAAC;IACjC,WAAW,EAAE,CAAC,CAAC,EAAE,EAAuB,EAAE,QAAkB,EAAE,EAAE;QAC9D,QAAQ,CAAC,IAAI,EAAE,GAAG,IAAA,WAAI,EAAC,SAAS,EAAE,sBAAsB,CAAC,EAAE,CAAC,CAAC;IAC/D,CAAC;IACD,QAAQ,EAAE,CAAC,CAAC,EAAE,IAAa,EAAE,QAAkB,EAAE,EAAE;QACjD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAoD,CAAC;QAC3E,MAAM,SAAS,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAC7C,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,GAAG,GAAG,GAAG,SAAS,CAAC;QACzD,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC3B,CAAC;CACF,CAAC,CAAC;AAEH,kBAAe,IAAA,gBAAM,EAAC;IACpB,OAAO,EAAE,OAAO;IAChB,MAAM,EAAE;QACN,QAAQ,EAAE,SAAS;KACpB;IACD,UAAU,EAAE,CAAC,CAAC,EAAE,IAAa,EAAE,EAAY,EAAE,EAAE;QAC7C,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAoD,CAAC;QAC3E,IAAI,gBAAgB,CAAC,QAAQ,CAAC;YAAE,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;;YAC1C,EAAE,CAAC,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC;IACvC,CAAC;CACF,CAAC,CAAC,MAAM,CAAC;IACR;QACE,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,CAAC;KACZ;CACF,CAAC,CAAC","sourcesContent":["import { join } from 'path';\nimport multer from 'multer';\nimport type { 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
+{"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;IACnB,qCAAmB,CAAA;IACnB,uCAAqB,CAAA;IACrB,yCAAuB,CAAA;AACzB,CAAC,EAPI,gBAAgB,KAAhB,gBAAgB,QAOpB;AAED,MAAM,OAAO,GAAG,gBAAM,CAAC,WAAW,CAAC;IACjC,WAAW,EAAE,CAAC,CAAC,EAAE,EAAuB,EAAE,QAAkB,EAAE,EAAE;QAC9D,QAAQ,CAAC,IAAI,EAAE,GAAG,IAAA,WAAI,EAAC,SAAS,EAAE,yBAAyB,CAAC,EAAE,CAAC,CAAC;IAClE,CAAC;IACD,QAAQ,EAAE,CAAC,CAAC,EAAE,IAAa,EAAE,QAAkB,EAAE,EAAE;QACjD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAoD,CAAC;QAC3E,MAAM,SAAS,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAC7C,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,GAAG,GAAG,GAAG,SAAS,CAAC;QACzD,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC3B,CAAC;CACF,CAAC,CAAC;AAEH,kBAAe,IAAA,gBAAM,EAAC;IACpB,OAAO,EAAE,OAAO;IAChB,MAAM,EAAE;QACN,QAAQ,EAAE,SAAS;KACpB;IACD,UAAU,EAAE,CAAC,CAAC,EAAE,IAAa,EAAE,EAAY,EAAE,EAAE;QAC7C,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAoD,CAAC;QAC3E,IAAI,gBAAgB,CAAC,QAAQ,CAAC;YAAE,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;;YAC1C,EAAE,CAAC,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC;IACvC,CAAC;CACF,CAAC,CAAC,MAAM,CAAC;IACR;QACE,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,CAAC;KACZ;CACF,CAAC,CAAC","sourcesContent":["import { join } from 'path';\nimport multer from 'multer';\nimport type { 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/middlewares/multer.cdn.ts b/backend/middlewares/multer.cdn.ts
index 5626e784..5c059060 100644
--- a/backend/middlewares/multer.cdn.ts
+++ b/backend/middlewares/multer.cdn.ts
@@ -15,7 +15,7 @@ enum MIME_TYPES_IMAGE {
const storage = multer.diskStorage({
destination: (_, __: Express.Multer.File, callback: Function) => {
- callback(null, `${join(__dirname, `../../uploads/images`)}`);
+ callback(null, `${join(__dirname, `../../../uploads/images`)}`);
},
filename: (_, file: IObject, callback: Function) => {
const mimetype = file.mimetype as unknown as keyof typeof MIME_TYPES_IMAGE;
diff --git a/backend/uploads/images/1698668990751 b/backend/uploads/images/1698668990751
deleted file mode 100644
index de491845..00000000
--- a/backend/uploads/images/1698668990751
+++ /dev/null
@@ -1 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M520-400h80v-120h120v-80H600v-120h-80v120H400v80h120v120ZM320-240q-33 0-56.5-23.5T240-320v-480q0-33 23.5-56.5T320-880h480q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H320Zm0-80h480v-480H320v480ZM160-80q-33 0-56.5-23.5T80-160v-560h80v560h560v80H160Zm160-720v480-480Z"/></svg>
\ No newline at end of file
diff --git a/backend/uploads/images/1698669023782.svg b/backend/uploads/images/1698669023782.svg
deleted file mode 100644
index de491845..00000000
--- a/backend/uploads/images/1698669023782.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M520-400h80v-120h120v-80H600v-120h-80v120H400v80h120v120ZM320-240q-33 0-56.5-23.5T240-320v-480q0-33 23.5-56.5T320-880h480q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H320Zm0-80h480v-480H320v480ZM160-80q-33 0-56.5-23.5T80-160v-560h80v560h560v80H160Zm160-720v480-480Z"/></svg>
\ No newline at end of file
diff --git a/backend/uploads/images/1698669083794.svg b/backend/uploads/images/1698669083794.svg
deleted file mode 100644
index de491845..00000000
--- a/backend/uploads/images/1698669083794.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M520-400h80v-120h120v-80H600v-120h-80v120H400v80h120v120ZM320-240q-33 0-56.5-23.5T240-320v-480q0-33 23.5-56.5T320-880h480q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H320Zm0-80h480v-480H320v480ZM160-80q-33 0-56.5-23.5T80-160v-560h80v560h560v80H160Zm160-720v480-480Z"/></svg>
\ No newline at end of file
diff --git a/backend/uploads/images/1698669123208.svg b/backend/uploads/images/1698669123208.svg
deleted file mode 100644
index de491845..00000000
--- a/backend/uploads/images/1698669123208.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M520-400h80v-120h120v-80H600v-120h-80v120H400v80h120v120ZM320-240q-33 0-56.5-23.5T240-320v-480q0-33 23.5-56.5T320-880h480q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H320Zm0-80h480v-480H320v480ZM160-80q-33 0-56.5-23.5T80-160v-560h80v560h560v80H160Zm160-720v480-480Z"/></svg>
\ No newline at end of file
diff --git a/backend/uploads/images/1698669625198.svg b/backend/uploads/images/1698669625198.svg
deleted file mode 100644
index de491845..00000000
--- a/backend/uploads/images/1698669625198.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M520-400h80v-120h120v-80H600v-120h-80v120H400v80h120v120ZM320-240q-33 0-56.5-23.5T240-320v-480q0-33 23.5-56.5T320-880h480q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H320Zm0-80h480v-480H320v480ZM160-80q-33 0-56.5-23.5T80-160v-560h80v560h560v80H160Zm160-720v480-480Z"/></svg>
\ No newline at end of file
diff --git a/backend/uploads/images/1698669627411.svg b/backend/uploads/images/1698669627411.svg
deleted file mode 100644
index de491845..00000000
--- a/backend/uploads/images/1698669627411.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M520-400h80v-120h120v-80H600v-120h-80v120H400v80h120v120ZM320-240q-33 0-56.5-23.5T240-320v-480q0-33 23.5-56.5T320-880h480q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H320Zm0-80h480v-480H320v480ZM160-80q-33 0-56.5-23.5T80-160v-560h80v560h560v80H160Zm160-720v480-480Z"/></svg>
\ No newline at end of file
diff --git a/backend/uploads/images/1698669720679.svg b/backend/uploads/images/1698669720679.svg
deleted file mode 100644
index de491845..00000000
--- a/backend/uploads/images/1698669720679.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M520-400h80v-120h120v-80H600v-120h-80v120H400v80h120v120ZM320-240q-33 0-56.5-23.5T240-320v-480q0-33 23.5-56.5T320-880h480q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H320Zm0-80h480v-480H320v480ZM160-80q-33 0-56.5-23.5T80-160v-560h80v560h560v80H160Zm160-720v480-480Z"/></svg>
\ No newline at end of file
diff --git a/backend/uploads/images/1698674343920.jpg b/backend/uploads/images/1698674343920.jpg
deleted file mode 100644
index 12dcaaec..00000000
Binary files a/backend/uploads/images/1698674343920.jpg and /dev/null differ
diff --git a/backend/uploads/images/1698675884994.jpg b/backend/uploads/images/1698675884994.jpg
deleted file mode 100644
index 5ecc78e0..00000000
Binary files a/backend/uploads/images/1698675884994.jpg and /dev/null differ
diff --git a/backend/uploads/images/1698675914652.jpg b/backend/uploads/images/1698675914652.jpg
deleted file mode 100644
index b8aa1ecc..00000000
Binary files a/backend/uploads/images/1698675914652.jpg and /dev/null differ
diff --git a/backend/uploads/images/1698675953407.jpg b/backend/uploads/images/1698675953407.jpg
deleted file mode 100644
index eda2acf1..00000000
Binary files a/backend/uploads/images/1698675953407.jpg and /dev/null differ
diff --git a/backend/uploads/images/1698676062531.png b/backend/uploads/images/1698676062531.png
deleted file mode 100644
index 702b2f7e..00000000
Binary files a/backend/uploads/images/1698676062531.png and /dev/null differ
diff --git a/backend/uploads/webp/1698669123208.svg.webp b/backend/uploads/webp/1698669123208.svg.webp
deleted file mode 100644
index 17cfbfc5..00000000
Binary files a/backend/uploads/webp/1698669123208.svg.webp and /dev/null differ
diff --git a/backend/uploads/webp/1698669625198.webp b/backend/uploads/webp/1698669625198.webp
deleted file mode 100644
index 17cfbfc5..00000000
Binary files a/backend/uploads/webp/1698669625198.webp and /dev/null differ
diff --git a/backend/uploads/webp/1698669627411.webp b/backend/uploads/webp/1698669627411.webp
deleted file mode 100644
index 17cfbfc5..00000000
Binary files a/backend/uploads/webp/1698669627411.webp and /dev/null differ
diff --git a/backend/uploads/webp/1698669720679.webp b/backend/uploads/webp/1698669720679.webp
deleted file mode 100644
index 17cfbfc5..00000000
Binary files a/backend/uploads/webp/1698669720679.webp and /dev/null differ
diff --git a/backend/uploads/webp/1698674343920.webp b/backend/uploads/webp/1698674343920.webp
deleted file mode 100644
index e963e90e..00000000
Binary files a/backend/uploads/webp/1698674343920.webp and /dev/null differ
diff --git a/backend/uploads/webp/1698675884994.webp b/backend/uploads/webp/1698675884994.webp
deleted file mode 100644
index 5cc9c429..00000000
Binary files a/backend/uploads/webp/1698675884994.webp and /dev/null differ
diff --git a/backend/uploads/webp/1698675914652.webp b/backend/uploads/webp/1698675914652.webp
deleted file mode 100644
index 1bcd5b30..00000000
Binary files a/backend/uploads/webp/1698675914652.webp and /dev/null differ
diff --git a/backend/uploads/webp/1698675953407.webp b/backend/uploads/webp/1698675953407.webp
deleted file mode 100644
index 4fa51a5d..00000000
Binary files a/backend/uploads/webp/1698675953407.webp and /dev/null differ
diff --git a/backend/uploads/webp/1698676062531.webp b/backend/uploads/webp/1698676062531.webp
deleted file mode 100644
index afd9d3f0..00000000
Binary files a/backend/uploads/webp/1698676062531.webp and /dev/null differ
diff --git a/dashboard/app.vue b/dashboard/app.vue
index 43900a1f..a8d843f3 100644
--- a/dashboard/app.vue
+++ b/dashboard/app.vue
@@ -10,7 +10,7 @@ import Navbar from './components/navbar/Navbar.vue';
import Notification from "../components/Notification/Notification.vue";
// @ts-ignore
-useDocumentsStore().fetch({ fields: ['id', 'name', 'description', 'category', 'created_timestamp'] });
+useDocumentsStore().fetch({ fields: ['id', 'name', 'description', 'accessibility', 'category', 'created_timestamp'] });
useCategoriesStore().fetch();
</script>
\ No newline at end of file
diff --git a/dashboard/components/MarkdownEditor/Toolbar.vue b/dashboard/components/MarkdownEditor/Toolbar.vue
index f62c95da..bc0d3f32 100644
--- a/dashboard/components/MarkdownEditor/Toolbar.vue
+++ b/dashboard/components/MarkdownEditor/Toolbar.vue
@@ -10,6 +10,7 @@
<option value="1">Visible</option>
<option value="2">Draf</option>
<option value="3">Archive</option>
+ <option value="4">Trash</option>
</select>
<select v-model="copy.category">
<optgroup v-for="cat in categoriesStore.getParents" :label="cat.name" :key="cat.id">
diff --git a/dashboard/components/documents-list/List.vue b/dashboard/components/documents-list/List.vue
index 2b04110b..fe55ba71 100644
--- a/dashboard/components/documents-list/List.vue
+++ b/dashboard/components/documents-list/List.vue
@@ -31,8 +31,15 @@ const isActive = (id: string) => route.query.doc === id;
const querySearch = ref('');
const docs = computed(() => {
const normal = (() => {
- if (!route.query.category) return useDocumentsStore().getAll;
- return useDocumentsStore().getAll.filter((doc) => doc.category === route.query.category);
+ return useDocumentsStore().getAll
+ .filter((doc) => {
+ if (!route.query.category) return true;
+ if (route.query.category === 'uncategorized') return doc.category === '';
+ if (route.query.category === 'draft') return doc.accessibility === 2
+ if (route.query.category === 'archive') return doc.accessibility === 3
+ if (route.query.category === 'trash') return doc.accessibility === 4
+ return doc.category === route.query.category;
+ });
})();
return normal.filter((doc) => doc.name.toLowerCase().includes(querySearch.value.toLowerCase()));
});
diff --git a/dashboard/components/documents-list/Search.vue b/dashboard/components/documents-list/Search.vue
index 0c3d68d9..fd590c98 100644
--- a/dashboard/components/documents-list/Search.vue
+++ b/dashboard/components/documents-list/Search.vue
@@ -13,14 +13,10 @@ input {
border-radius: 8px;
font-size: 0.9rem;
line-height: 2rem;
- padding: 0.5rem;
+ padding: 0.5rem 0.5rem 0.5rem 2rem;
transition: all ease 0.3s;
background: var(--bg-color) url('search.svg') 0.6rem 0.5rem no-repeat;
background-size: 1rem;
-
- &::placeholder {
- padding-left: 20px;
- }
}
input:focus {
diff --git a/dashboard/components/sidebar/Sidebar.vue b/dashboard/components/sidebar/Sidebar.vue
index d4c941ce..48b3b874 100644
--- a/dashboard/components/sidebar/Sidebar.vue
+++ b/dashboard/components/sidebar/Sidebar.vue
@@ -15,7 +15,7 @@
<Collapse v-for="(item) in items">
<template v-slot:header>
<NuxtLink class="item" @click="isMobile() ? isOpened = false : null">
- <i v-if="item.icon" v-html="item.icon" class="icon"></i> <span>{{ item.title }}</span>
+ <i v-if="item.icon" v-html="item.icon" class="icon"></i> <strong>{{ item.title }}</strong>
</NuxtLink>
</template>
<template v-slot:body>
diff --git a/dashboard/components/sidebar/helpers.ts b/dashboard/components/sidebar/helpers.ts
index 0afbe8cd..46c3ff13 100644
--- a/dashboard/components/sidebar/helpers.ts
+++ b/dashboard/components/sidebar/helpers.ts
@@ -14,10 +14,17 @@ export interface Item {
export const defaultItems: Item[] = [
{
id: '#0',
- title: 'All notes',
- icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h240l80 80h320q33 0 56.5 23.5T880-640H447l-80-80H160v480l96-320h684L837-217q-8 26-29.5 41.5T760-160H160Zm84-80h516l72-240H316l-72 240Zm0 0 72-240-72 240Zm-84-400v-80 80Z"/></svg>',
+ title: 'Navigation',
+ icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M320-160q-117 0-198.5-81.5T40-440q0-107 70.5-186.5T287-718l-63-66 56-56 160 160-160 160-56-57 59-59q-71 14-117 69t-46 127q0 83 58.5 141.5T320-240h120v80H320Zm200-360v-280h360v280H520Zm0 360v-280h360v280H520Zm80-80h200v-120H600v120Z"/></svg>',
route: '/',
childrens: [
+ {
+ id: '',
+ title: 'All notes',
+ icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M160-160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h240l80 80h320q33 0 56.5 23.5T880-640H447l-80-80H160v480l96-320h684L837-217q-8 26-29.5 41.5T760-160H160Zm84-80h516l72-240H316l-72 240Zm0 0 72-240-72 240Zm-84-400v-80 80Z"/></svg>',
+ route: '/dashboard/?category&filter',
+ childrens: [],
+ },
{
id: 'uncategorized',
title: 'Uncategorized',
@@ -36,7 +43,7 @@ export const defaultItems: Item[] = [
id: 'drafts',
title: 'Drafts',
icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M240-80q-33 0-56.5-23.5T160-160v-640q0-33 23.5-56.5T240-880h320l240 240v480q0 33-23.5 56.5T720-80H240Zm280-520v-200H240v640h480v-440H520ZM240-800v200-200 640-640Z"/></svg>',
- route: '/dashboard/?category=drafts',
+ route: '/dashboard/?category=draft',
childrens: [],
},
{
@@ -52,7 +59,7 @@ export const defaultItems: Item[] = [
id: '#2',
title: 'Settings',
icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="m370-80-16-128q-13-5-24.5-12T307-235l-119 50L78-375l103-78q-1-7-1-13.5v-27q0-6.5 1-13.5L78-585l110-190 119 50q11-8 23-15t24-12l16-128h220l16 128q13 5 24.5 12t22.5 15l119-50 110 190-103 78q1 7 1 13.5v27q0 6.5-2 13.5l103 78-110 190-118-50q-11 8-23 15t-24 12L590-80H370Zm70-80h79l14-106q31-8 57.5-23.5T639-327l99 41 39-68-86-65q5-14 7-29.5t2-31.5q0-16-2-31.5t-7-29.5l86-65-39-68-99 42q-22-23-48.5-38.5T533-694l-13-106h-79l-14 106q-31 8-57.5 23.5T321-633l-99-41-39 68 86 64q-5 15-7 30t-2 32q0 16 2 31t7 30l-86 65 39 68 99-42q22 23 48.5 38.5T427-266l13 106Zm42-180q58 0 99-41t41-99q0-58-41-99t-99-41q-59 0-99.5 41T342-480q0 58 40.5 99t99.5 41Zm-2-140Z"/></svg>',
- route: '/dashboard/settings',
+ route: '/dashboard/scategory&ettings',
childrens: [
{
id: 'manage-categories',
diff --git a/dashboard/components/sidebar/sidebar.scss b/dashboard/components/sidebar/sidebar.scss
index 0bedcaa1..5abdf980 100644
--- a/dashboard/components/sidebar/sidebar.scss
+++ b/dashboard/components/sidebar/sidebar.scss
@@ -67,7 +67,7 @@ $bg: #1e2430;
.body {
display: flex;
flex-direction: column;
- margin: 6px 5px;
+ margin: 30px 5px;
.item {
display: flex;
diff --git a/dashboard/store/documents.store.ts b/dashboard/store/documents.store.ts
index 760cf131..dadf8143 100644
--- a/dashboard/store/documents.store.ts
+++ b/dashboard/store/documents.store.ts
@@ -27,14 +27,12 @@ export const useDocumentsStore = defineStore('documents', {
},
},
actions: {
- fetch: async function <T extends FetchOptions<Array<keyof Document>>>(
- opts?: T,
- ): Promise<'id' extends keyof T ? Document : Document[]> {
+ fetch: async function <T extends FetchOptions<Array<keyof Document>>>(opts?: T): Promise<'id' extends keyof T ? Document : Document[]> {
console.log(`[store/documents] Fetching documents with options: ${JSON.stringify(opts)}`);
return new Promise(async (resolve, reject) => {
const request = await makeRequest(
- `documents/${opts?.id || ''}${opts?.fields?.length ? '?fields=' + opts?.fields?.join(',') : ''}`,
+ `documents/${opts?.id || ''}${opts?.fields?.length ? '?all=true&fields=' + opts?.fields?.join(',') : ''}`,
'GET',
{},
);
diff --git a/backend/uploads/images/default b/uploads/images/default
similarity index 100%
rename from backend/uploads/images/default
rename to uploads/images/default
diff --git a/uploads/index.md b/uploads/index.md
new file mode 100644
index 00000000..75ab7771
--- /dev/null
+++ b/uploads/index.md
@@ -0,0 +1 @@
+In this folder there are uploads of backend.
diff --git a/backend/uploads/webp/default b/uploads/webp/default
similarity index 100%
rename from backend/uploads/webp/default
rename to uploads/webp/default