|Get all||Get all messages of an order|
|Create||Add a new message to an order|
|Read||Use the last message_id to mark messages as read.|
The order message model is composed of the following attributes:
|author_id||integer||Required||The author Id, user who add the item||Yes|
|order_id||integer||Required||The order id||No|
|change||JSON||no||show the change in a json with ||No|
|source||file||no||A file to add (Now working only for image)||No|
|type||integer||no||The type of message:|
- 1 order status change
- 2 comments
- 3 images
- 4 signature 1
- 5 signature 2
|can_see||string||no||contains levels of user which can see the messages separated by comma|
|comment||string||If type 2||The text for the message||No|
|driver_id||integer||no||The driver id, if driver assigned to an order||Yes|
|ip||string||no||The IP where the message is sent from, must be a valid IP.|
Order messages restrictions
- User level 0 (Type: administrator) can write and read messages of any order.
- Users level 2 (Type: business owner) can write and read messages of all orders related to his businesses.
- Users level 3 and 4 (Type: customer and Driver) can write and read messages of orders related to this user.
- users level 0, 2 and 4, can use mode dashboard to get message as their roll
- Only users 0 an 2 can get private data which are "can_see", "ip", "user_agent" and "location"