-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(moderation): hide domaines by default (#564)
- Loading branch information
1 parent
29b16ed
commit 72bcc5b
Showing
10 changed files
with
132 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,8 +16,10 @@ Fonctionnalité: Moderation blockante à accepter | |
Quand sur la même ligne je clique sur "➡️" | ||
Alors je vois "Jean Bon veut rejoindre l'organisation « Abracadabra » avec l’adresse [email protected]" | ||
|
||
Quand je clique sur "🌐 1 domaine connu dans l'organisation" | ||
|
||
Scénario: Domaine interne | ||
Soit le tableau sous le title "Domaines de l'organisation" | ||
Soit le tableau sous le title "🌐 1 domaine connu dans l'organisation" | ||
* je vois la ligne "yopmail.com" dans le tableau | ||
* sur la même ligne je vois "❓" | ||
* sur la même ligne je vois "Menu" | ||
|
@@ -40,7 +42,7 @@ Fonctionnalité: Moderation blockante à accepter | |
Alors sur la même ligne je vois "✅" | ||
|
||
Scénario: Domaine externe | ||
Soit le tableau sous le title "Domaines de l'organisation" | ||
Soit le tableau sous le title "🌐 1 domaine connu dans l'organisation" | ||
* je vois la ligne "yopmail.com" dans le tableau | ||
Quand j'ouvre le menu déroulant sur la même ligne | ||
* je clique sur le bouton "❎ Domaine externe" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ Fonctionnalité: Moderation non blockante | |
Alors je vois "Marie Bon a rejoint une organisation avec un domain non vérifié « Robert bosch france » avec l’adresse [email protected]" | ||
|
||
Scénario: Le nom de domaine est vérifié | ||
Soit le tableau sous le title "Domaines de l'organisation" | ||
Soit le tableau sous le title "domaine connu dans l'organisation" | ||
* le tableau est vide | ||
Quand je clique sur "Je valide ce membre ✅" | ||
Quand je clique sur "J’autorise le domaine fr.bosch.com pour toute l’organisation" | ||
|
@@ -30,7 +30,7 @@ Fonctionnalité: Moderation non blockante | |
* je vois la ligne de table "57206768400017" | ||
Quand sur la même ligne je clique sur "✅" | ||
|
||
Soit le tableau sous le title "Domaines de l'organisation" | ||
Soit le tableau sous le title "domaine connu dans l'organisation" | ||
* je vois la ligne "fr.bosch.com" dans le tableau | ||
* sur la même ligne je vois "✅" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
packages/~/organizations/repository/src/get_domain_count.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// | ||
|
||
import { schema } from "@~/moncomptepro.database"; | ||
import { create_unicorn_organization } from "@~/moncomptepro.database/seed/unicorn"; | ||
import { empty_database, migrate, pg } from "@~/moncomptepro.database/testing"; | ||
import { beforeAll, beforeEach, expect, test } from "bun:test"; | ||
import { get_domain_count } from "./get_domain_count"; | ||
|
||
// | ||
|
||
beforeAll(migrate); | ||
beforeEach(empty_database); | ||
|
||
// | ||
|
||
test("returns no member", async () => { | ||
const unicorn_organization_id = await create_unicorn_organization(pg); | ||
|
||
const domain_unicorn = await get_domain_count(pg, { | ||
organization_id: unicorn_organization_id, | ||
}); | ||
|
||
expect(domain_unicorn).toEqual(0); | ||
}); | ||
|
||
test("returns 1 member", async () => { | ||
const unicorn_organization_id = await create_unicorn_organization(pg); | ||
|
||
const domain_unicorn = await get_domain_count(pg, { | ||
organization_id: unicorn_organization_id, | ||
}); | ||
|
||
expect(domain_unicorn).toBe(1); | ||
}); | ||
|
||
test.only("returns 3 domains", async () => { | ||
const unicorn_organization_id = await create_unicorn_organization(pg); | ||
await pg.insert(schema.email_domains).values({ | ||
domain: "bi.corn", | ||
organization_id: unicorn_organization_id, | ||
}); | ||
await pg.insert(schema.email_domains).values({ | ||
domain: "xorn.corn", | ||
organization_id: unicorn_organization_id, | ||
}); | ||
|
||
const domain_unicorn = await get_domain_count(pg, { | ||
organization_id: unicorn_organization_id, | ||
}); | ||
|
||
expect(domain_unicorn).toBe(3); | ||
}); |
24 changes: 24 additions & 0 deletions
24
packages/~/organizations/repository/src/get_domain_count.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
|
||
import { schema, type MonComptePro_PgDatabase } from "@~/moncomptepro.database"; | ||
import { count as drizzle_count, eq } from "drizzle-orm"; | ||
|
||
// | ||
|
||
export async function get_domain_count( | ||
pg: MonComptePro_PgDatabase, | ||
{ organization_id }: { organization_id: number }, | ||
) { | ||
const [{ value: count }] = await pg | ||
.select({ value: drizzle_count() }) | ||
.from(schema.email_domains) | ||
.innerJoin( | ||
schema.organizations, | ||
eq(schema.email_domains.organization_id, schema.organizations.id), | ||
) | ||
.where(eq(schema.organizations.id, organization_id)); | ||
|
||
return count; | ||
} | ||
|
||
export type get_domain_count_dto = Awaited<ReturnType<typeof get_domain_count>>; |