Skip to content

Commit

Permalink
fix: no more ../../../../
Browse files Browse the repository at this point in the history
  • Loading branch information
TheClashFruit committed Aug 2, 2024
1 parent 409df9e commit 3838561
Show file tree
Hide file tree
Showing 15 changed files with 93 additions and 58 deletions.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
"description": "Our back-end that powers the Zleed API.",
"main": "build/index.js",
"scripts": {
"start": "node -r dotenv/config .",
"start": "node -r dotenv/config -r tsconfig-paths/register .",
"build": "tsc",
"dev": "nodemon -r dotenv/config src/index.ts",
"dev": "nodemon -r dotenv/config -r tsconfig-paths/register src/index.ts",
"lint": "eslint",
"fix": "eslint --fix",
"swagger": "ts-node -r dotenv/config src/swagger/generate.ts",
"swagger": "ts-node -r dotenv/config -r tsconfig-paths/register src/swagger/generate.ts",
"prepare": "husky"
},
"keywords": [],
Expand All @@ -33,6 +33,7 @@
"lint-staged": "^15.2.7",
"nodemon": "^3.1.4",
"prettier": "3.3.3",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.5.3",
"typescript-eslint": "^7.16.1"
},
Expand Down
35 changes: 35 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 6 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@ import cors from 'cors';
import mongoose from 'mongoose';
import bodyParser from 'body-parser';

import Logger from './util/logger';
import pathParser from './util/path_parser';
import version from './util/version';
import Logger from '@/util/logger';
import pathParser from '@/util/path_parser';
import version from '@/util/version';

import { Request, Response } from './util/handler';
import { Request, Response } from '@/util/handler';

import fs from 'fs';
import path from 'path';
import getRoutes from './util/get_routes';
import rateLimiter from './util/ratelimit';
import getRoutes from '@/util/get_routes';
import rateLimiter from '@/util/ratelimit';

const app = express();

Expand Down
12 changes: 6 additions & 6 deletions src/routes/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import Method from '../enum/method';
import Status from '../enum/status';
import Method from '@/enum/method';
import Status from '@/enum/status';

import {
OpenApiBuilder,
OpenApiMethod,
OpenApiResponse
} from '../util/openapi_builder';
} from '@/util/openapi_builder';

import { IndexRespone, Version } from '../interfaces';
import { Request, Response } from '../util/handler';
import { IndexRespone, Version } from '@/interfaces';
import { Request, Response } from '@/util/handler';

import type { OpenApi } from '../util/openapi_builder';
import type { OpenApi } from '@/util/openapi_builder';

export const openapi = (): OpenApi => {
return new OpenApiBuilder()
Expand Down
8 changes: 4 additions & 4 deletions src/routes/messages/[lang].json.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Method from '../../enum/method';
import Status from '../../enum/status';
import Method from '@/enum/method';
import Status from '@/enum/status';

import { Request, Response } from '../../util/handler';
import { Request, Response } from '@/util/handler';

import { Langauge } from '../../interfaces';
import { Langauge } from '@/interfaces';

import fs from 'fs';
import path from 'path';
Expand Down
6 changes: 3 additions & 3 deletions src/routes/swagger.json.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Method from '../enum/method';
import Status from '../enum/status';
import Method from '@/enum/method';
import Status from '@/enum/status';

import { Request, Response } from '../util/handler';
import { Request, Response } from '@/util/handler';

import fs from 'fs';
import path from 'path';
Expand Down
16 changes: 8 additions & 8 deletions src/routes/v1/auth/login.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import Status from '../../../enum/status';
import Method from '../../../enum/method';
import Status from '@/enum/status';
import Method from '@/enum/method';

import snowflake from '../../../util/snowflake';
import snowflake from '@/util/snowflake';

import Logger from '../../../util/logger';
import Logger from '@/util/logger';

import { Request, Response } from '../../../util/handler';
import { UserRespose } from '../../../interfaces/user';
import { isValidEmail } from '../../../util/validators';
import { User } from '../../../models';
import { Request, Response } from '@/util/handler';
import { UserRespose } from '@/interfaces/user';
import { isValidEmail } from '@/util/validators';
import { User } from '@/models';

import { sign } from 'jsonwebtoken';

Expand Down
16 changes: 8 additions & 8 deletions src/routes/v1/auth/register.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import Status from '../../../enum/status';
import Method from '../../../enum/method';
import Status from '@/enum/status';
import Method from '@/enum/method';

import snowflake from '../../../util/snowflake';
import snowflake from '@/util/snowflake';

import Logger from '../../../util/logger';
import Logger from '@/util/logger';

import { Request, Response } from '../../../util/handler';
import { UserRespose } from '../../../interfaces/user';
import { isValidEmail } from '../../../util/validators';
import { User } from '../../../models';
import { Request, Response } from '@/util/handler';
import { UserRespose } from '@/interfaces/user';
import { isValidEmail } from '@/util/validators';
import { User } from '@/models';

import { sign } from 'jsonwebtoken';

Expand Down
10 changes: 5 additions & 5 deletions src/routes/v1/changelog.txt.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import Method from '../../enum/method';
import Status from '../../enum/status';
import Method from '@/enum/method';
import Status from '@/enum/status';

import {
OpenApiBuilder,
OpenApiMethod,
OpenApiResponse
} from '../../util/openapi_builder';
} from '@/util/openapi_builder';

import { Request, Response } from '../../util/handler';
import { Request, Response } from '@/util/handler';

import fs from 'fs';
import path from 'path';

import type { OpenApi } from '../../util/openapi_builder';
import type { OpenApi } from '@/util/openapi_builder';

export const openapi = (): OpenApi => {
return new OpenApiBuilder()
Expand Down
14 changes: 7 additions & 7 deletions src/routes/v1/user/@me.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import Method from '../../../enum/method';
import Status from '../../../enum/status';
import Method from '@/enum/method';
import Status from '@/enum/status';

import { Request, Response } from '../../../util/handler';
import { User } from '../../../interfaces/user';
import { Request, Response } from '@/util/handler';
import { User } from '@/interfaces/user';

import { verify } from 'jsonwebtoken';

import {
OpenApiBuilder,
OpenApiMethod,
OpenApiResponse
} from '../../../util/openapi_builder';
} from '@/util/openapi_builder';

import Database from '../../../util/database';
import Database from '@/util/database';

import type { OpenApi } from '../../../util/openapi_builder';
import type { OpenApi } from '@/util/openapi_builder';

interface ZleedJWT {
id: bigint;
Expand Down
2 changes: 1 addition & 1 deletion src/util/database.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { User } from '../models';
import { User } from '@/models';

class Database {
static async getUser(
Expand Down
4 changes: 2 additions & 2 deletions src/util/handler.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Status from '../enum/status';
import Method from '../enum/method';
import Status from '@/enum/status';
import Method from '@/enum/method';

export class Request {
public method: Method;
Expand Down
4 changes: 2 additions & 2 deletions src/util/openapi_builder.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Status from '../enum/status';
import Method from '../enum/method';
import Status from '@/enum/status';
import Method from '@/enum/method';

interface OpenApi {
paths: PathSpec;
Expand Down
2 changes: 1 addition & 1 deletion src/util/ratelimit.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sqlite3 from 'sqlite3';

import Status from '../enum/status';
import Status from '@/enum/status';

import type { Request, Response, NextFunction } from 'express';

Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es2016",
"target": "es2020",
"module": "commonjs",
"outDir": "./build",
"esModuleInterop": true,
Expand Down

0 comments on commit 3838561

Please sign in to comment.