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

Field name

Data type

Mandatory

Description

firstName

string

N

Is the first name or given name

lastName

string

N

Is the last name

name

string

N

Display name in the system

email

string

Y

Unique email of user

username

string

Y

Unique username of user

gender

string

N

Accept male, female or unknown

dateOfBirth

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

Field name

Data type

Mandatory

Description

q

string

N

Query to search

gender

string

N

Accept male, female or unknown (is keyword with ES)

status

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

Field name

Data type

Mandatory

Description

firstName

string

N

Is the first name or given name

lastName

string

N

Is the last name

name

string

N

Display name in the system

email

string

Y

Unique email of user

username

string

Y

Unique username of user

gender

string

N

Accept male, female or unknown

dateOfBirth

string

N

For age (mandatory rule over 18)

status

string

Y

Accept active, inactive

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

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

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

Field name

Data type

Mandatory

Description

Field name

Data type

Mandatory

Description

firstName

string

N

Is the first name or given name

lastName

string

N

Is the last name

name

string

N

Display name in the system

email

string

Y

Unique email of user

username

string

Y

Unique username of user

gender

string

N

Accept male, female or unknown

dateOfBirth

string

N

For age (mandatory rule over 18)

status

string

Y

Accept active, inactive

avatarId

string

N

Avatar of user

Â