From abe39c0797a7de34c143f85184605fd5b886199c Mon Sep 17 00:00:00 2001 From: Esad Mustafoski Date: Tue, 5 Nov 2024 02:22:11 +0100 Subject: [PATCH] Documentation Update --- .gitignore | 1 + api/main.ts | 14 ++++---------- database/create_db.ts | 5 +++++ database/utils.ts | 17 +++++++++++------ 4 files changed, 21 insertions(+), 16 deletions(-) create mode 100644 database/create_db.ts diff --git a/.gitignore b/.gitignore index 289e710..ce13133 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ dist dist-ssr .vite *.local +*.sqlite # Editor directories and files .vscode/* diff --git a/api/main.ts b/api/main.ts index 2fb564d..358b207 100644 --- a/api/main.ts +++ b/api/main.ts @@ -1,13 +1,8 @@ -// Responsible: Esad Mustafoski - /// -// main API file. Handles all the routing/api stuff - -// Due to the Language servers, the import statements are -// shown as errors, @ts-ignore is used to ignore them. -// This is a Deno file, but the Vue LSP is still -// attempting to find errors, which causes -// confusing False error +/** + * @author Esad Mustafoski + * @description Main API file, Handles all the routing/api stuff + */ // +++ IMPORTS ------------------------------------------------------ // import { Application, Router } from "https://deno.land/x/oak/mod.ts"; @@ -46,6 +41,5 @@ app.use(oakCors()); app.use(router.routes()); app.use(router.allowedMethods()); -// @ts-ignore: start app export { app }; await app.listen({ port: 8000 }); \ No newline at end of file diff --git a/database/create_db.ts b/database/create_db.ts new file mode 100644 index 0000000..cfc468b --- /dev/null +++ b/database/create_db.ts @@ -0,0 +1,5 @@ +/// +/** + * @author Esad Mustafoski + * @description This file is responsible for creating the database and the tables + */ \ No newline at end of file diff --git a/database/utils.ts b/database/utils.ts index 1d98c6c..ce3ae15 100644 --- a/database/utils.ts +++ b/database/utils.ts @@ -1,4 +1,7 @@ -// Responsible: Esad Mustafoski +/** + * @author Esad Mustafoski + * @description This file is responsible for creating Functions to easily access the Database, Intended for use in the API + */ /// @@ -8,14 +11,14 @@ import { dirname, fromFileUrl, join } from "https://deno.land/std/path/mod.ts"; // __dirname Is never getting used again, It's only needed because the DB Import // from SQLite doesn't like relative paths, so I use this as // A Workaround + +// +++ VARIABLES ---------------------------------------------------- // const _dirname: string = dirname(fromFileUrl(import.meta.url)); const dbPath: string = join(_dirname, "../database/esp-projekt.sqlite"); -console.log(dbPath); -console.log(_dirname) const db = new DB(dbPath); -console.log(db) -// Interfaces used for the Lists so no data can be assigned wrongly +// +++ INTERFACES --------------------------------------------------- // +// Used in the Functions to define the return type/Avoid type errors interface Post { posts_uuid: number; user_id: number; @@ -42,8 +45,10 @@ interface Accounts { contacts: string; } +// +++ FUNCTIONS---------------------------------------------------- // + /** - * @returns + * @returns Array of all Posts in the Database */ async function getPostsFromDB() { const data_result: Array = [];