Skip to content

Commit

Permalink
Fix build and branch name
Browse files Browse the repository at this point in the history
  • Loading branch information
cham11ng committed Mar 28, 2024
1 parent 3b2f2ba commit 532ea36
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 2,014 deletions.
1 change: 0 additions & 1 deletion .dockerignore

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ name: Starter CI

on:
push:
branches: [dev, master]
branches: [dev, main]
pull_request:
branches: [dev, master]
branches: [dev, main]

jobs:
build:
strategy:
matrix:
node-version: [16.x]
node-version: [20.x]
platform: [ubuntu-latest]

runs-on: ${{ matrix.platform }}
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services:
POSTGRES_PASSWORD: ${DB_PASSWORD:-secret}

api:
image: "node:16-alpine"
image: "node:latest"
env_file: '.env.docker'
container_name: "starter-api"
volumes:
Expand All @@ -24,4 +24,4 @@ services:
- postgres
ports:
- "8000:8000"
command: sh -c "yarn && yarn dev"
command: bash -c "yarn && yarn dev"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"email": "sgr.raee@gmail.com"
},
"engines": {
"node": ">= 16.5.0"
"node": ">= 20.9.0"
},
"scripts": {
"dev": "concurrently 'npx tsc --watch' 'nodemon -q build/index.js'",
Expand Down
2 changes: 1 addition & 1 deletion src/database/factories/userFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import * as userService from '../../services/userService';
export function run(): Promise<UserDetail> {
return userService.insert({
password: 'secret',
name: faker.name.findName(),
name: faker.person.fullName(),
email: faker.internet.email()
});
}
6 changes: 4 additions & 2 deletions src/middlewares/genericErrorHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getReasonPhrase, StatusCodes } from 'http-status-codes';
import APIResponseInterface from '../domain/responses/APIResponse';
import logger from '../utils/logger';

export const buildError = (err: any): APIResponseInterface => {
export const buildError = (err: any): APIResponseInterface<{ code: number; message: string; data?: any }> => {
if (err.isJoi) {
return {
code: StatusCodes.BAD_REQUEST,
Expand Down Expand Up @@ -38,7 +38,7 @@ export const buildError = (err: any): APIResponseInterface => {
};
};

export const genericErrorHandler = (
const genericErrorHandler = (
err: any,
_: Request,
res: Response,
Expand All @@ -52,3 +52,5 @@ export const genericErrorHandler = (

res.status(error.code).json(error);
};

export default genericErrorHandler;
4 changes: 3 additions & 1 deletion src/middlewares/nodeErrorHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import logger from '../utils/logger';

const { errors } = config;

export const nodeErrorHandler = (err: NodeJS.ErrnoException): void => {
const nodeErrorHandler = (err: NodeJS.ErrnoException): void => {
switch (err.code) {
case 'EACCES':
logger.log('error', errors.portRequirePrivilege);
Expand All @@ -19,3 +19,5 @@ export const nodeErrorHandler = (err: NodeJS.ErrnoException): void => {

process.exit(1);
};

export default nodeErrorHandler;
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import * as userController from './controllers/user';
import authenticate from './middlewares/authenticate';
import validate from './middlewares/validate';
import validateRefreshToken from './middlewares/validateRefreshToken';
import { loginSchema } from './validators/loginRequest';
import { userPOSTSchema } from './validators/userRequest';
import { loginSchema } from './resources/validators/loginRequest';
import { userPOSTSchema } from './resources/validators/userRequest';

const router: Router = Router();

Expand Down
4 changes: 0 additions & 4 deletions src/types/json.d.ts

This file was deleted.

Loading

0 comments on commit 532ea36

Please sign in to comment.