0.2.4 • Published 8 years ago

fh-wfm-workorder v0.2.4

Weekly downloads
63
License
MIT
Repository
github
Last release
8 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

8 years ago

0.2.4

8 years ago

0.2.4-pre.3

8 years ago

0.2.3

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.1-alpha.1

8 years ago

0.2.0

8 years ago

0.2.0-1

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.1.0-alpha.4

8 years ago

0.2.0-0

8 years ago

0.1.0-alpha.3

8 years ago

0.1.0-alpha.2

8 years ago

0.1.0-alpha.1

8 years ago

0.0.29

8 years ago

1.0.0-alpha.1

8 years ago

0.0.28-alpha.2

8 years ago

0.0.28-alpha.1

8 years ago

0.0.27

9 years ago

0.0.26

9 years ago

0.0.25

9 years ago

0.0.24

9 years ago

0.0.23

9 years ago

0.0.22

9 years ago

0.0.21

9 years ago

0.0.20

9 years ago

0.0.19

9 years ago

0.0.18

9 years ago

0.0.17

9 years ago

0.0.16

9 years ago

0.0.15

9 years ago

0.0.14

9 years ago

0.0.13

10 years ago

0.0.12

10 years ago

0.0.11

10 years ago

0.0.10

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago