Skip to content

Commit

Permalink
Add second endpoint character and full testing
Browse files Browse the repository at this point in the history
  • Loading branch information
raulgonzalez committed May 14, 2024
1 parent a70e1ea commit d2cc7ce
Show file tree
Hide file tree
Showing 26 changed files with 781 additions and 24 deletions.
22 changes: 22 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"workbench.colorCustomizations": {
"activityBar.activeBackground": "#65c89b",
"activityBar.background": "#65c89b",
"activityBar.foreground": "#15202b",
"activityBar.inactiveForeground": "#15202b99",
"activityBarBadge.background": "#945bc4",
"activityBarBadge.foreground": "#e7e7e7",
"commandCenter.border": "#15202b99",
"sash.hoverBorder": "#65c89b",
"statusBar.background": "#42b883",
"statusBar.foreground": "#15202b",
"statusBarItem.hoverBackground": "#359268",
"statusBarItem.remoteBackground": "#42b883",
"statusBarItem.remoteForeground": "#15202b",
"titleBar.activeBackground": "#42b883",
"titleBar.activeForeground": "#15202b",
"titleBar.inactiveBackground": "#42b88399",
"titleBar.inactiveForeground": "#15202b99"
},
"peacock.color": "#42b883"
}
170 changes: 168 additions & 2 deletions package-lock.json

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

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@
"singleQuote": true
},
"devDependencies": {
"@jest/reporters": "29.7.0",
"@types/bcrypt": "^5.0.2",
"@types/cors": "^2.8.17",
"@types/debug": "^4.1.12",
"@types/express": "^4.17.21",
"@types/jest": "^29.5.12",
"@types/jsonwebtoken": "^9.0.6",
"@jest/reporters": "29.7.0",
"@types/morgan": "^1.9.9",
"@types/multer": "^1.4.11",
"@types/node": "^20.12.7",
"@typescript-eslint/eslint-plugin": "^7.7.1",
"@typescript-eslint/parser": "^7.7.1",
Expand All @@ -46,6 +47,7 @@
"dependencies": {
"@prisma/client": "^5.12.1",
"bcrypt": "^5.1.1",
"cloudinary": "^2.2.0",
"cors": "^2.8.5",
"cross-env": "^7.0.3",
"debug": "^4.3.4",
Expand All @@ -55,6 +57,7 @@
"joi": "^17.12.3",
"jsonwebtoken": "^9.0.2",
"morgan": "^1.10.0",
"multer": "^1.4.5-lts.1",
"nodemon": "^3.1.0",
"prisma": "^5.13.0"
}
Expand Down
16 changes: 16 additions & 0 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import { UsersSqlRepo } from './repositories/users.sql.repo.js';
import { UsersController } from './controller/user.controller.js';
import { UsersRouter } from './router/users.router.js';
import { ErrorsMiddleware } from './middleware/errors.middleware.js';
import { CharacterSqlRepo } from './repositories/characters.sql.repo.js';
import { CharacterController } from './controller/characters.controller.js';
import { CharacterRouter } from './router/characters.router.js';
import { FilesInterceptor } from './middleware/files.interceptor.js';

const debug = createDebug('GONJI:app');
export const createApp = () => {
Expand All @@ -22,11 +26,23 @@ export const startApp = (app: Express, prisma: PrismaClient) => {
app.use(cors());

const authInterceptor = new AuthInterceptor();
const filesInterceptor = new FilesInterceptor();

const userRepo = new UsersSqlRepo(prisma);
const userController = new UsersController(userRepo);
const userRouter = new UsersRouter(userController, authInterceptor);
app.use('/users', userRouter.router);

const characterRepo = new CharacterSqlRepo(prisma);
const characterController = new CharacterController(characterRepo);
const characterRouter = new CharacterRouter(
characterController,
authInterceptor,
characterRepo,
filesInterceptor
);
app.use('/character', characterRouter.router);

const errorsMiddleware = new ErrorsMiddleware();
app.use(errorsMiddleware.handle.bind(errorsMiddleware));
};
Loading

0 comments on commit d2cc7ce

Please sign in to comment.