Skip to content

Commit 65fbc70

Browse files
Romaric MourguesLabels Bot
authored andcommitted
🛠 Console company-deleted fix (#2497)
* Fix switch * Fix console company_deleted issue
1 parent fbe6cb3 commit 65fbc70

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

twake/backend/node/src/services/console/types.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,10 @@ export type ConsoleHookBodyContent = {
194194
user: ConsoleHookUser;
195195
};
196196

197+
export type ConsoleHookCompanyDeletedContent = {
198+
companyCode: string;
199+
};
200+
197201
export type ConsoleHookPreferenceContent = {
198202
preference: {
199203
targetCode: string;
@@ -202,7 +206,11 @@ export type ConsoleHookPreferenceContent = {
202206

203207
export type ConsoleHookBody = {
204208
type: string;
205-
content: ConsoleHookBodyContent | ConsoleHookUser | ConsoleHookCompany;
209+
content:
210+
| ConsoleHookBodyContent
211+
| ConsoleHookUser
212+
| ConsoleHookCompany
213+
| ConsoleHookCompanyDeletedContent;
206214
signature: string;
207215
secret_key?: string;
208216
};

twake/backend/node/src/services/console/web/controller.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
ConsoleHookBody,
66
ConsoleHookBodyContent,
77
ConsoleHookCompany,
8+
ConsoleHookCompanyDeletedContent,
89
ConsoleHookPreferenceContent,
910
ConsoleHookResponse,
1011
ConsoleHookUser,
@@ -192,7 +193,7 @@ export class ConsoleController {
192193
await this.planUpdated(request.body.content as ConsoleHookBodyContent);
193194
break;
194195
case "company_deleted":
195-
await this.companyRemoved(request.body.content as ConsoleHookBodyContent);
196+
await this.companyRemoved(request.body.content as ConsoleHookCompanyDeletedContent);
196197
break;
197198
case "company_created":
198199
await this.companyUpdated(request.body.content as ConsoleHookBodyContent);
@@ -240,14 +241,12 @@ export class ConsoleController {
240241
await gr.services.console.processPendingUser(user);
241242
}
242243

243-
private async companyRemoved(content: ConsoleHookBodyContent) {
244-
assert(content.company, "content.company is missing");
245-
assert(content.company.details, "content.company.details is missing");
246-
assert(content.company.details.code, "content.company.details.code is missing");
244+
private async companyRemoved(content: ConsoleHookCompanyDeletedContent) {
245+
assert(content.companyCode, "content.companyCode is missing");
247246

248247
await gr.services.console.getClient().removeCompany({
249248
identity_provider: "console",
250-
identity_provider_id: content.company.details.code,
249+
identity_provider_id: content.companyCode,
251250
});
252251
}
253252

twake/frontend/src/tailwind.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ a {
2323
color: var(--primary) !important;
2424
}
2525

26+
.ant-switch-checked {
27+
background-color: #004dff !important;
28+
}
29+
2630
@layer base {
2731
ul,ol {
2832
list-style: revert;

0 commit comments

Comments
 (0)