not-node 6.3.36 → 6.3.37

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": "not-node",
3
- "version": "6.3.36",
3
+ "version": "6.3.37",
4
4
  "description": "node complimentary part for client side notFramework.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -53,9 +53,21 @@
53
53
  "field_UUID_label": "UUID",
54
54
  "field_UUID_placeholder": "UUID",
55
55
  "crud_create_action_waiting": "Создание записи...",
56
+ "crud_create_action_form_title_": "Добавление",
57
+ "crud_create_action_form_description": "Добавить новый документ",
56
58
  "crud_read_action_waiting": "Чтение записи...",
59
+ "crud_read_action_form_title": "Детали",
60
+ "crud_read_action_form_description": "Просмотр документа",
57
61
  "crud_update_action_waiting": "Обновление записи...",
62
+ "crud_update_action_form_title": "Изменение",
63
+ "crud_update_action_form_description": "Изменение документа",
58
64
  "crud_delete_action_waiting": "Удаление записи...",
65
+ "crud_delete_action_form_title": "Удаление",
66
+ "crud_delete_action_form_description": "Удаление документа",
67
+ "crud_listAll_action_form_title": "Список всех",
68
+ "crud_listAll_action_form_description": "Список всех документов",
69
+ "crud_listAndCount_action_form_title": "Список",
70
+ "crud_listAndCount_action_form_description": "Постраничный список документов",
59
71
  "add_label": "Добавить",
60
72
  "select_from_list_label": "Выберите из списка...",
61
73
  "field_actions_label": "Действия",
@@ -93,3 +93,4 @@ class nc<%- ModelName %>Common extends notCRUD {
93
93
  }
94
94
 
95
95
  export default nc<%- ModelName %>Common;
