Skip to content

Commit

Permalink
DEV : Clean code : add validation middleware where missing
Browse files Browse the repository at this point in the history
  • Loading branch information
juliecoust committed Jan 7, 2025
1 parent db61db1 commit 394aa39
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { MiddlewareAuthValidation } from './presentation/middleware/auth-validat
import { MiddlewareUserValidation } from './presentation/middleware/user-validation'
import { MiddlewareProjectValidation } from './presentation/middleware/project-validation'
import { MiddlewareSampleValidation } from './presentation/middleware/sample-validation'
import { MiddlewareInstrumentModelValidation } from './presentation/middleware/instrument_model-validation'
import { MiddlewareTaskValidation } from './presentation/middleware/task-validation'

import UserRouter from './presentation/routers/user-router'
import AuthRouter from './presentation/routers/auth-router'
Expand Down Expand Up @@ -65,9 +67,10 @@ import { FsAdapter } from './infra/files/fs'

import sqlite3 from 'sqlite3'
import path from 'path'

import 'dotenv/config'



sqlite3.verbose()

const config = {
Expand Down Expand Up @@ -169,7 +172,8 @@ async function getSQLiteDS() {
)
const instrumentModelMiddleWare = InstrumentModelRouter(
new GetOneInstrumentModel(instrument_model_repo),
new SearchInstrumentModels(instrument_model_repo, search_repo)
new SearchInstrumentModels(instrument_model_repo, search_repo),
new MiddlewareInstrumentModelValidation()
)
const projectMiddleWare = ProjectRouter(
new MiddlewareAuthCookie(jwtAdapter, config.ACCESS_TOKEN_SECRET, config.REFRESH_TOKEN_SECRET),
Expand All @@ -189,6 +193,7 @@ async function getSQLiteDS() {

const taskMiddleWare = TaskRouter(
new MiddlewareAuthCookie(jwtAdapter, config.ACCESS_TOKEN_SECRET, config.REFRESH_TOKEN_SECRET),
new MiddlewareTaskValidation(),
new DeleteTask(user_repo, task_repo, privilege_repo),
new GetOneTask(task_repo, user_repo, privilege_repo),
new GetLogFileTask(task_repo, user_repo, privilege_repo),
Expand Down

0 comments on commit 394aa39

Please sign in to comment.