Skip to content

Commit b5097e4

Browse files
committed
Added company, updated thing type
1 parent 866628e commit b5097e4

File tree

8 files changed

+886
-563
lines changed

8 files changed

+886
-563
lines changed

dist/commands/tasks/meta/index.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,47 @@ const COMMANDS = [{
4343
req: 'update-resource',
4444
resource: 'annotation',
4545
servicePath: '/annotations'
46+
}, {
47+
prop: 'create-company',
48+
req: 'create-resource',
49+
resource: 'company',
50+
servicePath: '/companies'
51+
}, {
52+
prop: 'get-company',
53+
req: 'get-resource-objectId',
54+
resource: 'company',
55+
servicePath: '/companies'
56+
}, {
57+
prop: 'list-companies',
58+
req: 'list-companies'
59+
}, {
60+
prop: 'patch-companies',
61+
req: 'patch-resources',
62+
resource: 'company',
63+
servicePath: '/companies',
64+
title: 'Companies'
65+
}, {
66+
prop: 'pull-companies',
67+
req: 'pull-resources',
68+
resource: 'company',
69+
servicePath: '/companies',
70+
title: 'Companies'
71+
}, {
72+
prop: 'push-companies',
73+
req: 'push-resources',
74+
resource: 'company',
75+
servicePath: '/companies',
76+
title: 'Companies'
77+
}, {
78+
prop: 'remove-company',
79+
req: 'remove-resource-objectId',
80+
resource: 'company',
81+
servicePath: '/companies'
82+
}, {
83+
prop: 'update-company',
84+
req: 'update-resource',
85+
resource: 'company',
86+
servicePath: '/companies'
4687
}, {
4788
prop: 'clone-dashboard',
4889
req: 'clone-dashboard'
@@ -788,6 +829,9 @@ module.exports = ctx => {
788829
items: [{
789830
lbl: 'annotation[s]',
790831
desc: 'A note with optional actions to apply against a range of datapoints'
832+
}, {
833+
lbl: 'compan(y|ies)',
834+
desc: 'An equipment manufacturer, reseller, or other assemblage of individuals'
791835
}, {
792836
lbl: 'dashboard[s]',
793837
desc: 'A collection of graphs and widgets displaying realtime data'
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
"use strict";
2+
3+
module.exports = ({
4+
conns,
5+
file,
6+
parse,
7+
style
8+
}) => {
9+
return {
10+
pre(p) {
11+
return Object.assign({
12+
query: p._sliced[0]
13+
}, p);
14+
},
15+
16+
beforeExecute(p) {
17+
parse.queryArgs(p, {
18+
$select: ['_id', 'full_name', 'name', 'company_type']
19+
});
20+
},
21+
22+
execute(p) {
23+
return conns.web.app.service('/companies').find({
24+
query: p.query
25+
}).then(res => file.saveJson(res, p, {
26+
save: p.file
27+
}));
28+
},
29+
30+
format(p, res) {
31+
return style.dataTable(res, [{
32+
name: '_id',
33+
size: 24
34+
}, {
35+
alias: 'type',
36+
name: 'company_type',
37+
size: 12
38+
}, {
39+
mode: 'fill',
40+
name: 'name',
41+
size: 24
42+
}, {
43+
mode: 'fill',
44+
name: 'full_name',
45+
size: 24
46+
}], p);
47+
}
48+
49+
};
50+
};

dist/commands/tasks/meta/list-thing-types.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module.exports = ({
1515

1616
beforeExecute(p) {
1717
parse.queryArgs(p, {
18-
$select: ['_id', 'manufacturer', 'model', 'name']
18+
$select: ['_id', 'model', 'name']
1919
});
2020
},
2121

@@ -31,18 +31,14 @@ module.exports = ({
3131
return style.dataTable(res, [{
3232
name: '_id',
3333
size: 24
34-
}, {
35-
mode: 'fill',
36-
name: 'manufacturer',
37-
size: 24
3834
}, {
3935
mode: 'fill',
4036
name: 'model',
41-
size: 18
37+
size: 24
4238
}, {
4339
mode: 'fill',
4440
name: 'name',
45-
size: 24
41+
size: 36
4642
}], p);
4743
}
4844

0 commit comments

Comments
 (0)