From f7b6f3bed1d152f21345bcfa3334bccea614593d Mon Sep 17 00:00:00 2001 From: Behzad Rabiei <53224485+Behzad-rabiei@users.noreply.github.com> Date: Tue, 23 Apr 2024 10:19:48 +0400 Subject: [PATCH] add enums --- __tests__/unit/models/platform.model.test.ts | 2 +- src/config/tokens.ts | 2 +- src/interfaces/Platfrom.interface.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/__tests__/unit/models/platform.model.test.ts b/__tests__/unit/models/platform.model.test.ts index e339f54..1055761 100644 --- a/__tests__/unit/models/platform.model.test.ts +++ b/__tests__/unit/models/platform.model.test.ts @@ -10,7 +10,7 @@ describe('Platform model', () => { let platform: IPlatform; beforeEach(() => { platform = { - name: 'Discord', + name: 'google', community: new Types.ObjectId(), metadata: { guildId: 'guildId', diff --git a/src/config/tokens.ts b/src/config/tokens.ts index 2b46265..1298cf9 100644 --- a/src/config/tokens.ts +++ b/src/config/tokens.ts @@ -6,5 +6,5 @@ export const tokenTypes = { TWITTER_ACCESS: 'twitter_access', TWITTER_REFRESH: 'twitter_refresh', GOOGLE_ACCESS: 'google_access', - GOOGLE_REFRESH: 'google_refresh' + GOOGLE_REFRESH: 'google_refresh', }; diff --git a/src/interfaces/Platfrom.interface.ts b/src/interfaces/Platfrom.interface.ts index 1fee423..59e34e0 100644 --- a/src/interfaces/Platfrom.interface.ts +++ b/src/interfaces/Platfrom.interface.ts @@ -1,7 +1,7 @@ import { type Model, type Types } from 'mongoose'; export interface IPlatform { - name: string; + name: 'google' | 'discord' | 'twitter'; community: Types.ObjectId; metadata?: Record; // dynamic object since structure can change disconnectedAt?: Date | null; @@ -9,7 +9,7 @@ export interface IPlatform { } export interface IPlatformUpdateBody { - name?: string; + name?: 'google' | 'discord' | 'twitter'; community?: Types.ObjectId; metadata?: Record; disconnectedAt?: Date | null;