From d890fcebac727a6114c0938ffde6a99f7f2f3338 Mon Sep 17 00:00:00 2001 From: Arnaud Ambroselli <31724752+arnaudambro@users.noreply.github.com> Date: Fri, 5 Apr 2024 13:25:04 +0200 Subject: [PATCH] fix: drink water lint (#514) --- api-node/src/controllers/indicators.ts | 5 ++-- api-node/src/controllers/user.ts | 3 +-- api-node/src/utils/drinking_water.ts | 33 +++++++++++++++++--------- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/api-node/src/controllers/indicators.ts b/api-node/src/controllers/indicators.ts index e1d5a1ac..92c3e64c 100644 --- a/api-node/src/controllers/indicators.ts +++ b/api-node/src/controllers/indicators.ts @@ -29,10 +29,9 @@ router.get( (list) => list.slug !== IndicatorsSlugEnum.drinking_water, ), }); - return; + } else { + res.status(200).send({ ok: true, data: indicatorsList }); } - res.status(200).send({ ok: true, data: indicatorsList }); - return; }), ); diff --git a/api-node/src/controllers/user.ts b/api-node/src/controllers/user.ts index c31b35bd..3e9bdde0 100644 --- a/api-node/src/controllers/user.ts +++ b/api-node/src/controllers/user.ts @@ -3,10 +3,9 @@ import { z } from 'zod'; import { catchErrors } from '../middlewares/errors'; import prisma from '../prisma.js'; import { type CustomError } from '~/types/error'; -import { type User } from '@prisma/client'; +import { type User, type udis as UdiType } from '@prisma/client'; import { withUser } from '~/middlewares/auth.js'; import type { RequestWithUser } from '~/types/request'; -import { type udis as UdiType } from '@prisma/client'; const router = express.Router(); router.post( diff --git a/api-node/src/utils/drinking_water.ts b/api-node/src/utils/drinking_water.ts index a11168af..3d3bc8fc 100644 --- a/api-node/src/utils/drinking_water.ts +++ b/api-node/src/utils/drinking_water.ts @@ -16,16 +16,21 @@ function checkPrelevementConformity( prelevement?: PrelevementConformity, ): ConformityEnum { if (!prelevement) return ConformityEnum.NOT_TESTED; - if (!prelevement.conclusion_conformite_prelevement) + if (!prelevement.conclusion_conformite_prelevement) { return ConformityEnum.NOT_TESTED; - if (!prelevement.conformite_limites_pc_prelevement) + } + if (!prelevement.conformite_limites_pc_prelevement) { return ConformityEnum.NOT_TESTED; - if (!prelevement.conformite_references_pc_prelevement) + } + if (!prelevement.conformite_references_pc_prelevement) { return ConformityEnum.NOT_TESTED; - if (!prelevement.conformite_limites_bact_prelevement) + } + if (!prelevement.conformite_limites_bact_prelevement) { return ConformityEnum.NOT_TESTED; - if (!prelevement.conformite_references_bact_prelevement) + } + if (!prelevement.conformite_references_bact_prelevement) { return ConformityEnum.NOT_TESTED; + } const conformityLimitChemical = prelevement.conformite_limites_pc_prelevement; const conformityReferenceChemical = @@ -62,12 +67,15 @@ function checkPrelevementConformityChemical( prelevement?: PrelevementConformity, ): ConformityEnum { if (!prelevement) return ConformityEnum.NOT_TESTED; - if (!prelevement.conclusion_conformite_prelevement) + if (!prelevement.conclusion_conformite_prelevement) { return ConformityEnum.NOT_TESTED; - if (!prelevement.conformite_limites_pc_prelevement) + } + if (!prelevement.conformite_limites_pc_prelevement) { return ConformityEnum.NOT_TESTED; - if (!prelevement.conformite_references_pc_prelevement) + } + if (!prelevement.conformite_references_pc_prelevement) { return ConformityEnum.NOT_TESTED; + } const conformityLimitChemical = prelevement.conformite_limites_pc_prelevement; const conformityReferenceChemical = @@ -92,12 +100,15 @@ function checkPrelevementConformityBacteriological( prelevement?: PrelevementConformity, ): ConformityEnum { if (!prelevement) return ConformityEnum.NOT_TESTED; - if (!prelevement.conclusion_conformite_prelevement) + if (!prelevement.conclusion_conformite_prelevement) { return ConformityEnum.NOT_TESTED; - if (!prelevement.conformite_limites_bact_prelevement) + } + if (!prelevement.conformite_limites_bact_prelevement) { return ConformityEnum.NOT_TESTED; - if (!prelevement.conformite_references_bact_prelevement) + } + if (!prelevement.conformite_references_bact_prelevement) { return ConformityEnum.NOT_TESTED; + } const conformityLimitBacteriological = prelevement.conformite_limites_bact_prelevement;