@mongoosejs/studio 0.0.22 → 0.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/backend/actions/Dashboard/getDashboard.js +18 -0
  2. package/backend/actions/Dashboard/index.js +3 -1
  3. package/backend/actions/Dashboard/updateDashboard.js +25 -0
  4. package/backend/index.js +6 -2
  5. package/frontend/public/app.js +357 -29758
  6. package/frontend/public/index.html +3 -0
  7. package/frontend/public/tw.css +105 -0
  8. package/frontend/src/api.js +12 -0
  9. package/frontend/src/create-document/create-document.html +20 -1
  10. package/frontend/src/create-document/create-document.js +13 -27
  11. package/frontend/src/dashboard/dashboard.html +13 -4
  12. package/frontend/src/dashboard/dashboard.js +25 -11
  13. package/frontend/src/dashboard/edit-dashboard/edit-dashboard.html +5 -0
  14. package/frontend/src/dashboard/edit-dashboard/edit-dashboard.js +48 -0
  15. package/frontend/src/dashboards/dashboards.html +5 -0
  16. package/frontend/src/dashboards/dashboards.js +20 -0
  17. package/frontend/src/document/document.html +4 -4
  18. package/frontend/src/document/document.js +4 -0
  19. package/frontend/src/edit-array/edit-array.html +1 -7
  20. package/frontend/src/edit-array/edit-array.js +27 -9
  21. package/frontend/src/edit-default/edit-default.html +1 -1
  22. package/frontend/src/index.js +2 -1
  23. package/frontend/src/models/models.css +0 -2
  24. package/frontend/src/models/models.js +0 -4
  25. package/frontend/src/routes.js +5 -0
  26. package/mongoosejs-studio-0.0.16.tgz +0 -0
  27. package/package.json +1 -6
  28. package/frontend/dist/app.js +0 -160
  29. package/frontend/dist/tw.css +0 -595
  30. package/frontend/src/dashboard-details/dashboard-details.html +0 -8
  31. package/frontend/src/dashboard-details/dashboard-details.js +0 -10
  32. package/logs/COUNT_20230524-154120-151469/operation.log +0 -8
  33. package/logs/COUNT_20230524-154408-077670/operation.log +0 -22
  34. package/logs/COUNT_20230524-154414-431706/operation.log +0 -8
  35. package/logs/COUNT_20230524-155000-297076/operation.log +0 -8
  36. package/logs/LOAD_20230524-155832-351763/checkpoint.csv +0 -1
  37. package/logs/LOAD_20230524-155832-351763/operation.log +0 -23
@@ -0,0 +1,18 @@
1
+ 'use strict';
2
+ const Archetype = require('archetype');
3
+
4
+ const GetDashboardParams = new Archetype({
5
+ dashboardId: {
6
+ $type: 'string',
7
+ $required: true
8
+ }
9
+ }).compile('GetDashboardParams');
10
+
11
+ module.exports = ({ db }) => async function getDashboard(params) {
12
+ const { dashboardId } = new GetDashboardParams(params);
13
+ const Dashboard = db.model('__Studio_Dashboard');
14
+
15
+ const dashboard = await Dashboard.findOne({ _id: dashboardId });
16
+
17
+ return { dashboard }
18
+ };
@@ -1,3 +1,5 @@
1
1
  'use strict';
2
2
 
3
- exports.getDashboards = require('./getDashboards');
3
+ exports.getDashboard = require('./getDashboard');
4
+ exports.getDashboards = require('./getDashboards');
5
+ exports.updateDashboard = require('./updateDashboard');
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ const Archetype = require('archetype');
4
+
5
+ const UpdateDashboardParams = new Archetype({
6
+ dashboardId: {
7
+ $type: 'string',
8
+ $required: true
9
+ },
10
+ code: {
11
+ $type: 'string',
12
+ $required: true
13
+ }
14
+ }).compile('UpdateDashboardParams');
15
+
16
+ module.exports = ({ db }) => async function updateDashboard(params) {
17
+ const { dashboardId, code } = new UpdateDashboardParams(params);
18
+
19
+ const Dashboard = db.models[`__Studio_Dashboard`];
20
+
21
+ const doc = await Dashboard.
22
+ findByIdAndUpdate(dashboardId, { code }, { sanitizeFilter: true, returnDocument: 'after', overwriteImmutable: true });
23
+
24
+ return { doc };
25
+ };
package/backend/index.js CHANGED
@@ -9,8 +9,12 @@ const dashboardSchema = require('./db/dashboardSchema');
9
9
  module.exports = function backend(db) {
10
10
  db = db || mongoose.connection;
11
11
 
12
- db.model('__Studio_Dashboard', dashboardSchema, '__studio_dashboards');
13
-
12
+ const Dashboard = db.model('__Studio_Dashboard', dashboardSchema, '__studio_dashboards');
13
+ const doc = new Dashboard({
14
+ name: 'Test',
15
+ code: 'Test Code'
16
+ });
17
+ doc.save().then(res => console.log(res))
14
18
  const actions = applySpec(Actions, { db });
15
19
  return actions;
16
20
  };