Skip to content
kvavliak edited this page Jul 9, 2012 · 6 revisions

Each Activity has ActivityModels. For example we could have weekday cooking and weekend cooking.

The following Foreign Key apply:

activitymodels.act_id : Foreign Key to Activities

activitymodels.duration : Foreign Key to Distributions

activitymodels.startTime : Foreign Key to Distributions

activitymodels.repeatsNrOfTime : Foreign Key to Distributions

activitymodels.containsAppliances : Foreign Key to Appliances

READ Activity Models

GET /api/actmod?act_id={act_id} | index

Fetches the Activity Models of an Activity using the query parameter act_id.

Consumes: Route, Parameter

Produces: JSON

READ ActivityModel

 GET /api/actmod/{actmod_id} | show

Fetches the properties of an ActivityModel and other included entities (names and ids) i.e. Distribution.

Consumes: Route

Produces: JSON

{ "success": true, "message": "Activity Model created successfully", "objectCreated": { "name": "Cooking Model5", "type": "Coocking", "description": "Bla bla5", "shiftable": true, "day_type": "working", "act_id": "4ff5bca7e4b0082c63d08dfb", "containsAppliances": [ "4ff5bca7e4b0082c63d08df9" ], "duration": "4ff5bca7e4b0082c63d08dfe", "startTime": "4ff5bca7e4b0082c63d08dfe", "repeatsNrOfTime": "4ff5bca7e4b0082c63d08dfe", "_id": { "$oid": "4ff5c44ee4b0d4da260a9a97" } } }

CREATE ActivityModel

POST /api/actmod | create

Creates a new ActivityModel for the given Activity, based on the properties filled up by the user.

Consumes: Route, JSON

{ name: "Cooking Model5", type : "Coocking", description: "Bla bla5", shiftable: true, day_type: "working", act_id: "4ff5bca7e4b0082c63d08dfb", containsAppliances : ["4ff5bca7e4b0082c63d08df9"], duration : "4ff5bca7e4b0082c63d08dfe", startTime : "4ff5bca7e4b0082c63d08dfe", repeatsNrOfTime : "4ff5bca7e4b0082c63d08dfe" }

Produces: JSON with creation status

UPDATE ActivityModel

PUT /api/actmod/{actmod_id} | update

Updates the properties of the ActivityModel after editing.

Consumes: Route, JSON: like the one in show action

Produces: JSON with update status

DELETE ActivityModel

DELETE /api/actmod/{actmod_id} | delete

Deletes the existing ActivityModel.

Consumes: Route

Produces: Delete status