Users Model

The users model has the following endpoints:

Action

Method

Resource

Description

Get users

GET

/users

Get all users of the project.

Get user

GET

/users/user_id

Get user with id user_id.

Create

POST

/users

Create a new user.

Update

POST

/users/user_id

Update user with id user_id.

Delete

DELETE

/users/user_id

Delete user with id user_id.

The users model has the following attributes:

Attribute

Type

Required

Description

Whereable

name

string

no

The user's first and/or middle name.

Yes

middle_name

string

no

The user's middle name

Yes

lastname

string

no

The user's last name.

Yes

second_lastname

string

no

The user's second lastname

email

string

no, required to create.

The user's email.

Yes

password

string

no, required to create.

The user's password, minimum 8 characteres.

No

photo

base64 string, url image or file image

no

The user's photo.

No

birthdate

date

no

The user's birthdate, with format MM/DD/YYYY (e.g. "12/31/2018")

Yes

cellphone

string

no

The user's cellphone, minimum 10 characteres.

Yes

country_phone_code

integer

no

No

address

string

no

The user's address.

Yes

address_notes

string

no

The user's address notes. (e.g "Second floor")

No

zipcode

string

no

The user's zip code/postal code.

Yes

location

json

no

The user's position. (e.g. "{"lat": 10, "lng": 10}").

No

level

integer

no

The user's role.

Yes

busy

boolean

no

The user's status (e.g. if the driver is busy with an assigned order).

Yes

available

boolean

no

The user's status (e.g. if the driver is available to assign order).

Yes

enabled

boolean

no

The user's status.

Yes

User levels

User level is used to control the access to the different functionalities by discriminating by the type of user. Users levels are listed bellow:

Level

Type of user

Description

0

Administrator

  • Full user-level access to all API endpoints.
    Example: The administrator can see all the users, businesses, orders and settings.

1

City manager

Functionality coming soon

2

Business owner

  • Access to some Admin API endpoints.
  • Access to all the Store Front API endpoints.
    Example: The store owner can see all the businesses assigned to his account and all the orders placed to any of his businesses.

3

Customer

  • Access to all the Store Front API endpoints.
    Example: The customer can see all the orders placed by him.

4

Driver

  • Access to some Admin API endpoints.
  • Access to all the Store Front API endpoints.
    Example: The driver can see all the orders assigned to his user.

5

Driver manager

Functionality coming soon