From 4a040ce90e0d93271a4cd42e17c572504964b547 Mon Sep 17 00:00:00 2001 From: Caroline <4971715+carolineBda@users.noreply.github.com> Date: Fri, 6 May 2022 09:28:37 +0200 Subject: [PATCH] feat(address): show address additional infos (#171) --- .env.production | 2 +- .env.staging | 2 +- .env.test | 2 +- src/components/Directory/Psychologist.tsx | 5 +++ .../20220503133008-add-complement-address.js | 31 +++++++++++++++++++ src/db/models/psychologist.ts | 2 ++ src/db/seeds/psychologist.ts | 2 ++ src/types/psychologist.d.ts | 2 ++ 8 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 src/db/migrations/20220503133008-add-complement-address.js diff --git a/.env.production b/.env.production index f8c26303..8db2ca47 100644 --- a/.env.production +++ b/.env.production @@ -8,7 +8,7 @@ DB_LOGGING_ENABLE=false DEMARCHES_SIMPLIFIEES_TOKEN=api-token DEMARCHES_SIMPLIFIEES_ID=52209 -DEMARCHES_SIMPLIFIEES_CHAMPS=[["Q2hhbXAtMTYwMzgwNQ==", "phone"], ["Q2hhbXAtMTYyNzkzOQ==", "address"], ["Q2hhbXAtMjMyMzQyMg==", "secondAddress"], ["Q2hhbXAtMTYzOTUyNA==", "teleconsultation"], ["Q2hhbXAtMTY2MDM0Nw==", "languages"], ["Q2hhbXAtMTYzOTQwMQ==", "website"], ["Q2hhbXAtMjI0NzExMg==", "cdsmsp"], ["Q2hhbXAtMjIyMjcwMg==", "public"], ["Q2hhbXAtMTYwMTE4Ng==", "email"], ["Q2hhbXAtMjI1MTk5Mw==", "displayEmail"], ["Q2hhbXAtMTYyNjk4Nw==", "adeliId"]] +DEMARCHES_SIMPLIFIEES_CHAMPS=[["Q2hhbXAtMTYwMzgwNQ==", "phone"], ["Q2hhbXAtMTYyNzkzOQ==", "address"], ["Q2hhbXAtMjQyNTQxMA==", "addressAdditional"], ["Q2hhbXAtMjMyMzQyMg==", "secondAddress"], ["Q2hhbXAtMjQyNTQxMg==", "secondAddressAdditional"], ["Q2hhbXAtMTYzOTUyNA==", "teleconsultation"], ["Q2hhbXAtMTY2MDM0Nw==", "languages"], ["Q2hhbXAtMTYzOTQwMQ==", "website"], ["Q2hhbXAtMjI0NzExMg==", "cdsmsp"], ["Q2hhbXAtMjIyMjcwMg==", "public"], ["Q2hhbXAtMTYwMTE4Ng==", "email"], ["Q2hhbXAtMjI1MTk5Mw==", "displayEmail"], ["Q2hhbXAtMTYyNjk4Nw==", "adeliId"]] DEMARCHES_SIMPLIFIEES_WRITE_ACCESS=true DEMARCHES_SIMPLIFIEES_CHAMP_VERIFICATIONS_AUTOMATIQUES="Q2hhbXAtMjMyMzUxNw==" DEMARCHES_SIMPLIFIEES_INSTRUCTEUR_ID= diff --git a/.env.staging b/.env.staging index ae35f18e..b36c4c7d 100644 --- a/.env.staging +++ b/.env.staging @@ -5,7 +5,7 @@ NEXT_PUBLIC_SENTRY_ENV="development" DEMARCHES_SIMPLIFIEES_TOKEN=api-tokens DEMARCHES_SIMPLIFIEES_ID=52209 -DEMARCHES_SIMPLIFIEES_CHAMPS=[["Q2hhbXAtMTYwMzgwNQ==", "phone"], ["Q2hhbXAtMTYyNzkzOQ==", "address"], ["Q2hhbXAtMjMyMzQyMg==", "secondAddress"], ["Q2hhbXAtMTYzOTUyNA==", "teleconsultation"], ["Q2hhbXAtMTY2MDM0Nw==", "languages"], ["Q2hhbXAtMTYzOTQwMQ==", "website"], ["Q2hhbXAtMjI0NzExMg==", "cdsmsp"], ["Q2hhbXAtMjIyMjcwMg==", "public"], ["Q2hhbXAtMTYwMTE4Ng==", "email"], ["Q2hhbXAtMjI1MTk5Mw==", "displayEmail"], ["Q2hhbXAtMTYyNjk4Nw==", "adeliId"]] +DEMARCHES_SIMPLIFIEES_CHAMPS=[["Q2hhbXAtMTYwMzgwNQ==", "phone"], ["Q2hhbXAtMTYyNzkzOQ==", "address"], ["Q2hhbXAtMjQyNTQxMA==", "addressAdditional"], ["Q2hhbXAtMjMyMzQyMg==", "secondAddress"], ["Q2hhbXAtMjQyNTQxMg==", "secondAddressAdditional"], ["Q2hhbXAtMTYzOTUyNA==", "teleconsultation"], ["Q2hhbXAtMTY2MDM0Nw==", "languages"], ["Q2hhbXAtMTYzOTQwMQ==", "website"], ["Q2hhbXAtMjI0NzExMg==", "cdsmsp"], ["Q2hhbXAtMjIyMjcwMg==", "public"], ["Q2hhbXAtMTYwMTE4Ng==", "email"], ["Q2hhbXAtMjI1MTk5Mw==", "displayEmail"], ["Q2hhbXAtMTYyNjk4Nw==", "adeliId"]] DEMARCHES_SIMPLIFIEES_WRITE_ACCESS=false DEMARCHES_SIMPLIFIEES_WRITABLE_ID="RG9zc2llci03NzgwODIy" DEMARCHES_SIMPLIFIEES_CHAMP_VERIFICATIONS_AUTOMATIQUES="Q2hhbXAtMjMyMzUxNw==" diff --git a/.env.test b/.env.test index d38f26f7..949a4da2 100644 --- a/.env.test +++ b/.env.test @@ -4,7 +4,7 @@ DB_LOGGING_ENABLE=false DEMARCHES_SIMPLIFIEES_TOKEN=api-token DEMARCHES_SIMPLIFIEES_ID=52209 -DEMARCHES_SIMPLIFIEES_CHAMPS=[["Q2hhbXAtMTYwMzgwNQ==", "phone"], ["Q2hhbXAtMTYyNzkzOQ==", "address"], ["Q2hhbXAtMjMyMzQyMg==", "secondAddress"], ["Q2hhbXAtMTYzOTUyNA==", "teleconsultation"], ["Q2hhbXAtMTY2MDM0Nw==", "languages"], ["Q2hhbXAtMTYzOTQwMQ==", "website"], ["Q2hhbXAtMjI0NzExMg==", "cdsmsp"], ["Q2hhbXAtMjIyMjcwMg==", "public"], ["Q2hhbXAtMTYwMTE4Ng==", "email"], ["Q2hhbXAtMjI1MTk5Mw==", "displayEmail"], ["Q2hhbXAtMTYyNjk4Nw==", "adeliId"]] +DEMARCHES_SIMPLIFIEES_CHAMPS=[["Q2hhbXAtMTYwMzgwNQ==", "phone"], ["Q2hhbXAtMTYyNzkzOQ==", "address"], ["Q2hhbXAtMjQyNTQxMA==", "addressAdditional"], ["Q2hhbXAtMjMyMzQyMg==", "secondAddress"], ["Q2hhbXAtMjQyNTQxMg==", "secondAddressAdditional"], ["Q2hhbXAtMTYzOTUyNA==", "teleconsultation"], ["Q2hhbXAtMTY2MDM0Nw==", "languages"], ["Q2hhbXAtMTYzOTQwMQ==", "website"], ["Q2hhbXAtMjI0NzExMg==", "cdsmsp"], ["Q2hhbXAtMjIyMjcwMg==", "public"], ["Q2hhbXAtMTYwMTE4Ng==", "email"], ["Q2hhbXAtMjI1MTk5Mw==", "displayEmail"], ["Q2hhbXAtMTYyNjk4Nw==", "adeliId"]] DEMARCHES_SIMPLIFIEES_WRITE_ACCESS=false DEMARCHES_SIMPLIFIEES_WRITABLE_ID="RG9zc2llci03NzgwODIy" DEMARCHES_SIMPLIFIEES_CHAMP_VERIFICATIONS_AUTOMATIQUES="Q2hhbXAtMjMyMzUxNw==" diff --git a/src/components/Directory/Psychologist.tsx b/src/components/Directory/Psychologist.tsx index ada6d8b0..67937521 100644 --- a/src/components/Directory/Psychologist.tsx +++ b/src/components/Directory/Psychologist.tsx @@ -103,6 +103,11 @@ const Psychologist = ({ src="/images/icones/map-pin-fill.svg" /> {psychologist.address} + {psychologist.addressAdditional ?? ( + + {psychologist.addressAdditional} + + )}

{psychologist.visible ? ( diff --git a/src/db/migrations/20220503133008-add-complement-address.js b/src/db/migrations/20220503133008-add-complement-address.js new file mode 100644 index 00000000..076892ca --- /dev/null +++ b/src/db/migrations/20220503133008-add-complement-address.js @@ -0,0 +1,31 @@ +"use strict"; + +module.exports = { + async up(queryInterface, Sequelize) { + await queryInterface.addColumn("psychologist", "display_phone", { + type: Sequelize.BOOLEAN, + defaultValue: true, + }); + await queryInterface.addColumn("psychologist", "address_additional", { + allowNull: true, + type: Sequelize.TEXT, + }); + await queryInterface.addColumn( + "psychologist", + "second_address_additional", + { + allowNull: true, + type: Sequelize.TEXT, + } + ); + }, + + async down(queryInterface) { + await queryInterface.removeColumn("psychologist", "display_phone"); + await queryInterface.removeColumn("psychologist", "address_additional"); + await queryInterface.removeColumn( + "psychologist", + "second_address_additional" + ); + }, +}; diff --git a/src/db/models/psychologist.ts b/src/db/models/psychologist.ts index 73b3220c..ffa5bb8d 100644 --- a/src/db/models/psychologist.ts +++ b/src/db/models/psychologist.ts @@ -8,7 +8,9 @@ export default (sequelize) => { Psychologist.init( { address: DataTypes.TEXT, + addressAdditional: DataTypes.TEXT, secondAddress: DataTypes.TEXT, + secondAddressAdditional: DataTypes.TEXT, archived: DataTypes.BOOLEAN, cdsmsp: DataTypes.STRING, coordinates: DataTypes.GEOMETRY("POINT", SRID), diff --git a/src/db/seeds/psychologist.ts b/src/db/seeds/psychologist.ts index 34d67284..d6028d30 100644 --- a/src/db/seeds/psychologist.ts +++ b/src/db/seeds/psychologist.ts @@ -33,9 +33,11 @@ export const getOnePsychologist = ( address: `${faker.address.streetAddress()} ${faker.address.zipCode( "#####" )} ${faker.address.city()}`, + addressAdditional: faker.datatype.string(10), secondAddress: `${faker.address.streetAddress()} ${faker.address.zipCode( "#####" )} ${faker.address.city()}`, + secondAddressAdditional: faker.datatype.string(10), archived: false, cdsmsp: faker.lorem.word(5), coordinates: { diff --git a/src/types/psychologist.d.ts b/src/types/psychologist.d.ts index 87c2aee3..c895e2d1 100644 --- a/src/types/psychologist.d.ts +++ b/src/types/psychologist.d.ts @@ -7,7 +7,9 @@ export interface Psychologist { archived: boolean; phone: string; address: string; + addressAdditional?: string; secondAddress: string; + secondAddressAdditional?: string; teleconsultation: boolean; displayEmail: boolean; visible: boolean;