端点
团队
On this page
团队管理相关操作。
接口
POST /api/teams
GET /api/teams
POST /api/teams/join
POST /api/teams/:teamId
GET /api/teams/:teamId
DELETE /api/teams/:teamId
POST /api/teams/:teamId/users
GET /api/teams/:teamId/users
GET /api/teams/:teamId/users/:userId
POST /api/teams/:teamId/users/:userId
DELETE /api/teams/:teamId/users/:userId
GET /api/teams/:teamId/websites
创建一个团队。
参数
name
: (字符串) 团队名称。示例响应
[
{
"accessCode": "xxwtoY8pzKjDIUQi",
"createdAt": "2023-04-13T20:22:55.756Z",
"id": "ae09865c-ff82-4c43-acba-dd1e6540cda5",
"name": "我的团队",
"updatedAt": null
},
{
"createdAt": "2023-04-13T20:22:55.756Z",
"id": "a9b1fbbc-ac22-4422-aa74-b2a2751ad87d",
"role": "团队拥有者",
"teamId": "ae09865c-ff82-4c43-acba-dd1e6540cda5",
"updatedAt": null,
"userId": "1a457e1a-121a-11ee-be56-0242ac120002"
}
]
返回所有团队。
参数
query
: (可选字符串) 搜索文本。page
: (可选数字,默认1) 确定页码。pageSize
: (可选字符串) 确定返回多少结果。orderBy
: (可选字符串,默认 name
) 按列名排序。示例响应
[
{
"accessCode": "xxwtoY8pzKjDIUQi",
"createdAt": "2023-04-13T20:22:55.756Z",
"id": "ae09865c-ff82-4c43-acba-dd1e6540cda5",
"name": "我的团队",
"teamUser": [
{
"createdAt": "2023-04-13T20:22:55.756Z",
"id": "a9b1fbbc-ac22-4422-aa74-b2a2751ad87d",
"role": "团队拥有者",
"teamId": "ae09865c-ff82-4c43-acba-dd1e6540cda5",
"updatedAt": null,
"user": { "id": "1a457e1a-121a-11ee-be56-0242ac120002", "username": "admin" },
"userId": "1a457e1a-121a-11ee-be56-0242ac120002"
}
]
}
]
加入一个团队。
参数
accessCode
: (字符串) 团队的访问代码。示例响应
[
{
"accessCode": "xxwtoY8pzKjDIUQi",
"createdAt": "2023-04-13T20:22:55.756Z",
"id": "ae09865c-ff82-4c43-acba-dd1e6540cda5",
"name": "我的团队",
"teamUser": [
{
"createdAt": "2023-04-13T20:22:55.756Z",
"id": "a9b1fbbc-ac22-4422-aa74-b2a2751ad87d",
"role": "团队拥有者",
"teamId": "ae09865c-ff82-4c43-acba-dd1e6540cda5",
"updatedAt": null,
"user": { "id": "1a457e1a-121a-11ee-be56-0242ac120002", "username": "admin" },
"userId": "1a457e1a-121a-11ee-be56-0242ac120002"
}
]
}
]
获取一个团队。
参数
无
示例响应
{
"id": "ae09865c-ff82-4c43-acba-dd1e6540cda5",
"name": "我的团队2",
"accessCode": "LCh5C6SyoHCFcxaJ",
"createdAt": "2023-04-13T20:22:55.756Z",
"updatedAt": "2023-04-13T20:59:10.335Z"
}
更新一个团队。
参数
name
: (可选字符串) 团队名称。accessCode
: (可选字符串) 团队访问代码。示例响应
{
"accessCode": "xxwtoY8pzKjDIUQi",
"createdAt": "2023-04-13T20:22:55.756Z",
"id": "ae09865c-ff82-4c43-acba-dd1e6540cda5",
"name": "我的团队",
"updatedAt": null
}
删除一个团队。
参数
无
示例响应
ok
获取属于一个团队的所有用户。
参数
query
: (可选字符串) 搜索文本。page
: (可选数字,默认1) 确定页码。pageSize
: (可选字符串) 确定返回多少结果。orderBy
: (可选字符串,默认 name
) 按列名排序。示例响应
[
{
"id": "a9b1fbbc-ac22-4422-aa74-b2a2751ad87d",
"teamId": "ae09865c-ff82-4c43-acba-dd1e6540cda5",
"userId": "1a457e1a-121a-11ee-be56-0242ac120002",
"role": "团队拥有者",
"createdAt": "2023-04-13T20:22:55.756Z",
"updatedAt": null,
"user": {
"id": "1a457e1a-121a-11ee-be56-0242ac120002",
"username": "admin"
}
}
]
将用户添加到团队。
参数
userId
: 要添加的用户的ID。role
: 用户将添加的角色(member
或view-only
)。示例响应
{
"id": "a9b1fbbc-ac22-4422-aa74-b2a2751ad87d",
"teamId": "ae09865c-ff82-4c43-acba-dd1e6540cda5",
"userId": "1a457e1a-121a-11ee-be56-0242ac120002",
"role": "团队拥有者",
"createdAt": "2023-04-13T20:22:55.756Z",
"updatedAt": null
}
获取属于一个团队的用户。
参数
无
示例响应
{
"id": "a9b1fbbc-ac22-4422-aa74-b2a2751ad87d",
"teamId": "ae09865c-ff82-4c43-acba-dd1e6540cda5",
"userId": "1a457e1a-121a-11ee-be56-0242ac120002",
"role": "团队拥有者",
"createdAt": "2023-04-13T20:22:55.756Z",
"updatedAt": null
}
更新用户在团队中的角色。
参数
role
: 用户将添加的角色(member
或view-only
)。示例响应
ok
从团队中移除用户。
参数
无
示例响应
ok
获取属于一个团队的所有网站。
参数
query
: (可选字符串) 搜索文本。page
: (可选数字,默认1) 确定页码。pageSize
: (可选字符串) 确定返回多少结果。orderBy
: (可选字符串,默认 name
) 按列名排序。示例响应
[
{
"id": "40743097-fb48-411c-98bb-efb2aa7d3946",
"name": "网站",
"domain": "website.com",
"shareId": "C36MKJqBlRT9UQgq",
"resetAt": "2023-10-25T17:29:44.340Z",
"userId": "a36560ed-e21c-4ed9-84aa-c86654460cae",
"createdAt": "2022-10-07T18:58:52.435Z",
"updatedAt": "2022-10-25T17:29:44.410Z",
"deletedAt": null,
"teamWebsite": [
{
"id": "40743097-fb48-411c-98bb-efb2aa7d3946",
"teamId": "66c8f57c-dec0-46d1-b267-886833d78982",
"websiteId": "40723097-fb48-411c-98bb-efb2ca7d3946",
"createdAt": "2022-10-15T16:51:44.711Z",
"team": {
"id": "66c8f87c-dec0-46d1-b267-886833d78982",
"name": "Caoboys",
"accessCode": "4bwY3JoHUXcKUiMP",
"createdAt": "2022-04-03T05:50:28.601Z",
"updatedAt": "2022-09-06T17:08:25.585Z",
"teamUser": [
{
"id": "3509ece6-3f7d-4a45-8842-2c070f1138e3",
"teamId": "66c8f87c-dec0-46d1-b267-886833d78982",
"userId": "a36560ed-e21c-4ed9-84aa-c86654460cae",
"role": "团队拥有者",
"createdAt": "2022-04-03T05:50:28.601Z",
"updatedAt": null
}
]
}
}
],
"user": {
"id": "a36560ed-e21c-4ed9-84aa-c86654460cae",
"username": "admin@website.com"
}
}
]