Profiles
I. Architecture design
II. Public API
1. Get me
Method: GET
API endpoint:
/profiles/me
Header
{
Authorization: accessToken
}
Response success sample
{
"status": 0,
"data": {
"_id": "626a70be5c1d375fe475e3ee",
"name": "Test",
"avatar": "",
"username": "test",
"isOnline": 0,
"stats": {
"totalSubscriptions": 0,
"following": 0
},
"isPerformer": false,
"twitterConnected": false,
"googleConnected": false,
"createdAt": "2022-04-28T10:47:26.715Z",
"updatedAt": "2022-04-28T10:47:26.715Z",
"email": "email@example.com",
"firstName": "Test,
"lastName": "Test",
"status": "active",
"balance": 0,
"roles": [
"user"
],
"verifiedEmail": true,
"stripeCardIds": []
}
}
2. Update profile self
Method: PUT
API endpoint:
/profiles
Header
{ Authorization: accessToken }
Body
Field name | Data type | Mandatory | Description |
---|---|---|---|
| string | N | Is the first name or given name |
| string | N | Is the last name |
| string | N | Display name in the system |
| string | Y | Unique email of user |
| string | Y | Unique username of user |
| string | N | Accept |
| string | N | For age (mandatory rule over 18) |
avatarId | string | N | Avatar id (fileId) of user |
III. Admin API
1. Search
Method: GET
API endpoint
/admin/profiles/search
Header
Body
Field name | Data type | Mandatory | Description |
---|---|---|---|
| string | N | Query to search |
| string | N | Accept |
| string | N | ONLY admin is allowed to use search field status (isIn active, inactive, pending..) |
2. Admin create a profile
Method: POST
API endpoint
/admin/profiles
Header
Â
Body
Field name | Data type | Mandatory | Description |
---|---|---|---|
| string | N | Is the first name or given name |
| string | N | Is the last name |
| string | N | Display name in the system |
| string | Y | Unique email of user |
| string | Y | Unique username of user |
| string | N | Accept |
| string | N | For age (mandatory rule over 18) |
status | string | Y | Accept |
avatarId | string | N | Avatar of user |
3. Admin get a profile details
Method: GET
API endpoint
/admin/profiles/:id
Params
Field name | Data type | Mandatory | Description |
---|---|---|---|
id | string | Y | Unique id of profile |
Header
4. Admin update a profile
Method: PUT
API endpoint
/admin/profiles/:id
Params
Field name | Data type | Mandatory | Description |
---|---|---|---|
id | string | Y | Unique id of prfile |
Header
Â
Body
Field name | Data type | Mandatory | Description |
---|
Field name | Data type | Mandatory | Description |
---|---|---|---|
| string | N | Is the first name or given name |
| string | N | Is the last name |
| string | N | Display name in the system |
| string | Y | Unique email of user |
| string | Y | Unique username of user |
| string | N | Accept |
| string | N | For age (mandatory rule over 18) |
status | string | Y | Accept |
avatarId | string | N | Avatar of user |
Â