From b4a6d62aca7142a19c48fd59fde1acc0f1a38bca Mon Sep 17 00:00:00 2001 From: ramiroaisen <52116153+ramiroaisen@users.noreply.github.com> Date: Tue, 13 Jun 2023 11:33:03 -0300 Subject: [PATCH] members, revoke access, change role --- defs/api/PublicInvitation.ts | 1 + .../members/[member]/DELETE/Output.ts | 4 + .../[member]/set-role/POST/AccessKind.ts | 3 + .../members/[member]/set-role/POST/Output.ts | 4 + .../members/[member]/set-role/POST/Payload.ts | 4 + .../invitations/[invitation]/DELETE/Output.ts | 4 + .../src/lib/components/SimpleLogo.svelte | 12 +- .../lib/components/Dashboard/TopUser.svelte | 10 +- .../app/src/lib/components/SimpleLogo.svelte | 12 +- .../accounts/[account]/members/+page.svelte | 316 +++++++++++++++++- .../(app)/accounts/[account]/members/+page.ts | 2 +- .../(app)/me/invitations/+page.svelte | 42 ++- front/server/src/api/shared-api.ts | 13 + front/server/src/client.ts | 12 + front/server/src/locale/studio/studio.ar.ts | 9 + front/server/src/locale/studio/studio.de.ts | 9 + front/server/src/locale/studio/studio.en.ts | 9 + .../server/src/locale/studio/studio.es-AR.ts | 11 +- front/server/src/locale/studio/studio.es.ts | 9 + front/server/src/locale/studio/studio.fr.ts | 9 + front/server/src/locale/studio/studio.it.ts | 9 + front/server/src/locale/studio/studio.pt.ts | 9 + front/server/src/locale/studio/studio.zh.ts | 9 + front/server/src/locale/wip/wip.ar.ts | 113 +------ front/server/src/locale/wip/wip.de.ts | 113 +------ front/server/src/locale/wip/wip.en.ts | 111 +----- front/server/src/locale/wip/wip.es-AR.ts | 114 +------ front/server/src/locale/wip/wip.es.ts | 114 +------ front/server/src/locale/wip/wip.fr.ts | 113 +------ front/server/src/locale/wip/wip.it.ts | 113 +------ front/server/src/locale/wip/wip.pt.ts | 113 +------ front/server/src/locale/wip/wip.zh.ts | 113 +------ .../api/src/routes/accounts/members/id.rs | 217 ++++++++++++ .../accounts/{members.rs => members/mod.rs} | 2 + .../api/src/routes/invitations/accept.rs | 17 +- .../src/routes/invitations/get_by_token.rs | 9 +- rs/packages/api/src/routes/invitations/id.rs | 138 +++++++- rs/packages/api/src/routes/invitations/mod.rs | 4 + .../api/src/routes/invitations/reject.rs | 7 +- rs/packages/api/src/routes/mod.rs | 13 +- .../db/src/models/account_invitations/mod.rs | 2 + 41 files changed, 961 insertions(+), 987 deletions(-) create mode 100644 defs/api/accounts/[account]/members/[member]/DELETE/Output.ts create mode 100644 defs/api/accounts/[account]/members/[member]/set-role/POST/AccessKind.ts create mode 100644 defs/api/accounts/[account]/members/[member]/set-role/POST/Output.ts create mode 100644 defs/api/accounts/[account]/members/[member]/set-role/POST/Payload.ts create mode 100644 defs/api/invitations/[invitation]/DELETE/Output.ts create mode 100644 rs/packages/api/src/routes/accounts/members/id.rs rename rs/packages/api/src/routes/accounts/{members.rs => members/mod.rs} (99%) diff --git a/defs/api/PublicInvitation.ts b/defs/api/PublicInvitation.ts index efd4c61e..1a7f4cf8 100644 --- a/defs/api/PublicInvitation.ts +++ b/defs/api/PublicInvitation.ts @@ -13,6 +13,7 @@ export type PublicInvitation = { account_id: string; receiver_email: string; created_at: DateTime; + deleted_at: DateTime | null; is_expired: boolean; expires_at: DateTime; account: InvitationAccount | null; diff --git a/defs/api/accounts/[account]/members/[member]/DELETE/Output.ts b/defs/api/accounts/[account]/members/[member]/DELETE/Output.ts new file mode 100644 index 00000000..26622e8a --- /dev/null +++ b/defs/api/accounts/[account]/members/[member]/DELETE/Output.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { EmptyStruct } from "../../../../../../EmptyStruct"; + +export type Output = EmptyStruct; diff --git a/defs/api/accounts/[account]/members/[member]/set-role/POST/AccessKind.ts b/defs/api/accounts/[account]/members/[member]/set-role/POST/AccessKind.ts new file mode 100644 index 00000000..8352b104 --- /dev/null +++ b/defs/api/accounts/[account]/members/[member]/set-role/POST/AccessKind.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type AccessKind = "owner" | "staff"; diff --git a/defs/api/accounts/[account]/members/[member]/set-role/POST/Output.ts b/defs/api/accounts/[account]/members/[member]/set-role/POST/Output.ts new file mode 100644 index 00000000..fe3ccd5b --- /dev/null +++ b/defs/api/accounts/[account]/members/[member]/set-role/POST/Output.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { EmptyStruct } from "../../../../../../../EmptyStruct"; + +export type Output = EmptyStruct; diff --git a/defs/api/accounts/[account]/members/[member]/set-role/POST/Payload.ts b/defs/api/accounts/[account]/members/[member]/set-role/POST/Payload.ts new file mode 100644 index 00000000..8e69f53b --- /dev/null +++ b/defs/api/accounts/[account]/members/[member]/set-role/POST/Payload.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { AccessKind } from "./AccessKind"; + +export type Payload = { role: AccessKind }; diff --git a/defs/api/invitations/[invitation]/DELETE/Output.ts b/defs/api/invitations/[invitation]/DELETE/Output.ts new file mode 100644 index 00000000..711ba65b --- /dev/null +++ b/defs/api/invitations/[invitation]/DELETE/Output.ts @@ -0,0 +1,4 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { EmptyStruct } from "../../../../EmptyStruct"; + +export type Output = EmptyStruct; diff --git a/front/admin/src/lib/components/SimpleLogo.svelte b/front/admin/src/lib/components/SimpleLogo.svelte index ebdb9b28..a5959665 100644 --- a/front/admin/src/lib/components/SimpleLogo.svelte +++ b/front/admin/src/lib/components/SimpleLogo.svelte @@ -31,10 +31,10 @@ } -