-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gateways : Visualiser la liste des membres de ma gouvernance #340
base: main
Are you sure you want to change the base?
Conversation
e37d38a
to
6796bed
Compare
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion | ||
const result = (await this.#dataResourceGouvernance.$queryRaw` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion | |
const result = (await this.#dataResourceGouvernance.$queryRaw` | |
const result: ReadonlyArray<Membres> = await this.#dataResourceGouvernance.$queryRaw` |
Par défaut, les as
sont en dernier recours
role: ReadonlyArray<string> | ||
} | ||
export class PrismaMesMembresLoader extends MesMembresLoader { | ||
readonly #dataResourceGouvernance: PrismaClient |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
readonly #dataResourceGouvernance: PrismaClient | |
readonly #dataResource PrismaClient |
Pour être consistent avec les autres loaders
interface Membres { | ||
nomMembre: string | ||
role: ReadonlyArray<string> | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interface Membres { | |
nomMembre: string | |
role: ReadonlyArray<string> | |
} | |
type Membres = Readonly<{ | |
nomMembre: string | |
role: ReadonlyArray<string> | |
}> |
Une interface est faite pour être intanciée, hors, ce n'est pas le cas ici.
Et met le tout en bas du fichier car c'est moins important que la classe
UNION ALL | ||
SELECT structure AS "nomMembre", ARRAY_AGG(role) AS role FROM membre_gouvernance_structure WHERE "gouvernanceDepartementCode" = ${codeDepartementGouvernance} GROUP BY structure | ||
UNION ALL | ||
SELECT departement.nom AS "nomMembre", ARRAY_AGG(membre_gouvernance_departement.role) AS role FROM membre_gouvernance_departement INNER JOIN departement ON membre_gouvernance_departement."departementCode" = departement.code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SELECT departement.nom AS "nomMembre", ARRAY_AGG(membre_gouvernance_departement.role) AS role FROM membre_gouvernance_departement INNER JOIN departement ON membre_gouvernance_departement."departementCode" = departement.code | |
SELECT departement.nom AS "nomMembre", ARRAY_AGG(membre_gouvernance_departement.role) AS role FROM membre_gouvernance_departement INNER JOIN departement ON membre_gouvernance_departement."departementCode" = departement.code |
}, | ||
].map((membre) => ({ | ||
...membre, | ||
roles: (result.find((membreDb: Membres) => membreDb.nomMembre === membre.nom)?.role ?? []) as ReadonlyArray<Role>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
roles: (result.find((membreDb: Membres) => membreDb.nomMembre === membre.nom)?.role ?? []) as ReadonlyArray<Role>, | |
roles: (result.find((membreDb: Membres) => membreDb.nomMembre === membre.nom)?.role ?? []) as MesMembresReadModel['roles'], |
Comme tu peux éviter d'exporter Role
}) | ||
} | ||
|
||
async function ajoutMembreGouvernanceCommune(): Promise<void> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C'est pas mal ça, vu que l'on fait souvent ça et de manière répétitive, on pourrait les mettre dans le testHelper et les utiliser tout le temps !
}) | ||
}) | ||
|
||
async function preRequisGouvernanceRhone(): Promise<void> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ca serait plus auto portant de la découper en 3 pour mieux voir dans le GIVEN le scénario
@@ -0,0 +1,189 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Supprimer la ligne
Contrat du dev
Qualité
Facultatif mais fortement conseillé