nsgm-cli 1.0.21 → 1.0.25

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 (42) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +162 -162
  3. package/generation/.babelrc +9 -9
  4. package/generation/README.md +18 -18
  5. package/generation/app.js +2 -2
  6. package/generation/client/redux/template/manage/actions.ts +190 -190
  7. package/generation/client/redux/template/manage/reducers.ts +118 -118
  8. package/generation/client/redux/template/manage/types.ts +24 -24
  9. package/generation/client/service/template/manage.ts +73 -73
  10. package/generation/client/styled/layout/index.ts +13 -13
  11. package/generation/client/styled/template/manage.ts +51 -51
  12. package/generation/gitignore +3 -3
  13. package/generation/mysql.config.js +12 -12
  14. package/generation/next-env.d.ts +2 -2
  15. package/generation/next.config.js +6 -6
  16. package/generation/pages/_app.tsx +44 -44
  17. package/generation/pages/index.tsx +54 -54
  18. package/generation/pages/template/manage.tsx +280 -280
  19. package/generation/project.config.js +12 -12
  20. package/generation/server/apis/template.js +18 -18
  21. package/generation/server/modules/template/resolver.js +231 -231
  22. package/generation/server/modules/template/schema.js +33 -33
  23. package/generation/server/rest.js +20 -20
  24. package/generation/server/sql/template.sql +8 -8
  25. package/generation/tsconfig.json +1 -1
  26. package/index.js +10 -10
  27. package/lib/args.d.ts +6 -6
  28. package/lib/args.js +47 -47
  29. package/lib/generate.d.ts +3 -3
  30. package/lib/generate.js +590 -590
  31. package/lib/index.d.ts +2 -2
  32. package/lib/index.js +182 -182
  33. package/lib/server/db.d.ts +5 -5
  34. package/lib/server/db.js +47 -47
  35. package/lib/server/graphql.d.ts +7 -7
  36. package/lib/server/graphql.js +119 -119
  37. package/lib/server/plugins/date.d.ts +5 -5
  38. package/lib/server/plugins/date.js +16 -16
  39. package/mysql.config.js +14 -14
  40. package/next.config.js +210 -209
  41. package/package.json +113 -113
  42. package/project.config.js +14 -14
