-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[teams] Use invites that can be reset
- Loading branch information
1 parent
c12f5ec
commit 7b72a71
Showing
10 changed files
with
186 additions
and
28 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 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
40 changes: 40 additions & 0 deletions
40
components/gitpod-db/src/typeorm/entity/db-team-membership-invite.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,40 @@ | ||
/** | ||
* Copyright (c) 2021 Gitpod GmbH. All rights reserved. | ||
* Licensed under the GNU Affero General Public License (AGPL). | ||
* See License-AGPL.txt in the project root for license information. | ||
*/ | ||
|
||
import { TeamMemberRole } from "@gitpod/gitpod-protocol"; | ||
import { Entity, Column, PrimaryColumn, Index } from "typeorm"; | ||
import { Transformer } from "../transformer"; | ||
import { TypeORM } from "../typeorm"; | ||
|
||
@Entity() | ||
// on DB but not Typeorm: @Index("ind_lastModified", ["_lastModified"]) // DBSync | ||
export class DBTeamMembershipInvite { | ||
@PrimaryColumn(TypeORM.UUID_COLUMN_TYPE) | ||
id: string; | ||
|
||
@Column(TypeORM.UUID_COLUMN_TYPE) | ||
@Index("ind_teamId") | ||
teamId: string; | ||
|
||
@Column("varchar") | ||
role: TeamMemberRole; | ||
|
||
@Column("varchar") | ||
creationTime: string; | ||
|
||
@Column("varchar") | ||
invalidationTime: string; | ||
|
||
@Column({ | ||
default: '', | ||
transformer: Transformer.MAP_EMPTY_STR_TO_UNDEFINED | ||
}) | ||
invitedEmail?: string; | ||
|
||
// This column triggers the db-sync deletion mechanism. It's not intended for public consumption. | ||
@Column() | ||
deleted: boolean; | ||
} |
19 changes: 19 additions & 0 deletions
19
components/gitpod-db/src/typeorm/migration/1623652164639-TeamMembershipInvite.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,19 @@ | ||
/** | ||
* Copyright (c) 2021 Gitpod GmbH. All rights reserved. | ||
* Licensed under the GNU Affero General Public License (AGPL). | ||
* See License-AGPL.txt in the project root for license information. | ||
*/ | ||
|
||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
|
||
export class TeamsMembershipInvite1623652164639 implements MigrationInterface { | ||
|
||
public async up(queryRunner: QueryRunner): Promise<any> { | ||
await queryRunner.query("CREATE TABLE IF NOT EXISTS `d_b_team_membership_invite` (`id` char(36) NOT NULL, `teamId` char(36) NOT NULL, `role` varchar(255) NOT NULL, `creationTime` varchar(255) NOT NULL, `invalidationTime` varchar(255) NOT NULL DEFAULT '', `invitedEmail` varchar(255) NOT NULL DEFAULT '', `deleted` tinyint(4) NOT NULL DEFAULT '0', `_lastModified` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), PRIMARY KEY (`id`), KEY `ind_teamId` (`teamId`), KEY `ind_dbsync` (`_lastModified`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;"); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<any> { | ||
// this is a one-way idempotent 'migration', no rollback possible for a nonempty DB | ||
} | ||
|
||
} |
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
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