Skip to content

Commit

Permalink
Merge pull request #166 from TogetherCrew/GDrive-Support-For-Hivemind
Browse files Browse the repository at this point in the history
G-drive support for hivemind
  • Loading branch information
cyri113 authored Apr 23, 2024
2 parents 5a63455 + 00c7364 commit a209e7e
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 12 deletions.
6 changes: 1 addition & 5 deletions __tests__/unit/models/platform.model.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,8 @@ describe('Platform model', () => {
let platform: IPlatform;
beforeEach(() => {
platform = {
name: 'Discord',
name: 'google',
community: new Types.ObjectId(),
metadata: {
guildId: 'guildId',
selectedChannels: ['c1', 'c2'],
},
disconnectedAt: null,
};
});
Expand Down
2 changes: 1 addition & 1 deletion __tests__/unit/models/token.model.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('Token model', () => {
token = {
user: new Types.ObjectId(),
token: '4321',
type: 'access',
type: 'google_refresh',
expires: moment('2022-02-01 08:30:26.127Z').toDate(),
};
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@togethercrew.dev/db",
"version": "3.0.52",
"version": "3.0.53",
"description": "All interactions with DB",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
2 changes: 2 additions & 0 deletions src/config/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ export const tokenTypes = {
DISCORD_REFRESH: 'discord_refresh',
TWITTER_ACCESS: 'twitter_access',
TWITTER_REFRESH: 'twitter_refresh',
GOOGLE_ACCESS: 'google_access',
GOOGLE_REFRESH: 'google_refresh',
};
4 changes: 2 additions & 2 deletions src/interfaces/Module.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export interface IModule {
options?: {
platforms: Array<{
platform: Types.ObjectId;
name: 'discord';
name: 'discord' | 'google';
metadata?: Record<string, any>; // dynamic object since structure can change
}>;
};
Expand All @@ -15,7 +15,7 @@ export interface IModuleUpdateBody {
options?: {
platforms: Array<{
platform: Types.ObjectId;
name: 'discord';
name: 'discord' | 'google';
metadata?: Record<string, any>; // dynamic object since structure can change
}>;
};
Expand Down
4 changes: 2 additions & 2 deletions src/interfaces/Platfrom.interface.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { type Model, type Types } from 'mongoose';

export interface IPlatform {
name: string;
name: 'google' | 'discord' | 'twitter';
community: Types.ObjectId;
metadata?: Record<string, any>; // dynamic object since structure can change
disconnectedAt?: Date | null;
connectedAt?: Date | null;
}

export interface IPlatformUpdateBody {
name?: string;
name?: 'google' | 'discord' | 'twitter';
community?: Types.ObjectId;
metadata?: Record<string, any>;
disconnectedAt?: Date | null;
Expand Down
2 changes: 1 addition & 1 deletion src/models/schemas/Module.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const moduleSchema = new Schema<IModule, ModuleModel>(
name: {
type: String,
required: true,
enum: ['discord'],
enum: ['discord', 'google'],
},
},
],
Expand Down
1 change: 1 addition & 0 deletions src/models/schemas/Platform.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const platformSchema = new Schema<IPlatform, PlatformModel>(
name: {
type: String,
required: true,
enum: ['google', 'discord', 'twitter'],
},
metadata: {
type: Schema.Types.Mixed,
Expand Down

0 comments on commit a209e7e

Please sign in to comment.