Skip to content
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

En tant qu'admin je peux supprimer une entreprise #425

Merged
merged 16 commits into from
Aug 17, 2023

Conversation

bbohec
Copy link
Contributor

@bbohec bbohec commented Jul 6, 2023

No description provided.

@bbohec bbohec linked an issue Jul 6, 2023 that may be closed by this pull request
@bbohec bbohec self-assigned this Jul 6, 2023
@bbohec bbohec force-pushed the 115-etq-quadmin-je-peux-supprimer-une-entreprise branch 2 times, most recently from b4fb026 to a91e6f7 Compare July 10, 2023 15:56
@bbohec bbohec force-pushed the 115-etq-quadmin-je-peux-supprimer-une-entreprise branch 2 times, most recently from f45e4ac to 24f526b Compare July 26, 2023 09:51
@bbohec bbohec force-pushed the 115-etq-quadmin-je-peux-supprimer-une-entreprise branch 4 times, most recently from 6fdc853 to b140478 Compare August 8, 2023 14:19
@bbohec
Copy link
Contributor Author

bbohec commented Aug 8, 2023

  1. NO ESTAB
    image

  2. ESTAB CREATED & FOUND
    image
    image

  3. DELETE ESTAB FROM BACK OFFICE
    image
    image
    image
    image
    image

  4. REMOVAL PROOF ON DB
    image
    image
    image
    image

@bbohec bbohec marked this pull request as ready for review August 8, 2023 15:11
@bbohec bbohec force-pushed the 115-etq-quadmin-je-peux-supprimer-une-entreprise branch from c92500d to 2159161 Compare August 8, 2023 15:12
Comment on lines 237 to 238
`⚠️ Etes-vous sûr de vouloir supprimer cette établissement ? ⚠️
(cette opération est irréversible 💀)`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`⚠️ Etes-vous sûr de vouloir supprimer cette établissement ? ⚠️
(cette opération est irréversible 💀)`,
`⚠️ Etes-vous sûr de vouloir supprimer cet établissement ? ⚠️
(cette opération est irréversible 💀)`,

public addFormEstablishment$(
formEstablishment: FormEstablishmentDto,
): Observable<void> {
return from(this.addFormEstablishment(formEstablishment));
return from(this.#addFormEstablishment(formEstablishment));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pourquoi avoir créé une fonction privée ici ? (pareil dans deleteEstablishment, updateFormEstablishment et requestEstablishmentModification)

Suggested change
return from(this.#addFormEstablishment(formEstablishment));
return from(this.httpClient.addFormEstablishment({
body: formEstablishment,
}));

back/src/adapters/primary/authMiddleware.ts Show resolved Hide resolved
export const formEstablishementUpdateFailedErrorMessage = (
dto: FormEstablishmentDto,
): string =>
`Cannot update form establishlment DTO with siret ${dto.siret}, since it is not found.`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`Cannot update form establishlment DTO with siret ${dto.siret}, since it is not found.`;
`Cannot update form establishment DTO with siret ${dto.siret}, since it is not found.`;

formEstablishment.siret,
);
log("Cleared existing Aggregate");
const establishlment =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const establishlment =
const establishment =

tags: ["suppression entreprise"],
createEmailVariables: ({ businessAddress, businessName, siret }) => ({
subject:
"Votre entreprise a été supprimée de la liste des entreprises accueillantes d'immersion facilitée d'Immersion Facilitée",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Votre entreprise a été supprimée de la liste des entreprises accueillantes d'immersion facilitée d'Immersion Facilitée",
"Votre entreprise a été supprimée de la liste des entreprises accueillantes d'Immersion Facilitée",

@@ -264,6 +264,7 @@ export const domElementIds = {
errorSiretAlreadyExistButton:
"im-form-add-establishment__edit-establishment-button",
submitButton: "im-form-add-establishment__submit-button",
deleteButton: "im-form-delete-establishment__onclick-button",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
deleteButton: "im-form-delete-establishment__onclick-button",
deleteButton: "im-form-delete-establishment__delete-button",

store.dispatch(
establishmentSlice.actions.establishmentDeletionRequested({
siret: formEstablishment.siret,
jwt: "backoffice-jwt",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
jwt: "backoffice-jwt",
jwt: backOfficeJwt,

>;

export type EstablishmentUpdatePayload = {
formEstablishment: FormEstablishmentDto;
jwt: EstablishmentJwt;
};

export type EstablishmentDeletePayload = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

à voir: homogénéiser front + back ?

const featureFlags = useFeatureFlags();
const { getFormFields } = useFormContents(formEstablishmentFieldsLabels);
const formContents = getFormFields();
const { register, setValue } = useFormContext();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enlever le setValue

/>
</div>
<Button
title="Piloter l'entreprise"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • supprimer title
  • mettre un id

sub: "admin",
};

it("throws an error if there is jwt", async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
it("throws an error if there is jwt", async () => {
it("throws an error if there is no jwt", async () => {

await pool.end();
});

it("save", async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

que se passe-t-il si sauvegarde d'un même établissement une seconde fois ?


describe("delete", () => {
it("delete establishment", async () => {
const formEstablishment = FormEstablishmentDtoBuilder.valid()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

factoriser formEstablishment car utilisé plusieurs fois

@@ -1,4 +1,9 @@
import { SearchImmersionResultDto } from "shared";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renommer le fichier avec une majuscule

} = await buildTestApp());
});

it("200 - Establishment Aggregate & Form deleted with back office JWT", async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
it("200 - Establishment Aggregate & Form deleted with back office JWT", async () => {
it("204 - Establishment Aggregate & Form deleted with back office JWT", async () => {

@bbohec bbohec force-pushed the 115-etq-quadmin-je-peux-supprimer-une-entreprise branch from 76ab0e9 to 424f7ee Compare August 17, 2023 12:38
@bbohec bbohec force-pushed the 115-etq-quadmin-je-peux-supprimer-une-entreprise branch from 424f7ee to 801ce6c Compare August 17, 2023 13:03
@bbohec bbohec merged commit 0656a44 into main Aug 17, 2023
@bbohec bbohec deleted the 115-etq-quadmin-je-peux-supprimer-une-entreprise branch August 17, 2023 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ETQ qu'admin , je peux "supprimer" une entreprise
3 participants