@things-factory/operato-hub 4.3.236 → 4.3.238

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/config.development.js +106 -78
  2. package/dist-server/graphql/resolvers/synchronization/powrup-pack-order.js +121 -0
  3. package/dist-server/graphql/resolvers/synchronization/powrup-pack-order.js.map +1 -0
  4. package/dist-server/routers/internal/apis/create-bizplace.js +7 -6
  5. package/dist-server/routers/internal/apis/create-bizplace.js.map +1 -1
  6. package/dist-server/routers/internal/apis/create-company.js +5 -6
  7. package/dist-server/routers/internal/apis/create-company.js.map +1 -1
  8. package/dist-server/routers/internal/apis/create-partner.js +9 -9
  9. package/dist-server/routers/internal/apis/create-partner.js.map +1 -1
  10. package/dist-server/routers/internal/apis/create-user.js +2 -2
  11. package/dist-server/routers/internal/apis/create-user.js.map +1 -1
  12. package/dist-server/routers/internal/apis/invite-user.js +7 -7
  13. package/dist-server/routers/internal/apis/invite-user.js.map +1 -1
  14. package/dist-server/routers/internal/apis/terminate-partner.js +7 -7
  15. package/dist-server/routers/internal/apis/terminate-partner.js.map +1 -1
  16. package/dist-server/routers/internal/apis/terminate-user.js +7 -7
  17. package/dist-server/routers/internal/apis/terminate-user.js.map +1 -1
  18. package/dist-server/routers/internal/apis/update-bizplace.js +2 -2
  19. package/dist-server/routers/internal/apis/update-bizplace.js.map +1 -1
  20. package/dist-server/routers/internal/apis/update-company.js +4 -8
  21. package/dist-server/routers/internal/apis/update-company.js.map +1 -1
  22. package/dist-server/routers/internal/apis/update-user.js +1 -1
  23. package/dist-server/routers/internal/apis/update-user.js.map +1 -1
  24. package/dist-server/routers/internal/powrup-router.js +17 -17
  25. package/dist-server/routers/internal/powrup-router.js.map +1 -1
  26. package/dist-server/routers/internal/utils/params.js +34 -59
  27. package/dist-server/routers/internal/utils/params.js.map +1 -1
  28. package/package.json +51 -50
  29. package/server/graphql/resolvers/synchronization/powrup-pack-order.ts +156 -0
  30. package/server/routers/internal/apis/create-bizplace.ts +7 -6
  31. package/server/routers/internal/apis/create-company.ts +5 -6
  32. package/server/routers/internal/apis/create-partner.ts +9 -9
  33. package/server/routers/internal/apis/create-user.ts +2 -2
  34. package/server/routers/internal/apis/invite-user.ts +7 -7
  35. package/server/routers/internal/apis/terminate-partner.ts +7 -7
  36. package/server/routers/internal/apis/terminate-user.ts +7 -7
  37. package/server/routers/internal/apis/update-bizplace.ts +2 -2
  38. package/server/routers/internal/apis/update-company.ts +4 -9
  39. package/server/routers/internal/apis/update-user.ts +1 -1
  40. package/server/routers/internal/powrup-router.ts +17 -17
  41. package/server/routers/internal/utils/params.ts +34 -59
  42. package/translations/ja.json +69 -0
@@ -1,14 +1,14 @@
1
1
  import Router from 'koa-router'
2
2
  import { EntityManager, getConnection } from 'typeorm'
3
3
 
4
- import { Integration } from '@things-factory/integration-base'
4
+ import { Powrup } from '@things-factory/integration-powrup'
5
5
  import { Domain } from '@things-factory/shell'
6
6
 
7
7
  import * as API from './apis'
8
8
  import { validationMiddleware } from './middlewares/validation-middleware'
9
9
  import { ApiError, ApiErrorHandler, throwInternalServerError } from './utils/error-util'
10
10
 
11
- const debug = require('debug')('things-factory:integration-accounting:xilnex-router')
11
+ const debug = require('debug')('things-factory:operato-hub:powrup-router')
12
12
 
