Rough in characteristic types, add meas optgroups

This commit is contained in:
Matthew Dillon 2015-06-16 15:47:29 -08:00
parent f17707fb6d
commit 3c1fca43b8
9 changed files with 126 additions and 20 deletions

View file

@ -0,0 +1,81 @@
module.exports = function(app) {
var express = require('express');
var characteristicTypesRouter = express.Router();
var CHARACTERISTIC_TYPES = [
{
id: 1,
characteristicTypeName: 'Type 1',
characteristics: [1,4],
createdAt: "0001-01-01T00:00:00Z",
updatedAt: "0001-01-01T00:00:00Z",
deletedAt: null,
createdBy: 1,
updatedBy: 1,
deletedBy: null
},
{
id: 2,
characteristicTypeName: 'Type 2',
characteristics: [2,5],
createdAt: "0001-01-01T00:00:00Z",
updatedAt: "0001-01-01T00:00:00Z",
deletedAt: null,
createdBy: 1,
updatedBy: 1,
deletedBy: null
},
{
id: 3,
characteristicTypeName: 'Type 3',
characteristics: [3],
createdAt: "0001-01-01T00:00:00Z",
updatedAt: "0001-01-01T00:00:00Z",
deletedAt: null,
createdBy: 1,
updatedBy: 1,
deletedBy: null
},
]
characteristicTypesRouter.get('/', function(req, res) {
var characteristics;
if (req.query.ids) {
characteristic_types = CHARACTERISTIC_TYPES.filter(function(c) {
return req.query.ids.indexOf(c.id.toString()) > -1;
});
} else {
characteristic_types = CHARACTERISTIC_TYPES;
}
res.send({
'characteristicTypes': characteristic_types
});
});
characteristicTypesRouter.post('/', function(req, res) {
res.status(201).end();
});
characteristicTypesRouter.get('/:id', function(req, res) {
var characteristic_type = CHARACTERISTIC_TYPES.filter(function(c) {
return c.id == req.params.id;
});
res.send({
'characteristicType': characteristic_type
});
});
characteristicTypesRouter.put('/:id', function(req, res) {
res.send({
'characteristicTypes': {
id: req.params.id
}
});
});
characteristicTypesRouter.delete('/:id', function(req, res) {
res.status(204).end();
});
app.use('/api/hymenobacter/characteristicTypes', characteristicTypesRouter);
};

View file

@ -6,7 +6,7 @@ module.exports = function(app) {
{
id: 1,
characteristicName: 'α-fucosidase (API ZYM)',
characteristicType: 'Type 1',
characteristicType: 1,
strains: [1,2],
measurements: [1,6],
createdAt: "0001-01-01T00:00:00Z",
@ -19,7 +19,7 @@ module.exports = function(app) {
{
id: 2,
characteristicName: 'α-glucosidase',
characteristicType: 'Type 2',
characteristicType: 2,
strains: [1,2],
measurements: [2,7],
createdAt: "0001-01-01T00:00:00Z",
@ -32,7 +32,7 @@ module.exports = function(app) {
{
id: 3,
characteristicName: 'Chloramphenicol',
characteristicType: 'Type 3',
characteristicType: 3,
strains: [1,2],
measurements: [3,8],
createdAt: "0001-01-01T00:00:00Z",
@ -45,7 +45,7 @@ module.exports = function(app) {
{
id: 4,
characteristicName: 'Bacitracin',
characteristicType: 'Type 1',
characteristicType: 1,
strains: [1,2],
measurements: [4,9],
createdAt: "0001-01-01T00:00:00Z",
@ -58,7 +58,7 @@ module.exports = function(app) {
{
id: 5,
characteristicName: 'Indole',
characteristicType: 'Type 2',
characteristicType: 2,
strains: [1,2],
measurements: [5,10],
createdAt: "0001-01-01T00:00:00Z",