feat: init
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
@company_id = bcfe2f79-8e81-42a3-b551-3a32d49b2b4c
|
||||
@workspace_id = 3328552c-5ccd-4172-b84a-d876d56aa71b
|
||||
@baseURL = http://localhost:3000
|
||||
@channelsURL = {{baseURL}}/internal/services/channels/v1/companies/{{company_id}}/workspaces/{{workspace_id}}
|
||||
@directChannelsURL = {{baseURL}}/internal/services/channels/v1/companies/{{company_id}}/workspaces/direct
|
||||
|
||||
### Login as user 1
|
||||
|
||||
# @name login
|
||||
GET {{baseURL}}/api/auth/login
|
||||
|
||||
@authTokenUser1 = {{login.response.body.token}}
|
||||
@currentUserId1 = {{login.response.body.user.id}}
|
||||
|
||||
### Login as user 2
|
||||
|
||||
# @name login2
|
||||
GET {{baseURL}}/api/auth/login
|
||||
|
||||
@authTokenUser2 = {{login2.response.body.token}}
|
||||
@currentUserId2 = {{login2.response.body.user.id}}
|
||||
|
||||
### User 1 creates a public channel
|
||||
|
||||
# @name createChannel
|
||||
POST {{channelsURL}}/channels
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authTokenUser1}}
|
||||
|
||||
{
|
||||
"resource": {
|
||||
"name": "A public channel",
|
||||
"icon": "twake logo",
|
||||
"description": "This channel allow twake's team to chat easily",
|
||||
"channel_group": "twake",
|
||||
"visibility": "public",
|
||||
"is_default": true,
|
||||
"archived": false
|
||||
}
|
||||
}
|
||||
|
||||
### Get the public channel
|
||||
|
||||
@getId = {{createChannel.response.body.resource.id}}
|
||||
|
||||
GET {{channelsURL}}/channels/{{getId}}
|
||||
Authorization: Bearer {{authTokenUser1}}
|
||||
|
||||
### Get all channel members
|
||||
|
||||
GET {{channelsURL}}/channels/{{getId}}/members?websockets=true
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authTokenUser1}}
|
||||
|
||||
|
||||
### The user 2 joins the public channel, this should be OK
|
||||
|
||||
POST {{channelsURL}}/channels/{{getId}}/members
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authTokenUser2}}
|
||||
|
||||
{
|
||||
"resource": {
|
||||
"user_id": "{{currentUserId2}}"
|
||||
}
|
||||
}
|
||||
|
||||
### Get all channel members, there are now 2 members
|
||||
|
||||
GET {{channelsURL}}/channels/{{getId}}/members?websockets=true
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authTokenUser1}}
|
||||
|
||||
### User 1 lists his channels
|
||||
|
||||
GET {{channelsURL}}/channels?mine=true
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authTokenUser1}}
|
||||
|
||||
### User 2 lists his channels
|
||||
|
||||
GET {{channelsURL}}/channels?mine=true
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authTokenUser2}}
|
||||
|
||||
### User 2 leaves the channel
|
||||
|
||||
DELETE {{channelsURL}}/channels/{{getId}}/members/{{currentUserId2}}
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authTokenUser2}}
|
||||
|
||||
### Get all channel members, there are now 1 member, the initial one
|
||||
|
||||
GET {{channelsURL}}/channels/{{getId}}/members?websockets=true
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authTokenUser1}}
|
||||
|
||||
### List channels as user 2, current channel appears since it is public
|
||||
|
||||
GET {{channelsURL}}/channels
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authTokenUser2}}
|
||||
|
||||
### User 2 list his public channels, current channel does not appear since he left it
|
||||
|
||||
GET {{channelsURL}}/channels?mine=true
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer {{authTokenUser2}}
|
||||
Reference in New Issue
Block a user