@@ -1,191 +1,191 @@
1
- import * as types from './types'
2
- import { getTemplateService, addTemplateService, updateTemplateService, deleteTemplateService, searchTemplateService, batchDeleteTemplateService } from '../../../service/template/manage'
3
-
4
- export const getTemplate = (page=0, pageSize=10) => (
5
- dispatch: (arg0: {
6
- type: string
7
- payload?: { template: any }
8
- }) => void
9
- ) => {
10
- dispatch({
11
- type: types.GET_TEMPLATE
12
- })
13
-
14
- getTemplateService(page, pageSize)
15
- .then((res: any) => {
16
- // console.log('action_res', res)
17
- const { data } = res
18
- dispatch({
19
- type: types.GET_TEMPLATE_SUCCEEDED,
20
- payload: {
21
- template: data.template
22
- }
23
- })
24
- })
25
- .catch(() => {
26
- dispatch({
27
- type: types.GET_TEMPLATE_FAILED
28
- })
29
- })
30
- }
31
-
32
- export const searchTemplate = (page=0, pageSize=10, data: any) => (
33
- dispatch: (arg0: {
34
- type: string
35
- payload?: { template: any }
36
- }) => void
37
- ) => {
38
- dispatch({
39
- type: types.SEARCH_TEMPLATE
40
- })
41
-
42
- searchTemplateService(page, pageSize, data)
43
- .then((res: any) => {
44
- // console.log('action_res', res)
45
- const { data:resData } = res
46
- dispatch({
47
- type: types.SEARCH_TEMPLATE_SUCCEEDED,
48
- payload: {
49
- template: resData.templateSearch
50
- }
51
- })
52
- })
53
- .catch(() => {
54
- dispatch({
55
- type: types.SEARCH_TEMPLATE_FAILED
56
- })
57
- })
58
- }
59
-
60
- export const updateSSRTemplate = (template: any) => (
61
- dispatch: (arg0: {
62
- type: string
63
- payload?: { template: any }
64
- }) => void
65
- ) => {
66
- dispatch({
67
- type: types.UPDATE_SSR_TEMPLATE,
68
- payload: {
69
- template
70
- }
71
- })
72
- }
73
-
74
- export const addTemplate = (obj:any) => (
75
- dispatch: (arg0: {
76
- type: string
77
- payload?: { template: any }
78
- }) => void
79
- ) => {
80
- dispatch({
81
- type: types.ADD_TEMPLATE
82
- })
83
-
84
- addTemplateService(obj)
85
- .then((res: any) => {
86
- // console.log('action_res', res)
87
- const { data } = res
88
- const template = {
89
- id: data.templateAdd,
90
- ...obj
91
- }
92
- dispatch({
93
- type: types.ADD_TEMPLATE_SUCCEEDED,
94
- payload: {
95
- template
96
- }
97
- })
98
- })
99
- .catch(() => {
100
- dispatch({
101
- type: types.ADD_TEMPLATE_FAILED
102
- })
103
- })
104
- }
105
-
106
- export const modTemplate = (id: number, obj: any) => (
107
- dispatch: (arg0: {
108
- type: string
109
- payload?: { template: any }
110
- }) => void
111
- ) => {
112
- dispatch({
113
- type: types.MOD_TEMPLATE
114
- })
115
-
116
- updateTemplateService(id, obj)
117
- .then((res: any) => {
118
- // console.log('action_res', res)
119
- const template = {
120
- id,
121
- ...obj
122
- }
123
- dispatch({
124
- type: types.MOD_TEMPLATE_SUCCEEDED,
125
- payload: {
126
- template
127
- }
128
- })
129
- })
130
- .catch(() => {
131
- dispatch({
132
- type: types.MOD_TEMPLATE_FAILED
133
- })
134
- })
135
- }
136
-
137
- export const delTemplate = (id: number) => (
138
- dispatch: (arg0: {
139
- type: string
140
- payload?: { id: number }
141
- }) => void
142
- ) => {
143
- dispatch({
144
- type: types.DEL_TEMPLATE
145
- })
146
-
147
- deleteTemplateService(id)
148
- .then((res: any) => {
149
- // console.log('action_res', res)
150
-
151
- dispatch({
152
- type: types.DEL_TEMPLATE_SUCCEEDED,
153
- payload: {
154
- id
155
- }
156
- })
157
- })
158
- .catch(() => {
159
- dispatch({
160
- type: types.DEL_TEMPLATE_FAILED
161
- })
162
- })
163
- }
164
-
165
- export const batchDelTemplate = (ids:any) => (
166
- dispatch: (arg0: {
167
- type: string
168
- payload?: { ids: any }
169
- }) => void
170
- ) => {
171
- dispatch({
172
- type: types.BATCH_DEL_TEMPLATE
173
- })
174
-
175
- batchDeleteTemplateService(ids)
176
- .then((res: any) => {
177
- // console.log('action_res', res)
178
-
179
- dispatch({
180
- type: types.BATCH_DEL_TEMPLATE_SUCCEEDED,
181
- payload: {
182
- ids
183
- }
184
- })
185
- })
186
- .catch(() => {
187
- dispatch({
188
- type: types.BATCH_DEL_TEMPLATE_FAILED
189
- })
190
- })
1
+ import * as types from './types'
2
+ import { getTemplateService, addTemplateService, updateTemplateService, deleteTemplateService, searchTemplateService, batchDeleteTemplateService } from '../../../service/template/manage'
3
+
4
+ export const getTemplate = (page=0, pageSize=10) => (
5
+ dispatch: (arg0: {
6
+ type: string
7
+ payload?: { template: any }
8
+ }) => void
9
+ ) => {
10
+ dispatch({
11
+ type: types.GET_TEMPLATE
12
+ })
13
+
14
+ getTemplateService(page, pageSize)
15
+ .then((res: any) => {
16
+ // console.log('action_res', res)
17
+ const { data } = res
18
+ dispatch({
19
+ type: types.GET_TEMPLATE_SUCCEEDED,
20
+ payload: {
21
+ template: data.template
22
+ }
23
+ })
24
+ })
25
+ .catch(() => {
26
+ dispatch({
27
+ type: types.GET_TEMPLATE_FAILED
28
+ })
29
+ })
30
+ }
31
+
32
+ export const searchTemplate = (page=0, pageSize=10, data: any) => (
33
+ dispatch: (arg0: {
34
+ type: string
35
+ payload?: { template: any }
36
+ }) => void
37
+ ) => {
38
+ dispatch({
39
+ type: types.SEARCH_TEMPLATE
40
+ })
41
+
42
+ searchTemplateService(page, pageSize, data)
43
+ .then((res: any) => {
44
+ // console.log('action_res', res)
45
+ const { data:resData } = res
46
+ dispatch({
47
+ type: types.SEARCH_TEMPLATE_SUCCEEDED,
48
+ payload: {
49
+ template: resData.templateSearch
50
+ }
51
+ })
52
+ })
53
+ .catch(() => {
54
+ dispatch({
55
+ type: types.SEARCH_TEMPLATE_FAILED
56
+ })
57
+ })
58
+ }
59
+
60
+ export const updateSSRTemplate = (template: any) => (
61
+ dispatch: (arg0: {
62
+ type: string
63
+ payload?: { template: any }
64
+ }) => void
65
+ ) => {
66
+ dispatch({
67
+ type: types.UPDATE_SSR_TEMPLATE,
68
+ payload: {
69
+ template
70
+ }
71
+ })
72
+ }
73
+
74
+ export const addTemplate = (obj:any) => (
75
+ dispatch: (arg0: {
76
+ type: string
77
+ payload?: { template: any }
78
+ }) => void
79
+ ) => {
80
+ dispatch({
81
+ type: types.ADD_TEMPLATE
82
+ })
83
+
84
+ addTemplateService(obj)
85
+ .then((res: any) => {
86
+ // console.log('action_res', res)
87
+ const { data } = res
88
+ const template = {
89
+ id: data.templateAdd,
90
+ ...obj
91
+ }
92
+ dispatch({
93
+ type: types.ADD_TEMPLATE_SUCCEEDED,
94
+ payload: {
95
+ template
96
+ }
97
+ })
98
+ })
99
+ .catch(() => {
100
+ dispatch({
101
+ type: types.ADD_TEMPLATE_FAILED
102
+ })
103
+ })
104
+ }
105
+
106
+ export const modTemplate = (id: number, obj: any) => (
107
+ dispatch: (arg0: {
108
+ type: string
109
+ payload?: { template: any }
110
+ }) => void
111
+ ) => {
112
+ dispatch({
113
+ type: types.MOD_TEMPLATE
114
+ })
115
+
116
+ updateTemplateService(id, obj)
117
+ .then((res: any) => {
118
+ // console.log('action_res', res)
119
+ const template = {
120
+ id,
121
+ ...obj
122
+ }
123
+ dispatch({
124
+ type: types.MOD_TEMPLATE_SUCCEEDED,
125
+ payload: {
126
+ template
127
+ }
128
+ })
129
+ })
130
+ .catch(() => {
131
+ dispatch({
132
+ type: types.MOD_TEMPLATE_FAILED
133
+ })
134
+ })
135
+ }
136
+
137
+ export const delTemplate = (id: number) => (
138
+ dispatch: (arg0: {
139
+ type: string
140
+ payload?: { id: number }
141
+ }) => void
142
+ ) => {
143
+ dispatch({
144
+ type: types.DEL_TEMPLATE
145
+ })
146
+
147
+ deleteTemplateService(id)
148
+ .then((res: any) => {
149
+ // console.log('action_res', res)
150
+
151
+ dispatch({
152
+ type: types.DEL_TEMPLATE_SUCCEEDED,
153
+ payload: {
154
+ id
155
+ }
156
+ })
157
+ })
158
+ .catch(() => {
159
+ dispatch({
160
+ type: types.DEL_TEMPLATE_FAILED
161
+ })
162
+ })
163
+ }
164
+
165
+ export const batchDelTemplate = (ids:any) => (
166
+ dispatch: (arg0: {
167
+ type: string
168
+ payload?: { ids: any }
169
+ }) => void
170
+ ) => {
171
+ dispatch({
172
+ type: types.BATCH_DEL_TEMPLATE
173
+ })
174
+
175
+ batchDeleteTemplateService(ids)
176
+ .then((res: any) => {
177
+ // console.log('action_res', res)
178
+
179
+ dispatch({
180
+ type: types.BATCH_DEL_TEMPLATE_SUCCEEDED,
181
+ payload: {
182
+ ids
183
+ }
184
+ })
185
+ })
186
+ .catch(() => {
187
+ dispatch({
188
+ type: types.BATCH_DEL_TEMPLATE_FAILED
189
+ })
190
+ })
191
191
  }
@@ -1,118 +1,118 @@
1
- import * as types from './types'
2
- import _ from 'lodash'
3
-
4
- const initialState = {
5
- firstLoadFlag: true,
6
- template: {
7
- totalCounts: 0,
8
- items: []
9
- }
10
- }
11
-
12
- export const templateManageReducer = (state = initialState, { type, payload }) => {
13
- const { template } = state
14
- const { totalCounts, items } = template
15
- let newItems = []
16
-
17
- switch (type) {
18
- case types.UPDATE_SSR_TEMPLATE:
19
- // console.log('reducer_payload_ssr', payload)
20
- return {
21
- ...state,
22
- firstLoadFlag: true,
23
- template: payload.template
24
- }
25
- case types.GET_TEMPLATE_SUCCEEDED:
26
- // console.log('reducer_payload_get', payload)
27
- return {
28
- ...state,
29
- firstLoadFlag: false,
30
- template: payload.template
31
- }
32
- case types.SEARCH_TEMPLATE_SUCCEEDED:
33
- // console.log('reducer_payload_search', payload)
34
- return {
35
- ...state,
36
- firstLoadFlag: false,
37
- template: payload.template
38
- }
39
- case types.ADD_TEMPLATE_SUCCEEDED:
40
- // console.log('reducer_payload_add', payload)
41
- newItems = [...items]
42
- newItems.push(payload.template)
43
-
44
- // console.log('newItems-add', newItems)
45
- return {
46
- ...state,
47
- firstLoadFlag: false,
48
- template: {
49
- totalCounts: totalCounts + 1,
50
- items: newItems
51
- }
52
- }
53
- case types.MOD_TEMPLATE_SUCCEEDED:
54
- // console.log('reducer_payload_mod', payload)
55
- const modItem = payload.template
56
-
57
- _.each(items, (item, index) => {
58
- if (item.id === modItem.id) {
59
- newItems.push(modItem)
60
- } else {
61
- newItems.push(item)
62
- }
63
- })
64
-
65
- // console.log('newItems-mod', newItems)
66
- return {
67
- ...state,
68
- firstLoadFlag: false,
69
- template: {
70
- totalCounts,
71
- items: newItems
72
- }
73
- }
74
- case types.DEL_TEMPLATE_SUCCEEDED:
75
- // console.log('reducer_payload_del', payload)
76
- const delItemId = payload.id
77
-
78
- _.each(items, (item:any, index:any) => {
79
- if (item.id !== delItemId) {
80
- newItems.push(item)
81
- }
82
- })
83
-
84
- // console.log('newItems-del', newItems)
85
- return {
86
- ...state,
87
- firstLoadFlag: false,
88
- template: {
89
- totalCounts: totalCounts - 1,
90
- items: newItems
91
- }
92
- }
93
- case types.BATCH_DEL_TEMPLATE_SUCCEEDED:
94
- const delItemIds = payload.ids
95
- const allIds = _.map(_.map(items, (item) => _.pick(item, ['id'])), 'id')
96
- const diffIds = _.xor(allIds, delItemIds)
97
-
98
- // console.log('delItemIds', delItemIds, allIds, diffIds)
99
-
100
- newItems = _.filter(items, (item) => _.includes(diffIds, item.id))
101
-
102
- let newTotalCounts = totalCounts - delItemIds.length
103
- if (newTotalCounts < 0)
104
- newTotalCounts = 0
105
-
106
- // console.log('newItems-batch-del', newItems, newTotalCounts)
107
- return {
108
- ...state,
109
- firstLoadFlag: false,
110
- template: {
111
- totalCounts: newTotalCounts,
112
- items: newItems
113
- }
114
- }
115
- default:
116
- return state
117
- }
118
- }
1
+ import * as types from './types'
2
+ import _ from 'lodash'
3
+
4
+ const initialState = {
5
+ firstLoadFlag: true,
6
+ template: {
7
+ totalCounts: 0,
8
+ items: []
9
+ }
10
+ }
11
+
12
+ export const templateManageReducer = (state = initialState, { type, payload }) => {
13
+ const { template } = state
14
+ const { totalCounts, items } = template
15
+ let newItems = []
16
+
17
+ switch (type) {
18
+ case types.UPDATE_SSR_TEMPLATE:
19
+ // console.log('reducer_payload_ssr', payload)
20
+ return {
21
+ ...state,
22
+ firstLoadFlag: true,
23
+ template: payload.template
24
+ }
25
+ case types.GET_TEMPLATE_SUCCEEDED:
26
+ // console.log('reducer_payload_get', payload)
27
+ return {
28
+ ...state,
29
+ firstLoadFlag: false,
30
+ template: payload.template
31
+ }
32
+ case types.SEARCH_TEMPLATE_SUCCEEDED:
33
+ // console.log('reducer_payload_search', payload)
34
+ return {
35
+ ...state,
36
+ firstLoadFlag: false,
37
+ template: payload.template
38
+ }
39
+ case types.ADD_TEMPLATE_SUCCEEDED:
40
+ // console.log('reducer_payload_add', payload)
41
+ newItems = [...items]
42
+ newItems.push(payload.template)
43
+
44
+ // console.log('newItems-add', newItems)
45
+ return {
46
+ ...state,
47
+ firstLoadFlag: false,
48
+ template: {
49
+ totalCounts: totalCounts + 1,
50
+ items: newItems
51
+ }
52
+ }
53
+ case types.MOD_TEMPLATE_SUCCEEDED:
54
+ // console.log('reducer_payload_mod', payload)
55
+ const modItem = payload.template
56
+
57
+ _.each(items, (item, index) => {
58
+ if (item.id === modItem.id) {
59
+ newItems.push(modItem)
60
+ } else {
61
+ newItems.push(item)
62
+ }
63
+ })
64
+
65
+ // console.log('newItems-mod', newItems)
66
+ return {
67
+ ...state,
68
+ firstLoadFlag: false,
69
+ template: {
70
+ totalCounts,
71
+ items: newItems
72
+ }
73
+ }
74
+ case types.DEL_TEMPLATE_SUCCEEDED:
75
+ // console.log('reducer_payload_del', payload)
76
+ const delItemId = payload.id
77
+
78
+ _.each(items, (item:any, index:any) => {
79
+ if (item.id !== delItemId) {
80
+ newItems.push(item)
81
+ }
82
+ })
83
+
84
+ // console.log('newItems-del', newItems)
85
+ return {
86
+ ...state,
87
+ firstLoadFlag: false,
88
+ template: {
89
+ totalCounts: totalCounts - 1,
90
+ items: newItems
91
+ }
92
+ }
93
+ case types.BATCH_DEL_TEMPLATE_SUCCEEDED:
94
+ const delItemIds = payload.ids
95
+ const allIds = _.map(_.map(items, (item) => _.pick(item, ['id'])), 'id')
96
+ const diffIds = _.xor(allIds, delItemIds)
97
+
98
+ // console.log('delItemIds', delItemIds, allIds, diffIds)
99
+
100
+ newItems = _.filter(items, (item) => _.includes(diffIds, item.id))
101
+
102
+ let newTotalCounts = totalCounts - delItemIds.length
103
+ if (newTotalCounts < 0)
104
+ newTotalCounts = 0
105
+
106
+ // console.log('newItems-batch-del', newItems, newTotalCounts)
107
+ return {
108
+ ...state,
109
+ firstLoadFlag: false,
110
+ template: {
111
+ totalCounts: newTotalCounts,
112
+ items: newItems
113
+ }
114
+ }
115
+ default:
116
+ return state
117
+ }
118
+ }
@@ -1,25 +1,25 @@
1
- export const GET_TEMPLATE = 'GET_TEMPLATE'
2
- export const GET_TEMPLATE_SUCCEEDED = 'GET_TEMPLATE_SUCCEEDED'
3
- export const GET_TEMPLATE_FAILED = 'GET_TEMPLATE_FAILED'
4
-
5
- export const ADD_TEMPLATE = 'ADD_TEMPLATE'
6
- export const ADD_TEMPLATE_SUCCEEDED = 'ADD_TEMPLATE_SUCCEEDED'
7
- export const ADD_TEMPLATE_FAILED = 'ADD_TEMPLATE_FAILED'
8
-
9
- export const MOD_TEMPLATE = 'MOD_TEMPLATE'
10
- export const MOD_TEMPLATE_SUCCEEDED = 'MOD_TEMPLATE_SUCCEEDED'
11
- export const MOD_TEMPLATE_FAILED = 'MOD_TEMPLATE_FAILED'
12
-
13
- export const DEL_TEMPLATE = 'DEL_TEMPLATE'
14
- export const DEL_TEMPLATE_SUCCEEDED = 'DEL_TEMPLATE_SUCCEEDED'
15
- export const DEL_TEMPLATE_FAILED = 'DEL_TEMPLATE_FAILED'
16
-
17
- export const UPDATE_SSR_TEMPLATE = 'UPDATE_SSR_TEMPLATE'
18
-
19
- export const SEARCH_TEMPLATE = 'SEARCH_TEMPLATE'
20
- export const SEARCH_TEMPLATE_SUCCEEDED = 'SEARCH_TEMPLATE_SUCCEEDED'
21
- export const SEARCH_TEMPLATE_FAILED = 'SEARCH_TEMPLATE_FAILED'
22
-
23
- export const BATCH_DEL_TEMPLATE = 'BATCH_DEL_TEMPLATE'
24
- export const BATCH_DEL_TEMPLATE_SUCCEEDED = 'BATCH_DEL_TEMPLATE_SUCCEEDED'
1
+ export const GET_TEMPLATE = 'GET_TEMPLATE'
2
+ export const GET_TEMPLATE_SUCCEEDED = 'GET_TEMPLATE_SUCCEEDED'
3
+ export const GET_TEMPLATE_FAILED = 'GET_TEMPLATE_FAILED'
4
+
5
+ export const ADD_TEMPLATE = 'ADD_TEMPLATE'
6
+ export const ADD_TEMPLATE_SUCCEEDED = 'ADD_TEMPLATE_SUCCEEDED'
7
+ export const ADD_TEMPLATE_FAILED = 'ADD_TEMPLATE_FAILED'
8
+
9
+ export const MOD_TEMPLATE = 'MOD_TEMPLATE'
10
+ export const MOD_TEMPLATE_SUCCEEDED = 'MOD_TEMPLATE_SUCCEEDED'
11
+ export const MOD_TEMPLATE_FAILED = 'MOD_TEMPLATE_FAILED'
12
+
13
+ export const DEL_TEMPLATE = 'DEL_TEMPLATE'
14
+ export const DEL_TEMPLATE_SUCCEEDED = 'DEL_TEMPLATE_SUCCEEDED'
15
+ export const DEL_TEMPLATE_FAILED = 'DEL_TEMPLATE_FAILED'
16
+
17
+ export const UPDATE_SSR_TEMPLATE = 'UPDATE_SSR_TEMPLATE'
18
+
19
+ export const SEARCH_TEMPLATE = 'SEARCH_TEMPLATE'
20
+ export const SEARCH_TEMPLATE_SUCCEEDED = 'SEARCH_TEMPLATE_SUCCEEDED'
21
+ export const SEARCH_TEMPLATE_FAILED = 'SEARCH_TEMPLATE_FAILED'
22
+
23
+ export const BATCH_DEL_TEMPLATE = 'BATCH_DEL_TEMPLATE'
24
+ export const BATCH_DEL_TEMPLATE_SUCCEEDED = 'BATCH_DEL_TEMPLATE_SUCCEEDED'
25
25
  export const BATCH_DEL_TEMPLATE_FAILED = 'BATCH_DEL_TEMPLATE_FAILED'