13
13
  export const powrupRouter = new Router()
14
14
 
@@ -17,7 +17,7 @@ powrupRouter.post('/internal/account/create-user', validationMiddleware, async (
17
17
  await getConnection().transaction(async (tx: EntityManager) => {
18
18
  const { body } = context.request
19
19
 
20
- await getIntegration(context, null, tx)
20
+ await getPowrup(context, null, tx)
21
21
 
22
22
  let data = await API.createUser(body, context, tx)
23
23
 
@@ -36,7 +36,7 @@ powrupRouter.post('/internal/account/update-user', validationMiddleware, async (
36
36
  await getConnection().transaction(async (tx: EntityManager) => {
37
37
  const { body } = context.request
38
38
 
39
- await getIntegration(context, null, tx)
39
+ await getPowrup(context, null, tx)
40
40
 
41
41
  let data = await API.updateUser(body, context, tx)
42
42
 
@@ -55,7 +55,7 @@ powrupRouter.post('/internal/account/create-company', validationMiddleware, asyn
55
55
  await getConnection().transaction(async (tx: EntityManager) => {
56
56
  const { body } = context.request
57
57
 
58
- await getIntegration(context, null, tx)
58
+ await getPowrup(context, null, tx)
59
59
 
60
60
  let data = await API.createCompany(body, context, tx)
61
61
 
@@ -91,7 +91,7 @@ powrupRouter.post('/internal/account/create-bizplace', validationMiddleware, asy
91
91
  await getConnection().transaction(async (tx: EntityManager) => {
92
92
  const { body } = context.request
93
93
 
94
- await getIntegration(context, null, tx)
94
+ await getPowrup(context, null, tx)
95
95
 
96
96
  let data = await API.createBizplace(body, context, tx)
97
97
 
@@ -110,7 +110,7 @@ powrupRouter.post('/internal/account/update-bizplace', validationMiddleware, asy
110
110
  await getConnection().transaction(async (tx: EntityManager) => {
111
111
  const { body } = context.request
112
112
 
113
- await getIntegration(context, null, tx)
113
+ await getPowrup(context, null, tx)
114
114
 
115
115
  let data = await API.updateBizplace(body, context, tx)
116
116
 
@@ -128,7 +128,7 @@ powrupRouter.post('/internal/account/create-partner', validationMiddleware, asyn
128
128
  try {
129
129
  await getConnection().transaction(async (tx: EntityManager) => {
130
130
  const { body } = context.request
131
- await getIntegration(context, null, tx)
131
+ await getPowrup(context, null, tx)
132
132
 
133
133
  let data = await API.createPartner(body, context, tx)
134
134
 
@@ -146,7 +146,7 @@ powrupRouter.post('/internal/account/terminate-partner', validationMiddleware, a
146
146
  try {
147
147
  await getConnection().transaction(async (tx: EntityManager) => {
148
148
  const { body } = context.request
149
- await getIntegration(context, null, tx)
149
+ await getPowrup(context, null, tx)
150
150
 
151
151
  let data = await API.terminatePartner(body, context, tx)
152
152
 
@@ -164,7 +164,7 @@ powrupRouter.post('/internal/account/invite-user', validationMiddleware, async (
164
164
  try {
165
165
  await getConnection().transaction(async (tx: EntityManager) => {
166
166
  const { body } = context.request
167
- await getIntegration(context, null, tx)
167
+ await getPowrup(context, null, tx)
168
168
 
169
169
  let data = await API.inviteUser(body, context, tx)
170
170
 
@@ -182,7 +182,7 @@ powrupRouter.post('/internal/account/terminate-user', validationMiddleware, asyn
182
182
  try {
183
183
  await getConnection().transaction(async (tx: EntityManager) => {
184
184
  const { body } = context.request
185
- await getIntegration(context, null, tx)
185
+ await getPowrup(context, null, tx)
186
186
 
187
187
  let data = await API.terminateUser(body, context, tx)
188
188
 
@@ -205,7 +205,7 @@ powrupRouter.get('/warehouse/get', async (context, next) => {
205
205
  throw new ApiError('E01', apiKey)
206
206
  }
207
207
 
208
- await getIntegration(context, apiKey, tx)
208
+ await getPowrup(context, apiKey, tx)
209
209
 
210
210
  if (!subdomain) {
211
211
  throw new ApiError('E01', subdomain)
@@ -232,13 +232,13 @@ powrupRouter.get('/warehouse/get', async (context, next) => {
232
232
  }
233
233
  })
234
234
 
235
- async function getIntegration(context, apiKey, tx) {
236
- const integration: Integration = await tx.getRepository(Integration).findOne({
237
- where: { name: apiKey || context.request.body.apiKey }
235
+ async function getPowrup(context, apiKey, tx) {
236
+ const powrup: Powrup = await tx.getRepository(Powrup).findOne({
237
+ where: { apiKey: apiKey || context.request.body.apiKey }
238
238
  })
239
239
 
240
- if (integration) {
241
- context.state.integration = integration
240
+ if (powrup) {
241
+ context.state.powrup = powrup
242
242
  } else {
243
243
  throw new ApiError('E04', 'apiKey')
244
244
  }
@@ -1,48 +1,23 @@
1
1
  export const params = {
2
- 'create-user': ['refUserId', 'name', 'description', 'email', 'password', 'salt', 'status'],
3
- 'update-user': ['email', 'name', 'description', 'password', 'salt', 'status'],
4
- 'create-company': [
5
- 'refCompanyId',
6
- 'userEmail',
7
- 'name',
8
- 'description',
9
- 'brn',
10
- 'address',
11
- 'postalCode',
12
- 'type',
13
- 'status'
14
- ],
15
- 'update-company': [
16
- 'userEmail',
17
- 'refCompanyId',
18
- 'name',
19
- 'description',
20
- 'brn',
21
- 'address',
22
- 'postalCode',
23
- 'type',
24
- 'status'
25
- ],
26
- 'create-bizplace': [
27
- 'refBizplaceId',
28
- 'name',
29
- 'description',
30
- 'address',
31
- 'postalCode',
32
- 'latlng',
33
- 'extType',
34
- 'refCompanyId',
35
- 'userEmail'
36
- ],
37
- 'update-bizplace': ['refBizplaceId', 'name', 'description', 'address', 'postalCode', 'latlng', 'extType'],
38
- 'create-partner': ['refBizplaceId', 'partnerRefBizplaceId', 'userEmail'],
39
- 'terminate-partner': ['refBizplaceId', 'partnerRefBizplaceId'],
40
- 'invite-user': ['userEmail', 'refBizplaceId'],
41
- 'terminate-user': ['userEmail', 'refBizplaceId']
2
+ 'create-user': ['id', 'name', 'description', 'email', 'password', 'salt', 'status'],
3
+ 'update-user': ['id', 'name', 'description', 'password', 'salt', 'status'],
4
+ 'create-company': ['userId', 'id', 'name', 'description', 'brn', 'address', 'postalCode', 'type', 'status'],
5
+ 'update-company': ['userId', 'id', 'name', 'description', 'brn', 'address', 'postalCode', 'type', 'status'],
6
+ 'create-bizplace': ['id', 'name', 'description', 'address', 'postalCode', 'latlng', 'extType', 'companyId', 'userId'],
7
+ 'update-bizplace': ['id', 'name', 'description', 'address', 'postalCode', 'latlng', 'extType'],
8
+ 'create-partner': ['bizplaceId', 'partnerBizplaceId', 'userId'],
9
+ 'terminate-partner': ['bizplaceId', 'partnerBizplaceId'],
10
+ 'invite-user': ['userId', 'bizplaceId'],
11
+ 'terminate-user': ['userId', 'bizplaceId']
42
12
  }
43
13
 
44
14
  export const reqParams = {
45
15
  'create-user': [
16
+ {
17
+ name: 'id',
18
+ required: true,
19
+ type: 'field'
20
+ },
46
21
  {
47
22
  name: 'name',
48
23
  required: true,
@@ -61,113 +36,113 @@ export const reqParams = {
61
36
  ],
62
37
  'update-user': [
63
38
  {
64
- name: 'email',
39
+ name: 'id',
65
40
  required: true,
66
41
  type: 'field'
67
42
  }
68
43
  ],
69
44
  'create-company': [
70
45
  {
71
- name: 'name',
46
+ name: 'id',
72
47
  required: true,
73
48
  type: 'field'
74
49
  },
75
50
  {
76
- name: 'refCompanyId',
51
+ name: 'name',
77
52
  required: true,
78
53
  type: 'field'
79
54
  },
80
55
  {
81
- name: 'userEmail',
56
+ name: 'userId',
82
57
  required: true,
83
58
  type: 'field'
84
59
  }
85
60
  ],
86
61
  'update-company': [
87
62
  {
88
- name: 'userEmail',
63
+ name: 'userId',
89
64
  required: true,
90
65
  type: 'field'
91
66
  },
92
67
  {
93
- name: 'refCompanyId',
68
+ name: 'id',
94
69
  required: true,
95
70
  type: 'field'
96
71
  }
97
72
  ],
98
73
  'create-bizplace': [
99
74
  {
100
- name: 'name',
75
+ name: 'id',
101
76
  required: true,
102
77
  type: 'field'
103
78
  },
104
79
  {
105
- name: 'userEmail',
80
+ name: 'name',
106
81
  required: true,
107
82
  type: 'field'
108
83
  },
109
84
  {
110
- name: 'refCompanyId',
85
+ name: 'userId',
111
86
  required: true,
112
87
  type: 'field'
113
88
  },
114
89
  {
115
- name: 'refBizplaceId',
90
+ name: 'companyId',
116
91
  required: true,
117
92
  type: 'field'
118
93
  }
119
94
  ],
120
95
  'update-bizplace': [
121
96
  {
122
- name: 'refBizplaceId',
97
+ name: 'id',
123
98
  required: true,
124
99
  type: 'field'
125
100
  }
126
101
  ],
127
102
  'create-partner': [
128
103
  {
129
- name: 'refBizplaceId',
104
+ name: 'bizplaceId',
130
105
  required: true,
131
106
  type: 'field'
132
107
  },
133
108
  {
134
- name: 'partnerRefBizplaceId',
109
+ name: 'partnerBizplaceId',
135
110
  required: true,
136
111
  type: 'field'
137
112
  }
138
113
  ],
139
114
  'terminate-partner': [
140
115
  {
141
- name: 'refBizplaceId',
116
+ name: 'bizplaceId',
142
117
  required: true,
143
118
  type: 'field'
144
119
  },
145
120
  {
146
- name: 'partnerRefBizplaceId',
121
+ name: 'partnerBizplaceId',
147
122
  required: true,
148
123
  type: 'field'
149
124
  }
150
125
  ],
151
126
  'invite-user': [
152
127
  {
153
- name: 'userEmail',
128
+ name: 'userId',
154
129
  required: true,
155
130
  type: 'field'
156
131
  },
157
132
  {
158
- name: 'refBizplaceId',
133
+ name: 'bizplaceId',
159
134
  required: true,
160
135
  type: 'field'
161
136
  }
162
137
  ],
163
138
  'terminate-user': [
164
139
  {
165
- name: 'userEmail',
140
+ name: 'userId',
166
141
  required: true,
167
142
  type: 'field'
168
143
  },
169
144
  {
170
- name: 'refBizplaceId',
145
+ name: 'bizplaceId',
171
146
  required: true,
172
147
  type: 'field'
173
148
  }
@@ -0,0 +1,69 @@
1
+ {
2
+ "button.product_sync": "[jp]sync product",
3
+ "button.select": "[jp]select",
4
+
5
+ "field.bundle_qty": "[jp]bundle qty",
6
+ "field.packing_type": "[jp]packing type",
7
+ "field.parent_product_ref": "[jp]parent product ref",
8
+ "field.picking_strategy": "[jp]picking strategy",
9
+ "field.uom": "[jp]uom",
10
+ "field.uom_value": "[jp]uom value",
11
+
12
+ "label.client_id": "クライアントID",
13
+ "label.company": "会社",
14
+ "label.factory": "工場",
15
+ "label.push_data_source": "[jp]push data source",
16
+ "label.redirect_uri": "リダイレクションuri",
17
+ "label.state": "状態",
18
+
19
+ "text.are_you_sure_to_sync_product": "商品を同期化しますか?",
20
+ "text.attachment_info_not_valid": "添付ファイル情報が無効です",
21
+ "text.nothing_to_sync": "[jp]no data available for synchronisation",
22
+ "text.please_wait": "少々お待ちください.",
23
+ "text.product_sync_to_accounting": "[jp]synchronising product to accounting platform",
24
+ "text.success": "成功",
25
+
26
+ "error.company not found": "会社が見つかりません.",
27
+ "error.eta date is invalid": "[jp] eta date is invalid",
28
+ "error.failed to fetch inventory": "[jp] failed to fetch inventory",
29
+ "error.operato marketplace store not found": "[jp] operato marketplace store not found",
30
+ "error.no inventories found for x with batch ID y": "[jp] no inventories found for {x} with batch ID {y}",
31
+ "error.no delivery information found in contact point": "[jp] no delivery information found in contact point",
32
+ "error.invalid release qty for x": "[jp] invalid release qty for {x}",
33
+ "error.required param x not found": "[jp] required param {x} not found",
34
+ "error.store id not found": "[jp] store id not found",
35
+ "error.sku code (x) not exist": "[jp] sku code {x} not exist",
36
+ "error.invalid body request format": "[jp] invalid body request format",
37
+ "error.warehouse id not found": "[jp] warehouse id not found",
38
+ "error.failed to find it": "{it}を見つかりません.",
39
+ "error.no body": "リクエスト ボディがありません.",
40
+ "error.not allowed accessing": "許可されていないアクセスです.",
41
+ "error.not valid pattern of type": "正しい{type}形式ではありません.",
42
+ "error.required parameters not found": "必須パラメータが見つかりません. {parameters}",
43
+ "error.value is empty": "{value}の値が存在しません.",
44
+ "error.x already exists in y": "{x}が既に{y}に存在します.",
45
+ "label.owner": "管理者",
46
+ "label.partner": "partner",
47
+ "label.retail": "小売店",
48
+ "label.upload_template": "upload template",
49
+ "label.user": "ユーザー",
50
+ "label.warehouse": "倉庫",
51
+ "text.cannot_delete": "削除できません.",
52
+ "text.do_you_want_to_invite_x": "{x}を招待しますか?",
53
+ "text.invalid_bundle_qty_for_item_number": "[jp]invalid bundle qty for item #{number}",
54
+ "text.please_select_template_type": "テンプレート タイプを選択してください.",
55
+ "text.transfer_completed": "転送を完了しました.",
56
+ "text.transform_to_x": "{x}に変更",
57
+ "text.user_deleted_successfully": "正常にユーザーを削除しました.",
58
+ "text.x_cannot_delete": "{x}は削除できません.",
59
+ "text.contact_type_does_not_exist": "[jp]contact type does not exist",
60
+ "error.warehouse not found": "倉庫が見つかりません.",
61
+ "error.warehouse not found in the company": "会社内で倉庫を見つかりません.",
62
+
63
+ "title.create_template": "テンプレート作成",
64
+ "title.completed": "完了しました",
65
+ "title.document_template_management": "テンプレート管理",
66
+ "title.owner_transfer": "ビジネスオーナーを移転する",
67
+ "title.sync_direction": "[jp]sync direction",
68
+ "title.upload_document_template": "テンプレート アップロード"
69
+ }