Skip to content

Commit

Permalink
feat: add modules folder
Browse files Browse the repository at this point in the history
  • Loading branch information
saisilinus committed Apr 6, 2022
1 parent 1a6ec87 commit 09f0b1a
Show file tree
Hide file tree
Showing 42 changed files with 33 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Expand Up @@ -24,7 +24,7 @@
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"project": ["./tsconfig.json", "./src/tsconfig.json"]
"project": ["./tsconfig.json"]
},
"rules": {
"no-console": "error",
Expand Down
6 changes: 3 additions & 3 deletions src/app.ts
Expand Up @@ -10,9 +10,9 @@ import httpStatus from 'http-status';
import config from './config/config';
import morgan from './config/morgan';
import jwtStrategy from './config/passport';
import authLimiter from './utils/rateLimiter';
import ApiError from './components/errors/ApiError';
import { errorConverter, errorHandler } from './components/errors/error';
import authLimiter from './modules/utils/rateLimiter';
import ApiError from './modules/errors/ApiError';
import { errorConverter, errorHandler } from './modules/errors/error';
import routes from './routes/v1';

const app: Express = express();
Expand Down
6 changes: 3 additions & 3 deletions src/config/passport.ts
@@ -1,8 +1,8 @@
import { ExtractJwt, Strategy as JwtStrategy } from 'passport-jwt';
import tokenTypes from '../components/token/token.types';
import tokenTypes from '../modules/token/token.types';
import config from './config';
import User from '../components/user/user.model';
import { IPayload } from '../components/token/token.interfaces';
import User from '../modules/user/user.model';
import { IPayload } from '../modules/token/token.interfaces';

const jwtStrategy = new JwtStrategy(
{
Expand Down
2 changes: 1 addition & 1 deletion src/custom.d.ts
@@ -1,4 +1,4 @@
import { IUserDoc } from './components/user/user.interfaces';
import { IUserDoc } from './modules/user/user.interfaces';

declare module 'express-serve-static-core' {
export interface Request {
Expand Down
@@ -1,8 +1,12 @@
import httpStatus from 'http-status';
import { Request, Response } from 'express';
import catchAsync from '../../utils/catchAsync';
import catchAsync from '../utils/catchAsync';
import { registerUser } from '../user/user.service';
import { generateAuthTokens, generateResetPasswordToken, generateVerifyEmailToken } from '../token/token.service';
import {
generateAuthTokens,
generateResetPasswordToken,
generateVerifyEmailToken,
} from '../token/token.service';
import { loginUserWithEmailAndPassword, logout, refreshAuth, resetPassword, verifyEmail } from './auth.service';
import { sendResetPasswordEmail, sendVerificationEmail } from '../email/email.service';
import config from '../../config/config';
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,9 +1,9 @@
import httpStatus from 'http-status';
import { Request, Response } from 'express';
import mongoose from 'mongoose';
import catchAsync from '../../utils/catchAsync';
import catchAsync from '../utils/catchAsync';
import ApiError from '../errors/ApiError';
import pick from '../../utils/pick';
import pick from '../utils/pick';
import { createUser, queryUsers, getUserById, updateUserById, deleteUserById } from './user.service';
import { IOptions } from '../paginate/paginate.plugin';

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,7 +1,7 @@
import { Request, Response, NextFunction } from 'express';
import Joi from 'joi';
import httpStatus from 'http-status';
import pick from '../../utils/pick';
import pick from '../utils/pick';
import ApiError from '../errors/ApiError';

const validate =
Expand Down
8 changes: 4 additions & 4 deletions src/routes/v1/auth.route.ts
@@ -1,6 +1,6 @@
import express, { Router } from 'express';
import validate from '../../components/validate/validate.middleware';
import auth from '../../components/auth/auth.middleware';
import validate from '@/modules/validate/validate.middleware';
import auth from '@/modules/auth/auth.middleware';
import {
forgotPasswordValidator,
loginValidator,
Expand All @@ -9,7 +9,7 @@ import {
registerValidator,
resetPasswordValidator,
verifyEmailValidator,
} from '../../components/auth/auth.validation';
} from '../../modules/auth/auth.validation';
import {
forgotPasswordController,
loginController,
Expand All @@ -19,7 +19,7 @@ import {
resetPasswordController,
sendVerificationEmailController,
verifyEmailController,
} from '../../components/auth/auth.controller';
} from '../../modules/auth/auth.controller';

const router: Router = express.Router();

Expand Down
2 changes: 1 addition & 1 deletion src/routes/v1/swagger.route.ts
@@ -1,7 +1,7 @@
import express from 'express';
import swaggerJsdoc from 'swagger-jsdoc';
import swaggerUi from 'swagger-ui-express';
import swaggerDefinition from '../../components/swagger/swagger.definition';
import swaggerDefinition from '../../modules/swagger/swagger.definition';

const router = express.Router();

Expand Down
8 changes: 4 additions & 4 deletions src/routes/v1/user.route.ts
@@ -1,20 +1,20 @@
import express, { Router } from 'express';
import validate from '../../components/validate/validate.middleware';
import auth from '../../components/auth/auth.middleware';
import validate from '../../modules/validate/validate.middleware';
import auth from '../../modules/auth/auth.middleware';
import {
createUserValidator,
deleteUserValidator,
getUsersValidator,
getUserValidator,
updateUserValidator,
} from '../../components/user/user.validation';
} from '../../modules/user/user.validation';
import {
createUserController,
deleteUserController,
getUserController,
getUsersController,
updateUserController,
} from '../../components/user/user.controller';
} from '../../modules/user/user.controller';

const router: Router = express.Router();

Expand Down
10 changes: 7 additions & 3 deletions tsconfig.json
Expand Up @@ -26,9 +26,13 @@
/* Modules */
"module": "commonjs", /* Specify what module code is generated. */
"rootDir": ".", /* Specify the root folder within your source files. */
// "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
"baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
"paths": {
"@/modules/*": [
"src/modules/*"
],
}, /* Specify a set of entries that re-map imports to additional lookup locations. */
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
// "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
Expand Down

0 comments on commit 09f0b1a

Please sign in to comment.