diff --git a/.socialgouv/config.json b/.socialgouv/config.json index 9bf86829..43d48af3 100644 --- a/.socialgouv/config.json +++ b/.socialgouv/config.json @@ -3,5 +3,7 @@ "type": "app", "subdomain": "monpsy", "registry": "ghcr", - "project": "mon-psy-sante" + "project": "mon-psy-sante", + "azurepg": true, + "devInitContainerCommand": ["yarn", "db:init"] } diff --git a/Dockerfile b/Dockerfile index c3542ba5..ab21f2df 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,6 +22,7 @@ ENV NODE_ENV production COPY --from=builder /app/next.config.js . COPY --from=builder /app/sentry.client.config.js . COPY --from=builder /app/sentry.server.config.js . +COPY --from=builder /app/.sequelizerc . COPY --from=builder /app/.env.production . COPY --from=builder /app/package.json . COPY --from=builder /app/src ./src diff --git a/package.json b/package.json index 2f18537d..510a5d9e 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "axios": "^0.24.0", "cron": "^1.8.2", "dotenv": "^11.0.0", - "faker": "^6.6.6", + "faker": "^5.5.3", "graphql": "^16.2.0", "graphql-request": "^3.7.0", "leaflet": "^1.7.1", @@ -61,9 +61,10 @@ "lint": "eslint ./src", "lint:fix": "eslint ./src --fix", "precommit": "lint-staged", - "start": "NODE_ENV=production next start", + "start": "yarn run db:migrate && NODE_ENV=production next start", "export": "next export", - "db:seed": "ts-node src/db/seeds/index.ts", + "db:init": "yarn run db:migrate && yarn run db:seed", + "db:seed": "ts-node --transpile-only src/db/seeds/index.ts", "db:migrate": "npx sequelize-cli db:migrate", "db:migrate:undo": "npx sequelize-cli db:migrate:undo", "db:migrate:create": "npx sequelize migration:create --name" diff --git a/src/components/Directory.tsx b/src/components/Directory.tsx index e8467f1a..41bc5115 100644 --- a/src/components/Directory.tsx +++ b/src/components/Directory.tsx @@ -12,7 +12,7 @@ import React, { useEffect, useRef, useState } from "react"; import { Coordinates } from "../types/coordinates"; import { FILTER } from "../types/enums/filters"; import { Psychologist } from "../types/psychologist"; -import { departments, getDepartment } from "./utils/departments"; +import { getDepartment } from "./utils/departments"; const AROUND_ME = "Autour de moi"; const AROUND_ME_OPTION = [{ label: AROUND_ME, value: AROUND_ME }]; @@ -109,6 +109,7 @@ const Directory = () => { if (filter === AROUND_ME) { checkGeolocationPermission(); } else if (filter && typeof filter === "string") { + setGeoLoading(true); axios .get( `https://api-adresse.data.gouv.fr/search/?q=${filter}&postCode=${filter}` @@ -119,6 +120,7 @@ const Directory = () => { latitude: coordinates[1], longitude: coordinates[0], }); + setGeoLoading(false); }); } else if (filter) { const coordinates = filter.split("-"); @@ -214,7 +216,10 @@ const Directory = () => { label="Rechercher par ville, code postal ou région" options={options} /> - {filter === AROUND_ME && geoStatus === geoStatusEnum.DENIED && ( diff --git a/src/services/config.ts b/src/services/config.ts index 42728437..3ec1eef6 100644 --- a/src/services/config.ts +++ b/src/services/config.ts @@ -2,7 +2,7 @@ import * as dotenv from "dotenv"; dotenv.config(); -const parseBoolean = (value: string) => value === "true"; +const parseBoolean = (value: string | undefined) => value === "true"; export default { demarchesSimplifiees: { @@ -15,6 +15,6 @@ export default { minScoreAddress: parseFloat(process.env.MIN_SCORE_ADDRESS || "0.55"), postgre: { logging: parseBoolean(process.env.DB_LOGGING_ENABLE), - url: process.env.DATABASE_URL, + url: process.env.DATABASE_URL || "", }, }; diff --git a/yarn.lock b/yarn.lock index 4173d2af..0cc5d142 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3462,10 +3462,10 @@ extract-files@^9.0.0: resolved "https://registry.yarnpkg.com/extract-files/-/extract-files-9.0.0.tgz#8a7744f2437f81f5ed3250ed9f1550de902fe54a" integrity sha512-CvdFfHkC95B4bBBk36hcEmvdR2awOdhhVUYH6S/zrVj3477zven/fJMYg7121h4T1xHZC+tetUpubpAhxwI7hQ== -faker@^6.6.6: - version "6.6.6" - resolved "https://registry.yarnpkg.com/faker/-/faker-6.6.6.tgz#e9529da0109dca4c7c5dbfeaadbd9234af943033" - integrity sha512-9tCqYEDHI5RYFQigXFwF1hnCwcWCOJl/hmll0lr5D2Ljjb0o4wphb69wikeJDz5qCEzXCoPvG6ss5SDP6IfOdg== +faker@^5.5.3: + version "5.5.3" + resolved "https://registry.yarnpkg.com/faker/-/faker-5.5.3.tgz#c57974ee484431b25205c2c8dc09fda861e51e0e" + integrity sha512-wLTv2a28wjUyWkbnX7u/ABZBkUkIF2fCd73V6P2oFqEGEktDfzWx4UxrSqtPRw0xPRAcjeAOIiJWqZm3pP4u3g== fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3"