feat: add guilds and channels CRUD (#14)

This commit is contained in:
Divlo
2022-03-05 18:22:30 +01:00
committed by GitHub
parent 9f56a10305
commit 780788d682
50 changed files with 6459 additions and 9039 deletions

View File

@ -0,0 +1,14 @@
import { Handler } from '../../handler'
import { channelExample, channelExample2 } from '../channel'
export const deleteChannelWithChannelIdHandler: Handler = {
method: 'DELETE',
url: `/channels/${channelExample.id}`,
response: {
statusCode: 200,
body: {
...channelExample,
defaultChannelId: channelExample2.id
}
}
}

View File

@ -1,5 +1,5 @@
import { Handler } from '../../handler'
import { channelExample } from '../channel'
import { channelExample, channelExample2 } from '../channel'
export const getChannelWithChannelIdHandler: Handler = {
method: 'GET',
@ -11,3 +11,14 @@ export const getChannelWithChannelIdHandler: Handler = {
}
}
}
export const getChannelWithChannelIdHandler2: Handler = {
method: 'GET',
url: `/channels/${channelExample2.id}`,
response: {
statusCode: 200,
body: {
channel: channelExample2
}
}
}

View File

@ -0,0 +1,15 @@
import { Handler } from '../../handler'
import { channelExample, channelExample2 } from '../channel'
export const putChannelWithChannelIdHandler: Handler = {
method: 'PUT',
url: `/channels/${channelExample.id}`,
response: {
statusCode: 200,
body: {
...channelExample,
name: 'New channel name',
defaultChannelId: channelExample2.id
}
}
}

View File

@ -0,0 +1,15 @@
import { guildExample } from '../../guild'
import { Handler } from '../../../handler'
import { channelExample, channelExample2 } from '../../../channels/channel'
export const postChannelsWithGuildIdHandler: Handler = {
method: 'POST',
url: `/guilds/${guildExample.id}/channels`,
response: {
statusCode: 200,
body: {
...channelExample2,
defaultChannelId: channelExample.id
}
}
}

View File

@ -0,0 +1,13 @@
import { Handler } from '../../handler'
import { guildExample } from '../guild'
export const deleteGuildWithGuildIdHandler: Handler = {
method: 'DELETE',
url: `/guilds/${guildExample.id}`,
response: {
statusCode: 200,
body: {
...guildExample
}
}
}

View File

@ -13,3 +13,18 @@ export const getGuildMemberWithGuildIdHandler: Handler = {
}
}
}
export const getGuildMemberNotOwnerWithGuildIdHandler: Handler = {
method: 'GET',
url: `/guilds/${guildExample.id}`,
response: {
statusCode: 200,
body: {
guild: guildExample,
member: {
...memberExampleComplete,
isOwner: false
}
}
}
}

View File

@ -0,0 +1,19 @@
import { guildExample } from '../../guild'
import { Handler } from '../../../handler'
import { memberExampleComplete } from '../../../members/member'
import { channelExample } from '../../../channels/channel'
export const postMembersWithGuildIdHandler: Handler = {
method: 'POST',
url: `/guilds/${guildExample.id}/members/join`,
response: {
statusCode: 201,
body: {
...memberExampleComplete,
guild: {
...guildExample,
defaultChannelId: channelExample.id
}
}
}
}

View File

@ -0,0 +1,14 @@
import { guildExample } from '../../guild'
import { Handler } from '../../../handler'
import { memberExample } from '../../../members/member'
export const deleteLeaveMembersWithGuildIdHandler: Handler = {
method: 'DELETE',
url: `/guilds/${guildExample.id}/members/leave`,
response: {
statusCode: 200,
body: {
...memberExample
}
}
}