Skip to content

Commit

Permalink
chore(api): added prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
fbonniec committed Nov 28, 2024
1 parent a6946cb commit fd0d011
Show file tree
Hide file tree
Showing 15 changed files with 55 additions and 40 deletions.
10 changes: 8 additions & 2 deletions packages/reva-api/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "prettier", "import"],
"plugins": ["@typescript-eslint", "import"],
"extends": [
"eslint:recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
"plugin:prettier/recommended"
],
"settings": {
"import/resolver": {
Expand Down Expand Up @@ -37,6 +37,12 @@
"varsIgnorePattern": "^_",
"ignoreRestSiblings": true
}
],
"prettier/prettier": [
"error",
{
"endOfLine": "auto"
}
]
}
}
1 change: 1 addition & 0 deletions packages/reva-api/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/graphql/generated
4 changes: 4 additions & 0 deletions packages/reva-api/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"semi": true,
"singleQuote": false
}
2 changes: 1 addition & 1 deletion packages/reva-api/infra/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const start = async () => {
host: "0.0.0.0",
});
server.log.info(
`Server listening on ${process.env.PORT} in ${process.env.NODE_ENV}`
`Server listening on ${process.env.PORT} in ${process.env.NODE_ENV}`,
);
} catch (err) {
server.log.error(err);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ export const getCandidacyMenu = async ({
const menuHeader: CandidacyMenuEntry[] = [
{
label: "Résumé de la candidature",
status: isCandidateSummaryComplete || candidacy.feasibilityFormat === "UPLOADED_PDF"
? "ACTIVE_WITHOUT_HINT"
: "ACTIVE_WITH_EDIT_HINT",
status:
isCandidateSummaryComplete ||
candidacy.feasibilityFormat === "UPLOADED_PDF"
? "ACTIVE_WITHOUT_HINT"
: "ACTIVE_WITH_EDIT_HINT",
url: buildUrl({ suffix: "summary" }),
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,8 @@ export const getCandidacyCcns = async (
}

const rows = await prismaClient.candidacyConventionCollective.findMany(query);
const count = await prismaClient.candidacyConventionCollective.count(
queryCount,
);
const count =
await prismaClient.candidacyConventionCollective.count(queryCount);

return {
rows: rows,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { prismaClient } from "../../../prisma/client";
import { CertificationAuthority } from "../certification-authority.types";

export async function getCertificationAuthoritiesByStructureId(
structureId: string
structureId: string,
): Promise<CertificationAuthority[] | null> {
return prismaClient.certificationAuthorityStructure
.findUnique({
where: {
id: structureId
id: structureId,
},
})
.certificationAuthorities();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { prismaClient } from "../../../prisma/client";
import { getDepartmentsByCertificationAuthorityId } from "./getDepartmentsByCertificationAuthorityId";

export const getCertificationAuthorityRegions = async (certificationAuthorityId: string) => {
const departments = await getDepartmentsByCertificationAuthorityId({ certificationAuthorityId})
const regionIds = departments.map((d) => d.regionId)
export const getCertificationAuthorityRegions = async (
certificationAuthorityId: string,
) => {
const departments = await getDepartmentsByCertificationAuthorityId({
certificationAuthorityId,
});
const regionIds = departments.map((d) => d.regionId);

const regions = await prismaClient.region.findMany({
where: { id: { in: regionIds } }
})
where: { id: { in: regionIds } },
});
return regions;
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export const updateCertificationAuthorityCertifications = async ({
certificationAuthorityId: string;
certificationIds: string[];
}): Promise<CertificationAuthority> => {

const result = await prismaClient.$transaction([
//delete old certifications associations and create the new ones
prismaClient.certificationAuthorityOnCertification.deleteMany({
Expand All @@ -33,4 +32,4 @@ export const updateCertificationAuthorityCertifications = async ({
}),
]);
return result[3] as CertificationAuthority;
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const hourFields = [
"otherTrainingHourCount",
] as const;

type HourFields = { [Key in typeof hourFields[number]]: Decimal };
type HourFields = { [Key in (typeof hourFields)[number]]: Decimal };

export const validateFeasibilityChecks = async (
input: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ const costFields = [
"otherTrainingCost",
] as const;

type HourFields = { [Key in typeof hourFields[number]]: Decimal };
type CostFields = { [Key in typeof costFields[number]]: Decimal };
type HourFields = { [Key in (typeof hourFields)[number]]: Decimal };
type CostFields = { [Key in (typeof costFields)[number]]: Decimal };

export const validHoursCountAndCosts = (input: CostFields & HourFields) =>
([] as BusinessRulesValidationError[])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { prismaClient } from "../../../prisma/client";
import { LegalInformationValidationDecisionInput } from "../organism.types";

export const adminCreateMaisonMereAAPLegalInformationValidationDecision = async (
maisonMereAAPId: string,
data: LegalInformationValidationDecisionInput
) => {
const r = await prismaClient.maisonMereAAPLegalInformationDocumentsDecision.create({
data: {
...data,
maisonMereAAPId,
},
});
return r;
}
export const adminCreateMaisonMereAAPLegalInformationValidationDecision =
async (
maisonMereAAPId: string,
data: LegalInformationValidationDecisionInput,
) => {
const r =
await prismaClient.maisonMereAAPLegalInformationDocumentsDecision.create({
data: {
...data,
maisonMereAAPId,
},
});
return r;
};
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ const createDefaultBlocs = async (
): Promise<CertificationCompetenceBloc[]> => {
const { certificationId, rncpId } = params;

const rncpCertification = await RNCPReferential.getInstance().findOneByRncp(
rncpId,
);
const rncpCertification =
await RNCPReferential.getInstance().findOneByRncp(rncpId);

if (rncpCertification) {
for (const bloc of rncpCertification.BLOCS_COMPETENCES) {
Expand Down
2 changes: 1 addition & 1 deletion packages/reva-api/modules/shared/file/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from "./file.interface";
export * from "./file.service";
export * from "./preview";
export * from "./preview";
3 changes: 1 addition & 2 deletions packages/reva-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
"prisma:generate:migration": "prisma migrate dev --create-only",
"cron": "npx [email protected] infra/cron.ts",
"cron-dev": "npx [email protected] infra/cron.ts | npx pino-pretty",
"lint": "eslint --color modules infra",
"prettier": "prettier --write \"{infra,modules}/**/*.{ts,md}\""
"lint": "eslint --color modules infra"
},
"prisma": {
"seed": "npx tsx prisma/seed/seed.ts"
Expand Down

0 comments on commit fd0d011

Please sign in to comment.