From 7ed3448e13847f3ba807be1354e90c912fbefd9a Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 1 Feb 2020 07:16:52 +0900 Subject: Resolve #1669 --- src/models/entities/user-profile.ts | 83 ++----------------------------------- src/models/repositories/user.ts | 14 +------ 2 files changed, 4 insertions(+), 93 deletions(-) (limited to 'src/models') diff --git a/src/models/entities/user-profile.ts b/src/models/entities/user-profile.ts index 1244fa4390..278e8ce815 100644 --- a/src/models/entities/user-profile.ts +++ b/src/models/entities/user-profile.ts @@ -137,87 +137,10 @@ export class UserProfile { @JoinColumn() public pinnedPage: Page | null; - //#region Linking - @Column('boolean', { - default: false, - }) - public twitter: boolean; - - @Column('varchar', { - length: 64, nullable: true, default: null, - }) - public twitterAccessToken: string | null; - - @Column('varchar', { - length: 64, nullable: true, default: null, - }) - public twitterAccessTokenSecret: string | null; - - @Column('varchar', { - length: 64, nullable: true, default: null, - }) - public twitterUserId: string | null; - - @Column('varchar', { - length: 64, nullable: true, default: null, - }) - public twitterScreenName: string | null; - - @Column('boolean', { - default: false, - }) - public github: boolean; - - @Column('varchar', { - length: 64, nullable: true, default: null, - }) - public githubAccessToken: string | null; - - @Column('varchar', { - length: 64, nullable: true, default: null, - }) - public githubId: string | null; - - @Column('varchar', { - length: 64, nullable: true, default: null, - }) - public githubLogin: string | null; - - @Column('boolean', { - default: false, - }) - public discord: boolean; - - @Column('varchar', { - length: 64, nullable: true, default: null, - }) - public discordAccessToken: string | null; - - @Column('varchar', { - length: 64, nullable: true, default: null, - }) - public discordRefreshToken: string | null; - - @Column('varchar', { - length: 64, nullable: true, default: null, - }) - public discordExpiresDate: string | null; - - @Column('varchar', { - length: 64, nullable: true, default: null, - }) - public discordId: string | null; - - @Column('varchar', { - length: 64, nullable: true, default: null, - }) - public discordUsername: string | null; - - @Column('varchar', { - length: 64, nullable: true, default: null, + @Column('jsonb', { + default: {} }) - public discordDiscriminator: string | null; - //#endregion + public integrations: Record; //#region Denormalized fields @Index() diff --git a/src/models/repositories/user.ts b/src/models/repositories/user.ts index 3b3ed6b793..25ce00cdc4 100644 --- a/src/models/repositories/user.ts +++ b/src/models/repositories/user.ts @@ -213,19 +213,6 @@ export class UserRepository extends Repository { userId: user.id }).then(result => result >= 1) : false, - twitter: profile!.twitter ? { - id: profile!.twitterUserId, - screenName: profile!.twitterScreenName - } : null, - github: profile!.github ? { - id: profile!.githubId, - login: profile!.githubLogin - } : null, - discord: profile!.discord ? { - id: profile!.discordId, - username: profile!.discordUsername, - discriminator: profile!.discordDiscriminator - } : null, } : {}), ...(opts.detail && meId === user.id ? { @@ -242,6 +229,7 @@ export class UserRepository extends Repository { pendingReceivedFollowRequestsCount: FollowRequests.count({ followeeId: user.id }), + integrations: profile?.integrations, } : {}), ...(opts.includeSecrets ? { -- cgit v1.2.3-freya