@live-change/user-service 0.2.19 → 0.2.20

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/user-service",
3
- "version": "0.2.19",
3
+ "version": "0.2.20",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,7 +22,8 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@live-change/framework": "^0.5.10",
25
- "@live-change/relations-plugin": "^0.1.10"
25
+ "@live-change/relations-plugin": "^0.1.10",
26
+ "pluralize": "8.0.0"
26
27
  },
27
- "gitHead": "c2833a9660374ee17dd3def99fd1cdf47f6b1531"
28
+ "gitHead": "48b13d32478da797b31f73ed1d6f4271cd68b574"
28
29
  }
@@ -3,6 +3,8 @@ const App = require("@live-change/framework")
3
3
  const { PropertyDefinition, ViewDefinition, IndexDefinition, ActionDefinition, EventDefinition } = App
4
4
  const { User } = require("./model.js")
5
5
 
6
+ const pluralize = require('pluralize')
7
+
6
8
  definition.processor(function(service, app) {
7
9
 
8
10
  for(let modelName in service.models) {
@@ -28,7 +30,7 @@ definition.processor(function(service, app) {
28
30
  }
29
31
 
30
32
  if(config.ownerReadAccess) {
31
- const viewName = 'my' + modelName + 's'
33
+ const viewName = 'my' + pluralize(modelName)
32
34
  service.views[viewName] = new ViewDefinition({
33
35
  name: viewName,
34
36
  access(params, context) {
@@ -43,7 +45,7 @@ definition.processor(function(service, app) {
43
45
  })
44
46
  for(const sortField of config.sortBy || []) {
45
47
  const sortFieldUc = sortField.slice(0, 1).toUpperCase() + sortField.slice(1)
46
- const viewName = 'mySessionOrUser' + modelName + 'sBy' + sortFieldUc
48
+ const viewName = 'mySessionOrUser' + pluralize(modelName) + 'By' + sortFieldUc
47
49
  service.views[viewName] = new ViewDefinition({
48
50
  name: viewName,
49
51
  access(params, context) {
package/userItem.js CHANGED
@@ -3,6 +3,8 @@ const App = require("@live-change/framework")
3
3
  const { PropertyDefinition, ViewDefinition, IndexDefinition, ActionDefinition, EventDefinition } = App
4
4
  const { User } = require("./model.js")
5
5
 
6
+ const pluralize = require('pluralize')
7
+
6
8
  definition.processor(function(service, app) {
7
9
 
8
10
  for(let modelName in service.models) {
@@ -29,7 +31,7 @@ definition.processor(function(service, app) {
29
31
  }
30
32
 
31
33
  if(config.userReadAccess) {
32
- const viewName = 'myUser' + modelName + 's'
34
+ const viewName = 'myUser' + pluralize(modelName)
33
35
  service.views[viewName] = new ViewDefinition({
34
36
  name: viewName,
35
37
  access(params, context) {
@@ -44,7 +46,7 @@ definition.processor(function(service, app) {
44
46
  })
45
47
  for(const sortField of config.sortBy || []) {
46
48
  const sortFieldUc = sortField.slice(0, 1).toUpperCase() + sortField.slice(1)
47
- const viewName = 'myUser' + modelName + 'sBy' + sortFieldUc
49
+ const viewName = 'myUser' + pluralize(modelName) + 'By' + sortFieldUc
48
50
  service.views[viewName] = new ViewDefinition({
49
51
  name: viewName,
50
52
  access(params, context) {