Skip to content

Commit

Permalink
🛠 Console company-deleted fix (#2497)
Browse files Browse the repository at this point in the history
* Fix switch

* Fix console company_deleted issue
  • Loading branch information
RomaricMourgues authored and Labels Bot committed Sep 8, 2022
1 parent fbe6cb3 commit 65fbc70
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
10 changes: 9 additions & 1 deletion twake/backend/node/src/services/console/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ export type ConsoleHookBodyContent = {
user: ConsoleHookUser;
};

export type ConsoleHookCompanyDeletedContent = {
companyCode: string;
};

export type ConsoleHookPreferenceContent = {
preference: {
targetCode: string;
Expand All @@ -202,7 +206,11 @@ export type ConsoleHookPreferenceContent = {

export type ConsoleHookBody = {
type: string;
content: ConsoleHookBodyContent | ConsoleHookUser | ConsoleHookCompany;
content:
| ConsoleHookBodyContent
| ConsoleHookUser
| ConsoleHookCompany
| ConsoleHookCompanyDeletedContent;
signature: string;
secret_key?: string;
};
Expand Down
11 changes: 5 additions & 6 deletions twake/backend/node/src/services/console/web/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
ConsoleHookBody,
ConsoleHookBodyContent,
ConsoleHookCompany,
ConsoleHookCompanyDeletedContent,
ConsoleHookPreferenceContent,
ConsoleHookResponse,
ConsoleHookUser,
Expand Down Expand Up @@ -192,7 +193,7 @@ export class ConsoleController {
await this.planUpdated(request.body.content as ConsoleHookBodyContent);
break;
case "company_deleted":
await this.companyRemoved(request.body.content as ConsoleHookBodyContent);
await this.companyRemoved(request.body.content as ConsoleHookCompanyDeletedContent);
break;
case "company_created":
await this.companyUpdated(request.body.content as ConsoleHookBodyContent);
Expand Down Expand Up @@ -240,14 +241,12 @@ export class ConsoleController {
await gr.services.console.processPendingUser(user);
}

private async companyRemoved(content: ConsoleHookBodyContent) {
assert(content.company, "content.company is missing");
assert(content.company.details, "content.company.details is missing");
assert(content.company.details.code, "content.company.details.code is missing");
private async companyRemoved(content: ConsoleHookCompanyDeletedContent) {
assert(content.companyCode, "content.companyCode is missing");

await gr.services.console.getClient().removeCompany({
identity_provider: "console",
identity_provider_id: content.company.details.code,
identity_provider_id: content.companyCode,
});
}

Expand Down
4 changes: 4 additions & 0 deletions twake/frontend/src/tailwind.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ a {
color: var(--primary) !important;
}

.ant-switch-checked {
background-color: #004dff !important;
}

@layer base {
ul,ol {
list-style: revert;
Expand Down

0 comments on commit 65fbc70

Please sign in to comment.