96
+
@@ -37,35 +37,8 @@ const <%- ModelName %>GenericLogic = notNode.Generic.GenericLogic({
37
37
  module.exports.thisLogicName = MODEL_NAME;
38
38
 
39
39
  class <%- ModelName %>Logic extends <%- ModelName %>GenericLogic {
40
- <% if(Object.keys(actions).length){ %>
41
- <% for(let actionName in actions) { %>
42
- static async <%- actionName %>({ identity, data, targetId, shouldOwn }) {
43
- const action = "<%- actionName %>";
44
- Log.debug(
45
- `${MODULE_NAME}//Logic//${MODEL_NAME}//${action}`,
46
- {
47
- targetId,
48
- ip: identity.ip,
49
- root: identity.root,
50
- }
51
- );
52
- const results = await getModel().<%- actionName %>(
53
- targetId,
54
- data,
55
- identity
56
- );
57
- LogAction({
58
- action,
59
- by: identity.uid,
60
- role: identity.role,
61
- ip: identity.ip,
62
- root: identity.root,
63
- shouldOwn,
64
- });
65
- return results;
66
- }
67
- <% } %>
68
- <% } %>
40
+
69
41
  }
70
42
 
71
43
  module.exports[MODEL_NAME] = <%- ModelName %>Logic;
44
+
@@ -25,26 +25,7 @@ const <%- ModelName %>GenericRoute = notNode.Generic.GenericRoute({
25
25
  });
26
26
 
27
27
  class <%- ModelName %>Route extends <%- ModelName %>GenericRoute {
28
- <% if(Object.keys(actions).length){ %>
29
- <% for(let actionName in actions) { %>
30
- static async <%- actionName %>(
31
- req, res, next, //standart express routes objects
32
- prepared //extracted by `before` if form class exists
33
- ) {
34
- <% if (layers.includes('forms') && layers.includes('logics')){ %>
35
- return await getLogic().<%- actionName %>({ ...prepared });
36
- <% } %>
37
-
38
- <% if (layers.includes('forms') && !layers.includes('logics')){ %>
39
- return {...prepared};
40
- <% } %>
41
-
42
- <% if (!layers.includes('forms') && layers.includes('logics')){ %>
43
- return await getLogic().<%- actionName %>();
44
- <% } %>
45
- }
46
- <% } %>
47
- <% } %>
28
+ static restrictRootAccess = true;
48
29
  }
49
30
 
50
31
  module.exports = <%- ModelName %>Route;
@@ -32,21 +32,18 @@ module.exports = {
32
32
  create: {
33
33
  method: "put",
34
34
  actionSignature: ACTION_SIGNATURES.CREATE,
35
- title: "<%- ModuleName %>:form_title_create",
36
- description: "<%- ModuleName %>:form_description_create",
35
+ title: "not-node:crud_create_action_form_title",
36
+ description: "not-node:crud_create_action_form_description",
37
37
  rules: [
38
38
  {
39
39
  auth: true,
40
- root: true,
41
- fields: [
42
- <%- fields.map((entry) => `"${entry}"`).join(',') %>,
43
- <% if (ownage){ %>"owner",<% } %>
44
- ],
40
+ role: "admin",
41
+ fields: [<%- fields.map((entry) => `"${entry}"`).join(',') %>,<% if (ownage){ %>"owner",<% } %>],
45
42
  },
46
43
  {
47
44
  auth: true,
48
45
  role: ["client", "confirmed"],
49
- fields: ["title"],
46
+ fields: [<% if (fields && Array.isArray(fields)) { %><% for(let field of fields){ %>"<%- field %>",<% } %><% } %>],
50
47
  },
51
48
  ],
52
49
  data: ["record"],
@@ -57,12 +54,12 @@ module.exports = {
57
54
  get: {
58
55
  method: "get",
59
56
  actionSignature: ACTION_SIGNATURES.READ,
60
- title: "<%- ModuleName %>:form_title_details",
61
- description: "<%- ModuleName %>:form_description_details",
57
+ title: "not-node:crud_read_action_form_title",
58
+ description: "not-node:crud_read_action_form_description",
62
59
  rules: [
63
60
  {
64
61
  auth: true,
65
- root: true,
62
+ role: "admin",
66
63
  fields: [
67
64
  "_id",
68
65
  <% if (increment){ %>"<%- modelName %>ID",<% } %>
@@ -89,20 +86,9 @@ module.exports = {
89
86
  getRaw: {
90
87
  method: "get",
91
88
  actionSignature: ACTION_SIGNATURES.READ,
92
- title: "<%- ModuleName %>:form_title_details",
93
- description: "<%- ModuleName %>:form_description_details",
94
- rules: [
95
- {
96
- auth: true,
97
- root: true,
98
- fields: [
99
- "_id",
100
- <% if (increment){ %>"<%- modelName %>ID",<% } %>
101
- <%- fields.map((entry) => `"${entry}"`).join(',') %>,
102
- <% if (ownage){ %>"owner","ownerModel",<% } %>
103
- <% if (dates){ %>"createdAt","updatedAt",<% } %>
104
- ],
105
- },
89
+ title: "not-node:crud_read_action_form_title",
90
+ description: "not-node:crud_read_action_form_description",
91
+ rules: [
106
92
  {
107
93
  auth: true,
108
94
  role: "admin",
@@ -129,14 +115,14 @@ module.exports = {
129
115
  <% } %>
130
116
  <% if (Object.hasOwn(actions,'update')){ %>
131
117
  update: {
132
- title: "<%- ModuleName %>:form_title_update",
133
- actionSignature: ACTION_SIGNATURES.UPDATE,
134
- description: "<%- ModuleName %>:form_description_update",
118
+ title: "not-node:crud_update_action_form_title",
119
+ description: "not-node:crud_update_action_form_description",
120
+ actionSignature: ACTION_SIGNATURES.UPDATE,
135
121
  method: "post",
136
122
  rules: [
137
123
  {
138
124
  auth: true,
139
- root: true,
125
+ role: ["admin"],
140
126
  fields: [
141
127
  <%- fields.map((entry) => `"${entry}"`).join(',') %>,
142
128
  <% if (ownage){ %>"owner", "ownerModel",<% } %>
@@ -155,13 +141,13 @@ module.exports = {
155
141
  <% if (Object.hasOwn(actions,'delete')){ %>
156
142
  delete: {
157
143
  actionSignature: ACTION_SIGNATURES.DELETE,
158
- title: "<%- ModuleName %>:form_title_delete",
159
- description: "<%- ModuleName %>:form_description_delete",
144
+ title: "not-node:crud_delete_action_form_title",
145
+ description: "not-node:crud_delete_action_form_description",
160
146
  method: "delete",
161
147
  rules: [
162
148
  {
163
149
  auth: true,
164
- root: true,
150
+ role: ["admin"],
165
151
  },
166
152
  {
167
153
  auth: true,
@@ -176,19 +162,16 @@ module.exports = {
176
162
  listAndCount: {
177
163
  method: "get",
178
164
  actionSignature: ACTION_SIGNATURES.READ,
165
+ title: "not-node:crud_listAndCount_action_form_title",
166
+ description: "not-node:crud_listAndCount_action_form_description",
179
167
  data: ["pager", "sorter", "filter", "search"],
180
- rules: [
168
+ rules: [
181
169
  {
182
170
  auth: true,
183
- root: true,
171
+ role: ["admin"],
184
172
  },
185
173
  {
186
- auth: true,
187
- role: "admin",
188
- },
189
- {
190
- auth: true,
191
- role: ["client", "confirmed"],
174
+ auth: true
192
175
  },
193
176
  ],
194
177
  postFix: actionNamePath,
@@ -199,15 +182,14 @@ module.exports = {
199
182
  method: "get",
200
183
  actionSignature: ACTION_SIGNATURES.READ,
201
184
  data: ["record", "sorter"],
185
+ title: "not-node:crud_listAll_action_form_title",
186
+ description: "not-node:crud_listAll_action_form_description",
202
187
  fields: [
203
188
  <%- fields.map((entry) => `"${entry}"`).join(',') %>,
204
189
  <% if (dates){ %>"createdAt","updatedAt",<% } %>
205
190
  ],
206
191
  postFix: actionNamePath,
207
- rules: [
208
- {
209
- root: true,
210
- },
192
+ rules: [
211
193
  {
212
194
  auth: true,
213
195
  role: ["manager"],