- Requirements
- How to install & run
- Online API test
- Use cases
- Location
- Service Information
- User Flow
- Provider Flow
- Socketio
- Admin Flow
Open Terminal/Powershell & CD into where oseam-app is located & Run these commands
$ sudo npm install
In a new terminal, Run This command (Required for Database)
$ mongod
Then in the other terminal (where you installed the dependencies) Run this command
$ npm start
- You might not need to run as Super user (sudo)
- Don't include
$
into your commands - To access authorize location, set Authorization header with 'Bearer' + token .
- Landing.
- User select service. Example:
- Select Mowing
- Fetch mowing info (GET: /api/v1/services?name=mowing)
- User select type of service (estimatedSize, treeNumber, ect...)
- User get estimatedDuration to perform service
- If user is interested, he/she can get provider information by
- Choose the time they want
- User enter address to fetch provider nearby (POST: /api/v1/providers)
- If Geolocation is enable, get address by latlng
- Store info in local-storage for booking purpose (services, address, bookTime, estimatedDuration, wage, providerId, estimatedSize (optional), treeNumber (optional))
- If user choose booking, move to sign-up/sign-in location.
- After successfully login, progress to booking. Eg: Confirm booking with information stored in local-storage
- User is able to manage previous bookings.
- Update bookTime
- Delete booking
- User notification
- Get initial notification (GET: /api/v1/read_unotification)
- Subcribe socketIo for real-time push notification
- Landing
- Go to provider signin/signup
- Provider is notified when user book him/her to provide task through socketIO
- Provider is able to:
- View job
- Update job. Eg: startTime, endTime, completed
- Reject job. Job is auto assigned to another provider and notify by SocketIO.
- Provider notification
- Get initial notification (GET: /api/v1/read_pnotification)
- Subcribe socketIo for real-time push notification
- POST: /api/v1/latlng
- Required params: address
- GET: /api/v1/address
- Params: lat, lng
- GET: /api/v1/location
- GET: /api/v1/services
- Situational Params: name, type, duration (in milliseconds), price
- Example GET: /api/v1/services?name=mowing&type=small
- POST: /api/v1/providers
- Params: services (array), address, bookTime, estimatedDuration (calculated from service info above)
{
"dis": 0,
"obj": {
"_id": "5541c38aeca343890e031819",
"firstName": "xxx",
"lastName": "xxx",
"abn": "312132",
"address": "1 Test Avenue, South Melbourne",
"service": [
"mowing"
],
"location": {
"type": "Point",
"coordinates": [
144.954795,
-37.832925
]
},
"postcode": "3205",
"verified": false,
"stripe_account": false,
"createdAt": "2015-04-30T05:54:18.122Z",
"updatedAt": "2015-04-30T05:54:18.122Z"
}
}
- POST: /api/v1/user
- Required params: email, password
- Json response example
{
"user": {
"email": "[email protected]",
"verified": false,
"updatedAt": "2015-04-16T08:37:49.375Z",
"id": "552f74dd3917d69f0d9800ca"
}
}
* POST: /api/v1/user_login OR /api/v1/login
* Params: email, password
- Json response example
{
"user": {
"verified": false,
"createdAt": "2015-05-01T10:37:25.304Z",
"updatedAt": "2015-05-01T10:37:34.576Z",
"id": "55435765bb0bf70b1abd3683"
},
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyIjp7InZlcmlmaWVkIjpmYWxzZSwiY3JlYXRlZEF0IjoiMjAxNS0wNS0wMVQxMDozNzoyNS4zMDRaIiwidXBkYXRlZEF0IjoiMjAxNS0wNS0wMVQxMDozNzoyNS4zMDRaIiwiaWQiOiI1NTQzNTc2NWJiMGJmNzBiMWFiZDM2ODMifSwiaWF0IjoxNDMwNDc2NjU0LCJleHAiOjE0MzA1NjMwNTR9.yQtvsYFIkgMyTs7ROOSF05OiTjtSxqbaoLvLQBdqHKw"
}
* GET: /api/v1/auth/facebook
* Automatic callback at: /api/v1/auth/facebook/callback
- Json response example
{
"success": true,
"user": {
"apiProvider": "Facebook",
"verified": true,
"createdAt": "2015-04-16T08:37:49.375Z",
"updatedAt": "2015-04-16T08:37:49.375Z",
"id": "552f74dd3917d69f0d9800ca"
},
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyIjp7ImVtYWlsIjoidnVvbmduZ28ucGRAZ21haWwuY29tIiwicGFzc3dvcmQiOiIkMmEkMTAkb2dPZElEVEtrd256N3k2UXVSdDI2dTRoamI5WGpTajhtbTRuelJwaEdVaUVSYzBmZ0FyRkciLCJ2ZXJpZmllZCI6ZmFsc2UsImNyZWF0ZWRBdCI6IjIwMTUtMDQtMTZUMDg6Mzc6NDkuMzc1WiIsInVwZGF0ZWRBdCI6IjIwMTUtMDQtMTZUMDg6Mzc6NDkuMzc1WiIsImlkIjoiNTUyZjc0ZGQzOTE3ZDY5ZjBkOTgwMGNhIn0sImlhdCI6MTQyOTE3MzU2MCwiZXhwIjoxNDI5MjU5OTYwfQ.5Z_FLhf7Uvv1TO5_YOWRbRE88hF094StMpdcU3pahoE"
}
* PUT: /api/v1/user/:id
- Params: avatar (file)
* DELETE: /api/v1/user/:id
* POST: /api/v1/booking
* Required params: services (array), estimatedSize, address, bookTime (in milliseconds), estimatedDuration (in milliseconds), wage, providerId (when user selects provider)
- Additional params: postcode, lat, lng, repeat
- Json response example
{
"booking": {
"userId": "5541c4de11b496bb0e24b2fa",
"services": [
{
"name": "mowing",
"id": "5541c50911b496bb0e24b2fb"
}
],
"bookTime": 1429977804187,
"estimatedDuration": 1440000,
"providerId": "5541c49f11b496bb0e24b2f9",
"location": {
"type": "Point",
"coordinates": [
144.954795,
-37.832925
]
},
"completed": false,
"createdAt": "2015-04-30T06:00:41.779Z",
"updatedAt": "2015-04-30T06:00:41.779Z",
"id": "5541c50911b496bb0e24b2fd"
},
"services": [
[
{
"estimatedSize": "Medium",
"address": "1 Test Avenue, South Melbourne",
"wage": 30,
"providerId": "5541c49f11b496bb0e24b2f9",
"location": {
"type": "Point",
"coordinates": [
144.954795,
-37.832925
]
},
"postcode": 3205,
"name": "mowing",
"repeat": null,
"completed": false,
"createdAt": "2015-04-30T06:00:41.688Z",
"updatedAt": "2015-04-30T06:00:41.782Z",
"bookingId": "5541c50911b496bb0e24b2fd",
"id": "5541c50911b496bb0e24b2fb"
}
]
]
}
* GET: /api/v1/view_booking
- Params: completed (true or false)
[
{
"userId": "553b231b84e52c8222b105db",
"services": [
{
"name": "mowing",
"id": "553b232b84e52c8222b105dc"
}
],
"completed": false,
"createdAt": "2015-04-25T05:16:27.506Z",
"updatedAt": "2015-04-25T05:16:27.506Z",
"id": "553b232b84e52c8222b105de",
"info": [
{
"estimatedSize": "Medium",
"address": "1 Test Avenue, South Melbourne",
"bookTime": 1429977804187,
"estimatedDuration": 1440000,
"wage": 30,
"location": {
"type": "Point",
"coordinates": [
144.954795,
-37.832925
]
},
"postcode": 3205,
"providerId": "553b22da84e52c8222b105da",
"name": "mowing",
"repeat": null,
"completed": false,
"createdAt": "2015-04-25T05:16:27.500Z",
"updatedAt": "2015-04-25T05:16:27.510Z",
"bookingId": "553b232b84e52c8222b105de",
"id": "553b232b84e52c8222b105dc"
}
]
}
]
- PUT: /api/v1/booking/:id
- Params: bookTime (in milliseconds)
- DELETE: /api/v1/booking/:id
- GET: /api/v1/read_unotification
- Params: read (true/false)
- GET: /api/v1/update_unotification
* GET: /api/v1/logout
* OR: simply clear token in session or local-service
- POST: /api/v1/provider
- Required params: email, password, firstName, lastName, abn, address, service (in array),
- Additional params: businessName, postcode, lat, lng, service
- Json response example
{
"provider": {
"email": "[email protected]",
"password": "$2a$10$9ilqAUVldTFUjIEF2nJBOOOIclaEUREtLvP9FvFAO9bc8K75aZ9iu",
"firstName": "xxx",
"lastName": "xxx",
"abn": "312132",
"address": "1 Test Avenue, South Melbourne",
"service": [
"mowing"
],
"location": {
"type": "Point",
"coordinates": [
144.954795,
-37.832925
]
},
"postcode": "3205",
"verified": false,
"stripe_account": false,
"createdAt": "2015-04-25T05:15:06.945Z",
"updatedAt": "2015-04-25T05:15:06.945Z",
"id": "553b22da84e52c8222b105da"
}
}
- POST: /api/v1/provider_login OR /api/v1/login
- Parameters: email, password
- Json response example
{
"provider": {
"firstName": "vuong",
"lastName": "ngo",
"abn": "312132635hg",
"address": "1 Test Avenue, South Melbourne",
"service": [
"mowing"
],
"location": {
"type": "Point",
"coordinates": [
144.954795,
-37.832925
]
},
"postcode": 3205,
"verified": false,
"createdAt": "2015-05-01T10:37:16.217Z",
"updatedAt": "2015-05-01T10:40:33.864Z",
"id": "5543575cbb0bf70b1abd3682"
},
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJwcm92aWRlciI6eyJmaXJzdE5hbWUiOiJ2dW9uZyIsImxhc3ROYW1lIjoibmdvIiwiYWJuIjoiMzEyMTMyNjM1aGciLCJhZGRyZXNzIjoiMTYgS2VhdHMgQXZlbnVlLCBLaW5nc2J1cnkiLCJzZXJ2aWNlIjpbIm1vd2luZyJdLCJsb2NhdGlvbiI6eyJ0eXBlIjoiUG9pbnQiLCJjb29yZGluYXRlcyI6WzE0NS4wMzY0NzgsLTM3LjcxODU2NF19LCJwb3N0Y29kZSI6MzA4MywidmVyaWZpZWQiOmZhbHNlLCJjcmVhdGVkQXQiOiIyMDE1LTA1LTAxVDEwOjM3OjE2LjIxN1oiLCJ1cGRhdGVkQXQiOiIyMDE1LTA1LTAxVDEwOjM3OjE3LjYyNloiLCJpZCI6IjU1NDM1NzVjYmIwYmY3MGIxYWJkMzY4MiJ9LCJpYXQiOjE0MzA0NzY4MzMsImV4cCI6MTQzMDU2MzIzM30.IvRrC-YZjvfuv7XtHf58FgqHlK8QZabm5ONJ75lF2ek"
}
- PUT: /api/v1/provider
- Params: avatar (file)
- DELETE: /api/v1/provider/:id
- GET: /api/v1/provider_job (AUTH)
- Params: completed (true or false)
[
{
"estimatedSize": "Medium",
"address": "1 Test Avenue, South Melbourne",
"bookTime": 1429977804187,
"estimatedDuration": 1440000,
"wage": 30,
"location": {
"type": "Point",
"coordinates": [
144.954795,
-37.832925
]
},
"postcode": 3205,
"providerId": "553b22da84e52c8222b105da",
"name": "mowing",
"repeat": null,
"completed": false,
"createdAt": "2015-04-25T05:16:27.500Z",
"updatedAt": "2015-04-25T05:16:27.510Z",
"bookingId": "553b232b84e52c8222b105de",
"id": "553b232b84e52c8222b105dc"
}
]
- PUT: /api/v1/reject_job/:id (with id = bookingId)
- PUT: /api/v1/provider_mowing/:id
- Similarly: provider_leaf_removal, provider_weed_control, provider_yard_cleaning
- Params: realSize, startTime, endTime, completed
- GET: /api/v1/provider_booking/:id (with id = bookingId)
- GET: /api/v1/read_pnotification
- Params: read (true/false)
- GET: /api/v1/update_pnotification
- GET: /api/v1/logout
- OR: simply clear token in session or local-service
- EXAMPLE
<!-- Subcribe private socket connection with userId -->
var socket = io.connect('/user' + userId, {
<!-- Handshake with token to authorize user -->
'query': 'token=Bearer ' + token
});
<!-- Listen to socket -->
socket.on('notification', function(data) {
console.log(data);
<!-- Do something with data like $scope.notification = $scope.notification.concat(data) -->
});
- EXAMPLE
<!-- Subcribe private socket connection with providerId -->
var socket = io.connect('/user' + providerId, {
<!-- Handshake with token to authorize provider -->
'query': 'token=Bearer ' + token
});
socket.on('notification', function(data) {
console.log(data);
<!-- Do something with data like $scope.notification = $scope.notification.concat(data) -->
});
- EXAMPLE
var socket = io.connect('/administrator', {
<!-- Handshake with token to authorize admin -->
'query': 'token=Bearer ' + token
});
socket.on('notification', function(data) {
console.log(data);
<!-- Do something with data like $scope.notification = $scope.notification.concat(data) -->
});
- POST: /api/administrator
- Parameters: email = [email protected], password = 123456789
{
"admin": {
"createdAt": "2015-05-02T06:36:19.408Z",
"updatedAt": "2015-05-02T06:36:22.215Z",
"id": "5544706382b8d03b1c2930d4"
},
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhZG1pbiI6eyJjcmVhdGVkQXQiOiIyMDE1LTA1LTAyVDA2OjM2OjE5LjQwOFoiLCJ1cGRhdGVkQXQiOiIyMDE1LTA1LTAyVDA2OjM2OjE5LjQwOFoiLCJpZCI6IjU1NDQ3MDYzODJiOGQwM2IxYzI5MzBkNCJ9LCJpYXQiOjE0MzA1NDg1ODIsImV4cCI6MTQzMDYzNDk4Mn0.9nPheTCWhZFKI_FUohOGPcqADKwZSzwd0Q_SgvczUFs"
}
- Endpoint: /api/v1/service
- Params: name (eg: cleaning), type (eg: small, medium), duration (in milliseconds), price
- GET: /api/v1/user/:id
- GET: /api/v1/user
- GET: /api/v1/provider/:id
- GET: /api/v1/provider
- GET: /api/v1/booking/:id
- GET: /api/v1/booking
- GET: /api/v1/mowing
- PUT: /api/v1/mowing
- GET: /api/v1/read_anotification
- Params: read (true/false)
- GET: /api/v1/update_anotification
- POST: /api/v1/user_notification
- Params: userId, booking, mes
- GET: /api/v1/user_notification
- DELETE: /api/v1/user_notification/:id
- POST: /api/v1/provider_notification
- Params: userId, booking, mes
- GET: /api/v1/provider_notification
- DELETE: /api/v1/provider_notification/:id