This commit is contained in:
bade 2024-03-14 18:06:58 +01:00
parent 341889b6f7
commit 26b23a3ecc
7 changed files with 1372 additions and 1262 deletions

View File

@ -1,7 +1,7 @@
NODE_ENV="development" NODE_ENV="development"
MONGO_URL="" MONGO_URL="mongodb://localhost:27017/BudgetBuddy"
PORT="2011" PORT="2011"
TZ="Europe/Paris" TZ="Europe/Paris"

View File

@ -13,7 +13,7 @@
"format": "prettier --write '**/*.{js,jsx,ts}'", "format": "prettier --write '**/*.{js,jsx,ts}'",
"lint": "eslint . && yarn check-types", "lint": "eslint . && yarn check-types",
"setup": "yarn install", "setup": "yarn install",
"start:development": "nodemon", "start": "nodemon",
"start:production": "node dist/index.js", "start:production": "node dist/index.js",
"test": "cross-env NODE_ENV=test jest", "test": "cross-env NODE_ENV=test jest",
"test:cov": "cross-env NODE_ENV=test jest --coverage" "test:cov": "cross-env NODE_ENV=test jest --coverage"

View File

@ -15,6 +15,7 @@ import { Express } from '@types'
import cookieParser from 'cookie-parser' import cookieParser from 'cookie-parser'
import cors from 'cors' import cors from 'cors'
import dotenv from 'dotenv' import dotenv from 'dotenv'
import * as process from "process";
dotenv.config() dotenv.config()

View File

@ -106,7 +106,7 @@ export const createUser = async (
} catch (error) { } catch (error) {
return { return {
status: HttpStatus.INTERNAL_SERVER_ERROR, status: HttpStatus.INTERNAL_SERVER_ERROR,
error: 'Internal server error', error: `Internal server error`,
} }
} }
@ -229,7 +229,7 @@ export const updateUser = async (
} catch (error) { } catch (error) {
return { return {
status: HttpStatus.INTERNAL_SERVER_ERROR, status: HttpStatus.INTERNAL_SERVER_ERROR,
error: 'Internal server error', error: 'Internal server error testing',
} }
} }

View File

@ -1,7 +1,7 @@
import mongoose from 'mongoose' import mongoose from 'mongoose'
import { MONGO_URL } from "../../../env";
export const databaseConnection = async () => { export const databaseConnection = async () => {
const mongoUrl: string = decodeURIComponent(process.env.MONGO_URL || '') const mongoUrl: string = decodeURIComponent(process.env.MONGO_URL || MONGO_URL || '')
if (mongoUrl === '') { if (mongoUrl === '') {
throw new Error('MONGO_URL has not been set') throw new Error('MONGO_URL has not been set')

View File

@ -8,7 +8,6 @@ const router = express.Router()
router.get('/', authenticated, async (req: AuthenticatedRequest, res: Response) => { router.get('/', authenticated, async (req: AuthenticatedRequest, res: Response) => {
const response = await getUsers(<IGetUserInput>req.query, <IUser>req.user) const response = await getUsers(<IGetUserInput>req.query, <IUser>req.user)
return res.status(response.status).send(response.data || response.error) return res.status(response.status).send(response.data || response.error)
}) })

2620
yarn.lock

File diff suppressed because it is too large Load Diff