-
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(ui): move moderation header to ui layeur
- Loading branch information
1 parent
ae42d45
commit 7a979d8
Showing
22 changed files
with
290 additions
and
78 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
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 was deleted.
Oops, something went wrong.
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
60 changes: 60 additions & 0 deletions
60
packages/~/moderations/lib/src/usecase/GetModerationHeader.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,60 @@ | ||
// | ||
|
||
import { NotFoundError } from "@~/app.core/error"; | ||
import type { MonCompteProDatabaseCradle } from "@~/moncomptepro.database"; | ||
|
||
export function GetModerationHeader({ pg }: MonCompteProDatabaseCradle) { | ||
return async function get_moderation_header(id: number) { | ||
const moderation = await pg.query.moderations.findFirst({ | ||
columns: { | ||
comment: true, | ||
id: true, | ||
moderated_at: true, | ||
moderated_by: true, | ||
type: true, | ||
}, | ||
where: (table, { eq }) => eq(table.id, id), | ||
with: { | ||
organization: { | ||
columns: { | ||
// cached_activite_principale: true, | ||
// cached_adresse: true, | ||
// cached_code_postal: true, | ||
// cached_est_active: true, | ||
// cached_etat_administratif: true, | ||
// cached_libelle_activite_principale: true, | ||
// cached_libelle_categorie_juridique: true, | ||
// cached_libelle_tranche_effectif: true, | ||
cached_libelle: true, | ||
// cached_nom_complet: true, | ||
// cached_tranche_effectifs: true, | ||
// created_at: true, | ||
id: true, | ||
// siret: true, | ||
// updated_at: true, | ||
}, | ||
}, | ||
user: { | ||
columns: { | ||
// created_at: true, | ||
email: true, | ||
family_name: true, | ||
given_name: true, | ||
id: true, | ||
// job: true, | ||
// last_sign_in_at: true, | ||
// phone_number: true, | ||
// sign_in_count: true, | ||
}, | ||
}, | ||
}, | ||
}); | ||
if (!moderation) throw new NotFoundError("Moderaion not found."); | ||
return moderation; | ||
}; | ||
} | ||
|
||
export type GetModerationHeaderHandler = ReturnType<typeof GetModerationHeader>; | ||
export type GetModerationHeaderOutput = Awaited< | ||
ReturnType<GetModerationHeaderHandler> | ||
>; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// | ||
|
||
export * from "./Crisp"; |
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
packages/~/moderations/ui/src/FindCorrespondingEmail/index.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,3 @@ | ||
// | ||
|
||
export * from "./FindCorrespondingEmail"; |
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,32 @@ | ||
// | ||
|
||
import { renderHTML } from "@~/app.ui/testing"; | ||
import { expect, test } from "bun:test"; | ||
import { Header } from "./Header"; | ||
|
||
test("render header section", async () => { | ||
expect( | ||
await renderHTML( | ||
<Header.Provier | ||
value={{ | ||
moderation: { | ||
comment: null, | ||
moderated_at: null, | ||
moderated_by: null, | ||
id: 42, | ||
organization: { cached_libelle: "🦄 libelle", id: 43 }, | ||
type: "organization_join_block", | ||
user: { | ||
email: "[email protected]", | ||
family_name: "Pony", | ||
given_name: "Adora", | ||
id: 44, | ||
}, | ||
}, | ||
}} | ||
> | ||
<Header /> | ||
</Header.Provier>, | ||
), | ||
).toMatchSnapshot(); | ||
}); |
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
Oops, something went wrong.