Skip to content

Commit 46c69e6

Browse files
authored
Merge pull request #158 from imcaizheng/add-members-invites-proxy-endpoints
Create 3 proxy endpoints for project members/invites
2 parents 9533a0d + 80ac1cf commit 46c69e6

File tree

7 files changed

+512
-14
lines changed

7 files changed

+512
-14
lines changed

app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ app.use((err, req, res, next) => {
7676

7777
if (err.response) {
7878
// extract error message from V3/V5 API
79-
errorResponse.message = _.get(err, 'response.body.result.content') || _.get(err, 'response.body.message')
79+
errorResponse.message = _.get(err, 'response.body.result.content.message') || _.get(err, 'response.body.message')
8080
}
8181

8282
if (_.isUndefined(errorResponse.message)) {

docs/Topcoder-bookings-api.postman_collection.json

Lines changed: 130 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4527,7 +4527,136 @@
45274527
}
45284528
},
45294529
"response": []
4530-
}
4530+
},
4531+
{
4532+
"name": "GET /taas-teams/:id/members",
4533+
"request": {
4534+
"method": "GET",
4535+
"header": [
4536+
{
4537+
"key": "Authorization",
4538+
"type": "text",
4539+
"value": "Bearer {{token_bookingManager}}"
4540+
},
4541+
{
4542+
"key": "Content-Type",
4543+
"type": "text",
4544+
"value": "application/json"
4545+
}
4546+
],
4547+
"url": {
4548+
"raw": "{{URL}}/taas-teams/:id/members?role=customer&fields=id,userId,role,createdAt,updatedAt,createdBy,updatedBy,handle,photoURL,workingHourStart,workingHourEnd,timeZone,email",
4549+
"host": [
4550+
"{{URL}}"
4551+
],
4552+
"path": [
4553+
"taas-teams",
4554+
":id",
4555+
"members"
4556+
],
4557+
"query": [
4558+
{
4559+
"key": "role",
4560+
"value": "customer"
4561+
},
4562+
{
4563+
"key": "fields",
4564+
"value": "id,userId,role,createdAt,updatedAt,createdBy,updatedBy,handle,photoURL,workingHourStart,workingHourEnd,timeZone,email"
4565+
}
4566+
],
4567+
"variable": [
4568+
{
4569+
"key": "id",
4570+
"value": "16705"
4571+
}
4572+
]
4573+
}
4574+
},
4575+
"response": []
4576+
},
4577+
{
4578+
"name": "GET /taas-teams/:id/invites",
4579+
"request": {
4580+
"method": "GET",
4581+
"header": [
4582+
{
4583+
"key": "Authorization",
4584+
"type": "text",
4585+
"value": "Bearer {{token_bookingManager}}"
4586+
},
4587+
{
4588+
"key": "Content-Type",
4589+
"type": "text",
4590+
"value": "application/json"
4591+
}
4592+
],
4593+
"url": {
4594+
"raw": "{{URL}}/taas-teams/:id/invites?fields=createdAt,deletedAt,role,updatedBy,createdBy,id,projectId,userId,email,deletedBy,updatedAt,status",
4595+
"host": [
4596+
"{{URL}}"
4597+
],
4598+
"path": [
4599+
"taas-teams",
4600+
":id",
4601+
"invites"
4602+
],
4603+
"query": [
4604+
{
4605+
"key": "fields",
4606+
"value": "createdAt,deletedAt,role,updatedBy,createdBy,id,projectId,userId,email,deletedBy,updatedAt,status"
4607+
}
4608+
],
4609+
"variable": [
4610+
{
4611+
"key": "id",
4612+
"value": "16705"
4613+
}
4614+
]
4615+
}
4616+
},
4617+
"response": []
4618+
},
4619+
{
4620+
"name": "DELETE /taas-teams/:id/members/:projectMemberId",
4621+
"request": {
4622+
"method": "DELETE",
4623+
"header": [
4624+
{
4625+
"key": "Authorization",
4626+
"type": "text",
4627+
"value": "Bearer {{token_bookingManager}}"
4628+
},
4629+
{
4630+
"key": "Content-Type",
4631+
"type": "text",
4632+
"value": "application/json"
4633+
}
4634+
],
4635+
"url": {
4636+
"raw": "{{URL}}/taas-teams/:id/members/:projectMemberId",
4637+
"host": [
4638+
"{{URL}}"
4639+
],
4640+
"path": [
4641+
"taas-teams",
4642+
":id",
4643+
"members",
4644+
":projectMemberId"
4645+
],
4646+
"variable": [
4647+
{
4648+
"key": "id",
4649+
"value": "16705"
4650+
},
4651+
{
4652+
"key": "projectMemberId",
4653+
"value": "14327"
4654+
}
4655+
]
4656+
}
4657+
},
4658+
"response": []
4659+
}
45314660
]
45324661
},
45334662
{

docs/swagger.yaml

Lines changed: 179 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,6 +1580,177 @@ paths:
15801580
application/json:
15811581
schema:
15821582
$ref: '#/components/schemas/Error'
1583+
get:
1584+
tags:
1585+
- Teams
1586+
description: |
1587+
Search members in a team.
1588+
Serves as a proxy endpoint for `GET /projects/{projectId}/members`.
1589+
security:
1590+
- bearerAuth: []
1591+
parameters:
1592+
- in: path
1593+
name: id
1594+
required: true
1595+
schema:
1596+
type: integer
1597+
description: The team/project id.
1598+
- in: query
1599+
name: fields
1600+
required: false
1601+
schema:
1602+
type: string
1603+
description: Fields to be returned.
1604+
- in: query
1605+
name: role
1606+
required: false
1607+
schema:
1608+
type: string
1609+
description: Filtered by a specific role.
1610+
responses:
1611+
'200':
1612+
description: OK
1613+
content:
1614+
application/json:
1615+
schema:
1616+
type: array
1617+
items:
1618+
$ref: '#/components/schemas/ProjectMember'
1619+
'400':
1620+
description: Bad request
1621+
content:
1622+
application/json:
1623+
schema:
1624+
$ref: '#/components/schemas/Error'
1625+
'401':
1626+
description: Not authenticated
1627+
content:
1628+
application/json:
1629+
schema:
1630+
$ref: '#/components/schemas/Error'
1631+
'403':
1632+
description: Not authorized
1633+
content:
1634+
application/json:
1635+
schema:
1636+
$ref: '#/components/schemas/Error'
1637+
'500':
1638+
description: Internal Server Error
1639+
content:
1640+
application/json:
1641+
schema:
1642+
$ref: '#/components/schemas/Error'
1643+
1644+
/taas-teams/{id}/invites:
1645+
get:
1646+
tags:
1647+
- Teams
1648+
description: |
1649+
Search member invites for a team.
1650+
Serves as a proxy endpoint for `GET /projects/{projectId}/invites`.
1651+
security:
1652+
- bearerAuth: []
1653+
parameters:
1654+
- in: path
1655+
name: id
1656+
required: true
1657+
schema:
1658+
type: integer
1659+
description: The team/project id.
1660+
- in: query
1661+
name: fields
1662+
required: false
1663+
schema:
1664+
type: string
1665+
description: Fields to be returned.
1666+
responses:
1667+
'200':
1668+
description: OK
1669+
content:
1670+
application/json:
1671+
schema:
1672+
type: array
1673+
items:
1674+
$ref: '#/components/schemas/ProjectMemberInvite'
1675+
'400':
1676+
description: Bad request
1677+
content:
1678+
application/json:
1679+
schema:
1680+
$ref: '#/components/schemas/Error'
1681+
'401':
1682+
description: Not authenticated
1683+
content:
1684+
application/json:
1685+
schema:
1686+
$ref: '#/components/schemas/Error'
1687+
'403':
1688+
description: Not authorized
1689+
content:
1690+
application/json:
1691+
schema:
1692+
$ref: '#/components/schemas/Error'
1693+
'500':
1694+
description: Internal Server Error
1695+
content:
1696+
application/json:
1697+
schema:
1698+
$ref: '#/components/schemas/Error'
1699+
/taas-teams/{id}/members/{projectMemberId}:
1700+
delete:
1701+
tags:
1702+
- Teams
1703+
description: |
1704+
Remove a member from a team.
1705+
Serves as a proxy endpoint for `DELETE /projects/{projectId}/members/{id}`.
1706+
security:
1707+
- bearerAuth: []
1708+
parameters:
1709+
- in: path
1710+
name: id
1711+
required: true
1712+
schema:
1713+
type: integer
1714+
description: The team/project id.
1715+
- in: path
1716+
name: projectMemberId
1717+
required: true
1718+
schema:
1719+
type: integer
1720+
description: The id of the project member.
1721+
responses:
1722+
'204':
1723+
description: OK
1724+
'400':
1725+
description: Bad request
1726+
content:
1727+
application/json:
1728+
schema:
1729+
$ref: '#/components/schemas/Error'
1730+
'401':
1731+
description: Not authenticated
1732+
content:
1733+
application/json:
1734+
schema:
1735+
$ref: '#/components/schemas/Error'
1736+
'403':
1737+
description: Forbidden
1738+
content:
1739+
application/json:
1740+
schema:
1741+
$ref: '#/components/schemas/Error'
1742+
'404':
1743+
description: Not Found
1744+
content:
1745+
application/json:
1746+
schema:
1747+
$ref: '#/components/schemas/Error'
1748+
'500':
1749+
description: Internal Server Error
1750+
content:
1751+
application/json:
1752+
schema:
1753+
$ref: '#/components/schemas/Error'
15831754
/taas-teams/skills:
15841755
get:
15851756
tags:
@@ -2496,10 +2667,9 @@ components:
24962667
properties:
24972668
success:
24982669
type: array
2499-
description: "The handles."
2670+
description: "The members created."
25002671
items:
2501-
type: object
2502-
example: {"createdAt": "2021-02-18T19:58:50.610Z", "createdBy": -101, "email": "email@domain.com", "handle": "Scud", "id": 14155, "photoURL": "https://topcoder-dev-media.s3.amazonaws.com/member/profile/Scud-1450982908556.png", "role": "customer", "timeZone": null, "updatedAt": "2021-02-18T19:58:50.611Z", "updatedBy": -101, "userId": 1800091, "workingHourEnd": null, "workingHourStart": null}
2672+
$ref: '#/components/schemas/ProjectMember'
25032673
failed:
25042674
type: array
25052675
description: "The emails."
@@ -2525,6 +2695,12 @@ components:
25252695
type: string
25262696
description: "the email of a member"
25272697
example: 'xxx@xxx.com'
2698+
ProjectMember:
2699+
type: object
2700+
example: {"id": 14329, "userId": 40159097, "role": "customer", "createdAt": "2021-02-24T12:34:45.074Z", "updatedAt": "2021-02-24T12:34:45.075Z", "createdBy": -101, "updatedBy": -101, "handle": "tester1234", "photoURL": null, "workingHourStart": "9:00", "workingHourEnd": "17:00", "timeZone": "Asia/Kolkata", "email": "sathya.jayabal@gmail.com"}
2701+
ProjectMemberInvite:
2702+
type: object
2703+
example: {"createdAt": "2021-02-24T11:02:12.673Z", "deletedAt": null, "role": "customer", "updatedBy": -101, "createdBy": -101, "id": 3686, "projectId": 16705, "userId": 23008602, "email": null, "deletedBy": null, "updatedAt": "2021-02-24T11:02:12.674Z", "status": "pending"}
25282704
Error:
25292705
required:
25302706
- message

0 commit comments

Comments
 (0)