0.2.4 • Published 7 years ago

fh-wfm-workorder v0.2.4

Weekly downloads
63
License
MIT
Repository
github
Last release
7 years ago

FeedHenry RainCatcher workorder Build Status

This module contains a workorder model representation and its related services :

  • Backend services
  • Frontend services

Client-side usage

Setup

This module is packaged in a CommonJS format, exporting the name of the Angular namespace. The module can be included in an angular.js as follows:

angular.module('app', [
, require('fh-wfm-workorder')
...
])

Integration

Angular controller

A sync manager must first be initialized using the workorderSync.createManager(). This can be placed, for instance, in the resolve config of a ui-router controlled application.

resolve: {
  workorderManager: function(workorderSync) {
    return workorderSync.createManager();
  }
}

For a more complete example, please check the demo portal app.

Topic Subscriptions

wfm:workorders:create

Description

Creating a new Workorder

Example
var parameters = {
  workorderToCreate: {
    //A Valid JSON Object
  },
  //Optional topic unique identifier.
  topicUid: "uniquetopicid"
}

mediator.publish("wfm:workorders:create", parameters);

wfm:workorders:read

Description

Read a single Workorder

Example
var parameters = {
  id: "workorderId",
  //Optional topic unique identifier.
  topicUid: "uniquetopicid"
}

mediator.publish("wfm:workorders:read", parameters);

wfm:workorders:update

Description

Update a single Workorder

Example
var parameters = {
  workorderToUpdate: {
    ...
    id: "workorderId"
    ...
  },
  //Optional topic unique identifier.
  topicUid: "uniquetopicid"
}

mediator.publish("wfm:workorders:update", parameters);

wfm:workorders:remove

Description

Remove a single Workorder

Example
var parameters = {
  id: "workorderId",
  //Optional topic unique identifier.
  topicUid: "uniquetopicid"
}

mediator.publish("wfm:workorders:remove", parameters);

wfm:workorders:list

Description

List All Workorders

Example
var parameters = {
  //Optional topic unique identifier.
  topicUid: "uniquetopicid"
}

mediator.publish("wfm:workorders:list", parameters);

Published Topics

The following topics are published by this module. Developers are free to implement these topics subscribers, or use a module that already has these subscribers implement (E.g. the raincatcher-sync module).

TopicDescription
wfm:sync:workorders:createCreate a new item in the sync workorders collection
wfm:sync:workorders:updateUpdate an existing item in the sync workorders collection
wfm:sync:workorders:listList all items in the sync workorders collection
wfm:sync:workorders:removeRemove an existing item from the sync workorders collection
wfm:sync:workorders:readRead a single item from the sync workorders collection
wfm:sync:workorders:startStart the sync process for sync workorders collection
wfm:sync:workorders:stopStop the sync process for sync workorders collection
wfm:sync:workorders:force_syncForce a sync cycle from client to cloud for sync workorders collection

Topic Subscriptions

TopicDescription
done:wfm:sync:workorders:createA workorder was created in the workorders dataset
error:wfm:sync:workorders:createAn error occurred when creating an item in the workorders dataset.
done:wfm:sync:workorders:updateA workorder was updated in the workorders dataset
error:wfm:sync:workorders:updateAn error occurred when updating an item in the workorders dataset.
done:wfm:sync:workorders:listA list of the items in the workorders dataset completed
error:wfm:sync:workorders:listAn error occurred when listing items in the workorders dataset.
done:wfm:sync:workorders:removeA workorder was removed from the workorders dataset
error:wfm:sync:workorders:removeAn error occurred when removing an item in the workorders dataset.
done:wfm:sync:workorders:readA item was read correctly from the workorders dataset
error:wfm:sync:workorders:readAn error occurred when reading an item in the workorders dataset.
done:wfm:sync:workorders:startThe sync process started for the workorders dataset.
error:wfm:sync:workorders:startAn error occurred when starting the workorders dataset.
done:wfm:sync:workorders:stopThe sync process stopped for the workorders dataset.
error:wfm:sync:workorders:stopAn error occurred when stopping the workorders dataset sync process.
done:wfm:sync:workorders:force_syncA force sync process completed for the workorders dataset.
error:wfm:sync:workorders:force_syncAn error occurred when forcing the sync process for the workorders dataset.

Usage in an express backend

Setup

The server-side component of this RainCatcher module exports a function that takes express and mediator instances as parameters, as in:

var express = require('express')
  , app = express()
  , mbaasExpress = mbaasApi.mbaasExpress()
  , mediator = require('fh-wfm-mediator/lib/mediator')
  ;

// configure the express app
...

// setup the wfm workorder sync server
require('fh-wfm-workorder/server')(mediator, app, mbaasExpress);

Server side events

the module broadcasts, and listens for the following events

Listens forResponds with
wfm:workorder:listdone:wfm:workorder:list
wfm:workorder:readdone:wfm:workorder:read
wfm:workorder:updatedone:wfm:workorder:update
wfm:workorder:createdone:wfm:workorder:create

Integration

Check this demo cloud application

Workorder data structure example

  {
     id: 1276001,
     workflowId: '1339',
     assignee: '156340',
     type: 'Job Order',
     title: 'Footpath in disrepair',
     status: 'New',
     startTimestamp: '2015-10-22T14:00:00Z',
     address: '1795 Davie St, Vancouver, BC V6G 2M9',
     location: [49.287227, -123.141489],
     summary: 'Please remove damaged kerb and SUPPLY AND FIX 1X DROP KERB CENTRE BN 125 X 150 cart away from site outside number 3.'
  }
1.0.0-pre.1

7 years ago

0.2.4

7 years ago

0.2.4-pre.3

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.1-alpha.1

7 years ago

0.2.0

7 years ago

0.2.0-1

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.1.0-alpha.4

7 years ago

0.2.0-0

7 years ago

0.1.0-alpha.3

7 years ago

0.1.0-alpha.2

7 years ago

0.1.0-alpha.1

7 years ago

0.0.29

7 years ago

1.0.0-alpha.1

7 years ago

0.0.28-alpha.2

7 years ago

0.0.28-alpha.1

7 years ago

0.0.27

7 years ago

0.0.26

7 years ago

0.0.25

7 years ago

0.0.24

7 years ago

0.0.23

8 years ago

0.0.22

8 years ago

0.0.21

8 years ago

0.0.20

8 years ago

0.0.19

8 years ago

0.0.18

8 years ago

0.0.17

8 years ago

0.0.16

8 years ago

0.0.15

8 years ago

0.0.14

8 years ago

0.0.13

8 years ago

0.0.12

9 years ago

0.0.11

9 years ago

0.0.10

9 years ago

0.0.9

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago