-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #249 from TogetherCrew/239-new-apis-for-communitie…
…s-and-platforms Community Centric to development
- Loading branch information
Showing
108 changed files
with
6,077 additions
and
5,410 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
# env vars | ||
src/config/dev.env | ||
src/config/test.env | ||
*.env | ||
|
||
# compiled output | ||
/lib | ||
|
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,9 @@ | ||
{ | ||
"lastRun": "1702287534517-migrate-to-cc.ts", | ||
"migrations": [ | ||
{ | ||
"title": "1702287534517-migrate-to-cc.ts", | ||
"timestamp": 1702475464508 | ||
} | ||
] | ||
} |
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,33 @@ | ||
import { Types } from 'mongoose'; | ||
import { Community } from '@togethercrew.dev/db'; | ||
|
||
interface CommunityFixture { | ||
_id: Types.ObjectId; | ||
name: string; | ||
avatarURL?: string; | ||
users?: Types.ObjectId[]; | ||
platforms?: Types.ObjectId[]; | ||
} | ||
|
||
|
||
export const communityOne: CommunityFixture = { | ||
_id: new Types.ObjectId(), | ||
name: "Community Alpha", | ||
avatarURL: "path/to/avatar1.png", | ||
}; | ||
|
||
export const communityTwo: CommunityFixture = { | ||
_id: new Types.ObjectId(), | ||
name: "Community Beta", | ||
}; | ||
|
||
export const communityThree: CommunityFixture = { | ||
_id: new Types.ObjectId(), | ||
name: "Community Teta", | ||
}; | ||
|
||
export const insertCommunities = async function <Type>(communities: Array<Type>) { | ||
for (const community of communities) { | ||
await Community.create(community); | ||
} | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
// import { Guild } from "@togethercrew.dev/db"; | ||
// import { userOne, userTwo } from "../user.fixture"; | ||
// import { Types } from "mongoose" | ||
|
||
// export const discordResponseGuildOne = { | ||
// id: "681946187490000901", | ||
// name: "guildOne", | ||
// icon: "947f3e19e6e36a2679c6fe854b79a601", | ||
// owner: false, | ||
// permissions: 2147483647, | ||
// features: [ | ||
// "APPLICATION_COMMAND_PREMISSION_V2" | ||
// ], | ||
// Permission_new: "4398046511103" | ||
// }; | ||
|
||
// export const discordResponseGuildTwo = { | ||
// id: "681946187490000902", | ||
// name: "guildTwo", | ||
// icon: "947f3e19e6e36a2679c6fe854b79a602", | ||
// owner: false, | ||
// permissions: 104189505, | ||
// features: [ | ||
// "APPLICATION_COMMAND_PREMISSION_V2" | ||
// ], | ||
// Permission_new: "1071698529857" | ||
// }; | ||
|
||
// export const discordResponseGuildThree = { | ||
// id: "681946187490000902", | ||
// name: "guildTwo", | ||
// icon: "947f3e19e6e36a2679c6fe854b79a602", | ||
// owner: false, | ||
// permissions: 1342178320, | ||
// features: [ | ||
// "APPLICATION_COMMAND_PREMISSION_V2" | ||
// ], | ||
// Permission_new: "1071698529857" | ||
// }; | ||
|
||
// export const guildOne = { | ||
// _id: new Types.ObjectId(), | ||
// guildId: "681946187490000901", | ||
// user: userOne.discordId, | ||
// name: 'guildOne', | ||
// isDisconnected: false, | ||
// isInProgress: true, | ||
// icon: 'IconOne' | ||
// } | ||
|
||
// export const guildTwo = { | ||
// _id: new Types.ObjectId(), | ||
// guildId: "681946187490000803", | ||
// user: userOne.discordId, | ||
// name: 'guildTwo', | ||
// isDisconnected: true, | ||
// isInProgress: false, | ||
// icon: 'IconTwo' | ||
|
||
// } | ||
|
||
// export const guildThree = { | ||
// _id: new Types.ObjectId(), | ||
// guildId: "681946187490000802", | ||
// user: userTwo.discordId, | ||
// name: 'guildThree', | ||
// isDisconnected: true, | ||
// isInProgress: false, | ||
// icon: 'IconThree' | ||
|
||
// } | ||
|
||
// export const guildFour = { | ||
// _id: new Types.ObjectId(), | ||
// guildId: "681946187490000801", | ||
// user: userTwo.discordId, | ||
// name: 'guildFour', | ||
// isDisconnected: false, | ||
// isInProgress: true, | ||
// icon: 'IconFour' | ||
// } | ||
|
||
// export const guildFive = { | ||
// _id: new Types.ObjectId(), | ||
// guildId: "681946187490000999", | ||
// user: userOne.discordId, | ||
// name: 'guildFive', | ||
// isDisconnected: false, | ||
// isInProgress: true, | ||
// icon: 'IconFive', | ||
// selectedChannels: [ | ||
// { | ||
// channelId: '987654321098765432', | ||
// channelName: 'Channel 1' | ||
// }, | ||
// { | ||
// channelId: '234567890123456789', | ||
// channelName: 'Channel 2' | ||
// }, | ||
// { | ||
// channelId: '345678901234567000', | ||
// channelName: 'Channel 4' | ||
// }, | ||
// ] | ||
// } | ||
|
||
|
||
// export const insertGuilds = async function <Type>(guilds: Array<Type>) { | ||
// await Guild.insertMany(guilds.map((guild) => (guild))); | ||
// }; | ||
|
||
|
13 changes: 8 additions & 5 deletions
13
__tests__/fixtures/discord.roles.fixture.ts → __tests__/fixtures/discord/roles.fixture.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 |
---|---|---|
@@ -1,33 +1,36 @@ | ||
import { IRole } from '@togethercrew.dev/db'; | ||
import { Connection } from 'mongoose'; | ||
|
||
export const role1: IRole = { | ||
export const discordRole1: IRole = { | ||
roleId: '652345789987654321', | ||
name: 'Admin', | ||
color: 0xFF0000, | ||
deletedAt: null | ||
}; | ||
|
||
export const role2: IRole = { | ||
export const discordRole2: IRole = { | ||
roleId: '987654321123456789', | ||
name: 'Moderator', | ||
color: 0x00FF00, | ||
deletedAt: null | ||
}; | ||
|
||
export const role3: IRole = { | ||
export const discordRole3: IRole = { | ||
roleId: '123456789987654321', | ||
name: 'Member', | ||
color: 0x0000FF, | ||
deletedAt: null | ||
}; | ||
|
||
export const role4: IRole = { | ||
export const discordRole4: IRole = { | ||
roleId: '123456789987654399', | ||
name: 'Member', | ||
color: 0x0000FF, | ||
deletedAt: new Date() | ||
}; | ||
|
||
export const insertRoles = async function <Type>(roles: Array<Type>, connection: Connection) { | ||
await connection.models.Role.insertMany(roles.map((role) => (role))); | ||
for (const role of roles) { | ||
await connection.models.Role.create(role); | ||
} | ||
}; |
Oops, something went wrong.