Documentation Update

This commit is contained in:
Esad Mustafoski
2024-11-05 02:22:11 +01:00
parent 3d31061087
commit abe39c0797
4 changed files with 21 additions and 16 deletions

1
.gitignore vendored
View File

@@ -12,6 +12,7 @@ dist
dist-ssr dist-ssr
.vite .vite
*.local *.local
*.sqlite
# Editor directories and files # Editor directories and files
.vscode/* .vscode/*

View File

@@ -1,13 +1,8 @@
// Responsible: Esad Mustafoski
/// <reference lib="deno.ns" /> /// <reference lib="deno.ns" />
// main API file. Handles all the routing/api stuff /**
* @author Esad Mustafoski
// Due to the Language servers, the import statements are * @description Main API file, Handles all the routing/api stuff
// 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
// +++ IMPORTS ------------------------------------------------------ // // +++ IMPORTS ------------------------------------------------------ //
import { Application, Router } from "https://deno.land/x/oak/mod.ts"; 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.routes());
app.use(router.allowedMethods()); app.use(router.allowedMethods());
// @ts-ignore: start app
export { app }; export { app };
await app.listen({ port: 8000 }); await app.listen({ port: 8000 });

5
database/create_db.ts Normal file
View File

@@ -0,0 +1,5 @@
/// <reference lib="deno.ns" />
/**
* @author Esad Mustafoski
* @description This file is responsible for creating the database and the tables
*/

View File

@@ -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
*/
/// <reference lib="deno.ns" /> /// <reference lib="deno.ns" />
@@ -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 // __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 // from SQLite doesn't like relative paths, so I use this as
// A Workaround // A Workaround
// +++ VARIABLES ---------------------------------------------------- //
const _dirname: string = dirname(fromFileUrl(import.meta.url)); const _dirname: string = dirname(fromFileUrl(import.meta.url));
const dbPath: string = join(_dirname, "../database/esp-projekt.sqlite"); const dbPath: string = join(_dirname, "../database/esp-projekt.sqlite");
console.log(dbPath);
console.log(_dirname)
const db = new DB(dbPath); 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 { interface Post {
posts_uuid: number; posts_uuid: number;
user_id: number; user_id: number;
@@ -42,8 +45,10 @@ interface Accounts {
contacts: string; contacts: string;
} }
// +++ FUNCTIONS---------------------------------------------------- //
/** /**
* @returns * @returns Array of all Posts in the Database
*/ */
async function getPostsFromDB() { async function getPostsFromDB() {
const data_result: Array<Post> = []; const data_result: Array<Post> = [];