@things-factory/product-base 8.0.0 → 9.0.0-beta.3

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 (63) hide show
  1. package/dist-server/service/product/product-mutation.js +1 -1
  2. package/dist-server/service/product/product-mutation.js.map +1 -1
  3. package/dist-server/service/product/product-query.d.ts +1 -1
  4. package/dist-server/service/product/product-query.js +5 -5
  5. package/dist-server/service/product/product-query.js.map +1 -1
  6. package/dist-server/service/product/product-types.d.ts +2 -4
  7. package/dist-server/service/product/product-types.js +2 -10
  8. package/dist-server/service/product/product-types.js.map +1 -1
  9. package/dist-server/service/product/product.d.ts +1 -2
  10. package/dist-server/service/product/product.js +1 -6
  11. package/dist-server/service/product/product.js.map +1 -1
  12. package/dist-server/tsconfig.tsbuildinfo +1 -1
  13. package/package.json +5 -5
  14. package/server/constants/index.ts +0 -1
  15. package/server/constants/product.ts +0 -24
  16. package/server/controllers/index.ts +0 -0
  17. package/server/index.ts +0 -2
  18. package/server/middlewares/index.ts +0 -0
  19. package/server/migrations/index.ts +0 -9
  20. package/server/service/index.ts +0 -61
  21. package/server/service/product/index.ts +0 -6
  22. package/server/service/product/product-mutation.ts +0 -407
  23. package/server/service/product/product-query.ts +0 -336
  24. package/server/service/product/product-types.ts +0 -458
  25. package/server/service/product/product.ts +0 -548
  26. package/server/service/product/validate-product.ts +0 -42
  27. package/server/service/product-bundle/index.ts +0 -6
  28. package/server/service/product-bundle/product-bundle-mutation.ts +0 -140
  29. package/server/service/product-bundle/product-bundle-query.ts +0 -104
  30. package/server/service/product-bundle/product-bundle-types.ts +0 -51
  31. package/server/service/product-bundle/product-bundle.ts +0 -102
  32. package/server/service/product-bundle-setting/index.ts +0 -6
  33. package/server/service/product-bundle-setting/product-bundle-setting-mutation.ts +0 -168
  34. package/server/service/product-bundle-setting/product-bundle-setting-query.ts +0 -139
  35. package/server/service/product-bundle-setting/product-bundle-setting-types.ts +0 -41
  36. package/server/service/product-bundle-setting/product-bundle-setting.ts +0 -45
  37. package/server/service/product-combination/index.ts +0 -6
  38. package/server/service/product-combination/product-combination-mutation.ts +0 -148
  39. package/server/service/product-combination/product-combination-query.ts +0 -48
  40. package/server/service/product-combination/product-combination-type.ts +0 -50
  41. package/server/service/product-combination/product-combination.ts +0 -116
  42. package/server/service/product-combination-setting/index.ts +0 -6
  43. package/server/service/product-combination-setting/product-combination-setting-mutation.ts +0 -248
  44. package/server/service/product-combination-setting/product-combination-setting-query.ts +0 -176
  45. package/server/service/product-combination-setting/product-combination-setting-type.ts +0 -44
  46. package/server/service/product-combination-setting/product-combination-setting.ts +0 -77
  47. package/server/service/product-detail/index.ts +0 -6
  48. package/server/service/product-detail/product-detail-mutation.ts +0 -238
  49. package/server/service/product-detail/product-detail-query.ts +0 -213
  50. package/server/service/product-detail/product-detail-types.ts +0 -280
  51. package/server/service/product-detail/product-detail.ts +0 -388
  52. package/server/service/product-detail-bizplace-setting/index.ts +0 -6
  53. package/server/service/product-detail-bizplace-setting/product-detail-bizplace-setting-mutation.ts +0 -118
  54. package/server/service/product-detail-bizplace-setting/product-detail-bizplace-setting-query.ts +0 -90
  55. package/server/service/product-detail-bizplace-setting/product-detail-bizplace-setting-types.ts +0 -62
  56. package/server/service/product-detail-bizplace-setting/product-detail-bizplace-setting.ts +0 -104
  57. package/server/service/product-set/index.ts +0 -6
  58. package/server/service/product-set/product-set-mutation.ts +0 -149
  59. package/server/service/product-set/product-set-query.ts +0 -114
  60. package/server/service/product-set/product-set-types.ts +0 -45
  61. package/server/service/product-set/product-set.ts +0 -95
  62. package/server/utils/index.ts +0 -1
  63. package/server/utils/product-util.ts +0 -11
@@ -1,548 +0,0 @@
1
- import { Field, Float, ID, ObjectType } from 'type-graphql'
2
- import {
3
- Column,
4
- CreateDateColumn,
5
- Entity,
6
- Index,
7
- ManyToOne,
8
- OneToMany,
9
- PrimaryGeneratedColumn,
10
- RelationId,
11
- UpdateDateColumn
12
- } from 'typeorm'
13
-
14
- import { User } from '@things-factory/auth-base'
15
- import { Bizplace } from '@things-factory/biz-base'
16
- import { config } from '@things-factory/env'
17
- import { Routing } from '@things-factory/routing-base'
18
- import { Domain, roundTransformer } from '@things-factory/shell'
19
-
20
- import { ProductDetail } from '../product-detail/product-detail'
21
- import { ProductSet } from '../product-set/product-set'
22
-
23
- const ORMCONFIG = config.get('ormconfig', {})
24
- const DATABASE_TYPE = ORMCONFIG.type
25
-
26
- export enum pickStrategy {
27
- FIFO = 'FIFO',
28
- FEFO = 'FEFO',
29
- FMFO = 'FMFO',
30
- LIFO = 'LIFO',
31
- LOCATION = 'LOCATION'
32
- }
33
-
34
- @Entity()
35
- @Index(
36
- 'ix_product_0',
37
- (product: Product) => [product.domain, product.bizplace, product.name, product.description, product.weight],
38
- { unique: true }
39
- )
40
- @Index('ix_product_1', (product: Product) => [product.bizplace])
41
- @ObjectType()
42
- export class Product {
43
- @PrimaryGeneratedColumn('uuid')
44
- @Field(type => ID, { nullable: true })
45
- id: string
46
-
47
- @ManyToOne(type => Domain)
48
- @Field(type => Domain)
49
- domain: Domain
50
-
51
- @RelationId((product: Product) => product.domain)
52
- domainId: string
53
-
54
- @RelationId((product: Product) => product.bizplace)
55
- bizplaceId: string
56
-
57
- @RelationId((product: Product) => product.productRef)
58
- productRefId: string
59
-
60
- @RelationId((product: Product) => product.parentProductRef)
61
- parentProductRefId: string
62
-
63
- @ManyToOne(type => Bizplace)
64
- @Field()
65
- bizplace: Bizplace
66
-
67
- @Column({ default: false })
68
- @Field()
69
- isCompany: boolean
70
-
71
- @Column()
72
- @Field({ nullable: true })
73
- sku: string
74
-
75
- @Column({ nullable: true })
76
- @Field({ nullable: true })
77
- brandSku: string
78
-
79
- @Column({ nullable: true })
80
- @Field({ nullable: true })
81
- brand: string
82
-
83
- @Column({ nullable: true })
84
- @Field({ nullable: true })
85
- subBrand: string
86
-
87
- // 입고 단위
88
- @Column({ nullable: true })
89
- @Field({ nullable: true })
90
- inboundUnit?: string
91
-
92
- // 변환 kg
93
- @Column('float', { nullable: true, default: 1, transformer: roundTransformer })
94
- @Field({ nullable: true })
95
- convertWeight?: number
96
-
97
- // 박스입수
98
- @Column('float', { nullable: true, default: 0, transformer: roundTransformer })
99
- @Field({ nullable: true })
100
- boxInQty?: number
101
-
102
- // 제품군
103
- @Column({ nullable: true })
104
- @Field({ nullable: true })
105
- category?: string
106
-
107
- // 경매입고
108
- @Column({ nullable: true, default: false })
109
- @Field({ nullable: true })
110
- isAuction?: boolean
111
-
112
- // 바코드
113
- @Column({ nullable: true })
114
- @Field({ nullable: true })
115
- barcode?: string
116
-
117
- //// To be removed ////
118
- @Column({ nullable: true })
119
- @Field({ nullable: true })
120
- gtin: string
121
-
122
- //// To be removed ////
123
- @Column({ nullable: true })
124
- @Field({ nullable: true })
125
- caseGtin: string
126
-
127
- @Column({ nullable: true })
128
- @Field({ nullable: true })
129
- name: string
130
-
131
- @Column()
132
- @Field()
133
- type: string
134
-
135
- //// To be removed ////
136
- @Column({ nullable: true })
137
- @Field({ nullable: true })
138
- packingType: string
139
-
140
- @Column({ nullable: true })
141
- @Field({ nullable: true })
142
- description: string
143
-
144
- @OneToMany(type => ProductDetail, productDetails => productDetails.product, { nullable: true })
145
- @Field(type => [ProductDetail], { nullable: true })
146
- productDetails: ProductDetail[]
147
-
148
- @ManyToOne(type => Product, { nullable: true })
149
- @Field({ nullable: true })
150
- productRef: Product
151
-
152
- //// To be removed ////
153
- @ManyToOne(type => Product, { nullable: true })
154
- @Field({ nullable: true })
155
- parentProductRef: Product
156
-
157
- //// To be removed ////
158
- @OneToMany(type => Product, product => product.parentProductRef, { nullable: true })
159
- @Field(type => [Product], { nullable: true })
160
- childProducts: Product[]
161
-
162
- //// To be removed ////
163
- @Column('float', { nullable: true, transformer: roundTransformer })
164
- @Field({ nullable: true })
165
- bundleQty: number
166
-
167
- //// To be removed ////
168
- @Column({ nullable: true })
169
- @Field({ nullable: true })
170
- expirationPeriod: number
171
-
172
- //// To be removed ////
173
- @Column({ nullable: true })
174
- @Field({ nullable: true })
175
- weightUnit: string
176
-
177
- //// To be removed ////
178
- @Column('float', { nullable: true, transformer: roundTransformer })
179
- @Field({ nullable: true })
180
- weight: number
181
-
182
- //// To be removed ////
183
- @Column('float', { nullable: true, transformer: roundTransformer })
184
- @Field({ nullable: true })
185
- grossWeight: number
186
-
187
- //// To be removed ////
188
- @Column('float', { nullable: true, transformer: roundTransformer })
189
- @Field({ nullable: true })
190
- caseWeight: number
191
-
192
- //// To be removed ////
193
- @Column('float', { nullable: true, transformer: roundTransformer })
194
- @Field({ nullable: true })
195
- caseGrossWeight: number
196
-
197
- //// To be removed ////
198
- @Column('float', { nullable: true, transformer: roundTransformer })
199
- @Field({ nullable: true })
200
- density: number
201
-
202
- //// To be removed ////
203
- @Column({ nullable: true })
204
- @Field({ nullable: true })
205
- lengthUnit: string
206
-
207
- //// To be removed ////
208
- @Column('float', { nullable: true, transformer: roundTransformer })
209
- @Field({ nullable: true })
210
- costPrice: number
211
-
212
- //// To be removed ////
213
- @Column('float', { nullable: true, transformer: roundTransformer })
214
- @Field({ nullable: true })
215
- mrpPrice: number
216
-
217
- //// To be removed ////
218
- @Column('float', { nullable: true, transformer: roundTransformer })
219
- @Field({ nullable: true })
220
- sellPrice: number
221
-
222
- //// To be removed ////
223
- @Column('float', { nullable: true, transformer: roundTransformer })
224
- @Field({ nullable: true })
225
- afterTaxCostPrice: number
226
-
227
- //// To be removed ////
228
- @Column('float', { nullable: true, transformer: roundTransformer })
229
- @Field({ nullable: true })
230
- afterTaxSalesPrice: number
231
-
232
- //// To be removed ////
233
- @Column('float', { nullable: true, transformer: roundTransformer })
234
- @Field({ nullable: true })
235
- width: number
236
-
237
- //// To be removed ////
238
- @Column('float', { nullable: true, transformer: roundTransformer })
239
- @Field({ nullable: true })
240
- depth: number
241
-
242
- //// To be removed ////
243
- @Column('float', { nullable: true, transformer: roundTransformer })
244
- @Field({ nullable: true })
245
- height: number
246
-
247
- //// To be removed ////
248
- @Column('float', { nullable: true, transformer: roundTransformer })
249
- @Field({ nullable: true })
250
- volume: number
251
-
252
- //// To be removed ////
253
- @Column('float', { nullable: true, transformer: roundTransformer })
254
- @Field({ nullable: true })
255
- caseWidth: number
256
-
257
- //// To be removed ////
258
- @Column('float', { nullable: true, transformer: roundTransformer })
259
- @Field({ nullable: true })
260
- caseDepth: number
261
-
262
- //// To be removed ////
263
- @Column('float', { nullable: true, transformer: roundTransformer })
264
- @Field({ nullable: true })
265
- caseHeight: number
266
-
267
- //// To be removed ////
268
- @Column('float', { nullable: true, transformer: roundTransformer })
269
- @Field({ nullable: true })
270
- caseVolume: number
271
-
272
- //// To be removed ////
273
- @Column({ nullable: true })
274
- @Field({ nullable: true })
275
- volumeSize: string
276
-
277
- //// To be removed ////
278
- @Column({ nullable: true })
279
- @Field({ nullable: true })
280
- primaryUnit: string
281
-
282
- //// To be removed ////
283
- @Column('float', { nullable: true, transformer: roundTransformer })
284
- @Field({ nullable: true })
285
- primaryValue: number
286
-
287
- //// To be removed ////
288
- @Column({ nullable: true })
289
- @Field({ nullable: true })
290
- auxUnit1: string
291
-
292
- //// To be removed ////
293
- @Column({ nullable: true })
294
- @Field({ nullable: true })
295
- auxValue1: string
296
-
297
- //// To be removed ////
298
- @Column({ nullable: true })
299
- @Field({ nullable: true })
300
- auxUnit2: string
301
-
302
- //// To be removed ////
303
- @Column({ nullable: true })
304
- @Field({ nullable: true })
305
- auxValue2: string
306
-
307
- //// To be removed ////
308
- @Column({ nullable: true })
309
- @Field({ nullable: true })
310
- auxUnit3: string
311
-
312
- //// To be removed ////
313
- @Column({ nullable: true })
314
- @Field({ nullable: true })
315
- auxValue3: string
316
-
317
- //// To be removed ////
318
- @Column({ nullable: true })
319
- @Field({ nullable: true })
320
- inventoryAccountCode: string
321
-
322
- //// To be removed ////
323
- @Column({ nullable: true })
324
- @Field({ nullable: true })
325
- cogsAccountCode: string
326
-
327
- //// To be removed ////
328
- @ManyToOne(type => ProductSet, productSet => productSet.product, { nullable: true })
329
- @Field({ nullable: true })
330
- productSet: ProductSet
331
-
332
- //// To be removed ////
333
- @Column({ nullable: true })
334
- @Field({ nullable: true })
335
- movement: string
336
-
337
- //// To be removed ////
338
- @Column({ nullable: true })
339
- @Field({ nullable: true })
340
- bufferQty: number
341
-
342
- //// To be removed ////
343
- @Column('float', { nullable: true, transformer: roundTransformer })
344
- @Field({ nullable: true })
345
- minQty: number
346
-
347
- //// To be removed ////
348
- @Column('float', { nullable: true, transformer: roundTransformer })
349
- @Field({ nullable: true })
350
- maxQty: number
351
-
352
- //// To be removed ////
353
- @Column({ nullable: true })
354
- @Field({ nullable: true })
355
- discountId: number
356
-
357
- //// To be removed ////
358
- @Column({ nullable: true })
359
- @Field({ nullable: true })
360
- status: string
361
-
362
- //// To be removed ////
363
- @Column({ nullable: true })
364
- @Field({ nullable: true })
365
- isTrackedAsInventory: boolean
366
-
367
- @Column({ default: false })
368
- @Field({ nullable: true })
369
- isRequiredCheckExpiry: boolean
370
-
371
- @Column({ default: false })
372
- @Field({ nullable: true })
373
- isRequireSerialNumberScanning: boolean
374
-
375
- @Column({ default: false })
376
- @Field({ nullable: true })
377
- isRequireSerialNumberScanningInbound: boolean
378
-
379
- @Column({ default: false })
380
- @Field({ nullable: true })
381
- isRequireSerialNumberScanningOutbound: boolean
382
-
383
- @Column({ nullable: true })
384
- @Field({ nullable: true })
385
- deletedAt: Date
386
-
387
- @Column({
388
- nullable: false,
389
- type:
390
- DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
391
- ? 'enum'
392
- : DATABASE_TYPE == 'oracle'
393
- ? 'varchar2'
394
- : DATABASE_TYPE == 'mssql'
395
- ? 'nvarchar'
396
- : 'varchar',
397
- enum:
398
- DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb' ? pickStrategy : undefined,
399
- length: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb' ? undefined : 32,
400
- default: pickStrategy.FIFO
401
- })
402
- @Field()
403
- pickingStrategy: pickStrategy
404
-
405
- @Column({ nullable: true })
406
- @Field({ nullable: true })
407
- releaseType?: string
408
-
409
- @Field({ nullable: true })
410
- refCode: string
411
-
412
- @Field(type => Float, { nullable: true })
413
- nettWeight: number
414
-
415
- @Field({ nullable: true })
416
- uom: string
417
-
418
- @Field(type => Float, { nullable: true })
419
- uomValue: number
420
-
421
- @Field({ nullable: true })
422
- auxUnit4: string
423
-
424
- @Field({ nullable: true })
425
- auxValue4: string
426
-
427
- @Field({ nullable: true })
428
- auxUnit5: string
429
-
430
- @Field({ nullable: true })
431
- auxValue5: string
432
-
433
- @ManyToOne(type => User, { nullable: true })
434
- @Field({ nullable: true })
435
- creator: User
436
-
437
- @RelationId((product: Product) => product.creator)
438
- creatorId: string
439
-
440
- @ManyToOne(type => User, { nullable: true })
441
- @Field({ nullable: true })
442
- updater: User
443
-
444
- @RelationId((product: Product) => product.updater)
445
- updaterId: string
446
-
447
- @CreateDateColumn()
448
- @Field({ nullable: true })
449
- createdAt: Date
450
-
451
- @UpdateDateColumn()
452
- @Field({ nullable: true })
453
- updatedAt: Date
454
-
455
- @ManyToOne(type => Routing, { nullable: true })
456
- @Field({ nullable: true })
457
- routing?: Routing
458
-
459
- @RelationId((product: Product) => product.routing)
460
- routingId?: string
461
-
462
- @Column({ nullable: true })
463
- @Field(type => String, { nullable: true })
464
- warehouseId?: string
465
-
466
- @Field(type => String, { nullable: true })
467
- thumbnail?: string
468
-
469
- @Field({ nullable: true })
470
- productInformation: string
471
-
472
- @Field({ nullable: true })
473
- batchNo?: string
474
-
475
- @Field({ nullable: true })
476
- loadedQty: number
477
-
478
- constructor(obj?) {
479
- if (obj) {
480
- this.id = obj.product_id
481
- this.sku = obj.product_sku
482
- this.name = obj.product_name
483
- this.description = obj.product_description
484
- this.bundleQty = obj.product_bundle_qty
485
- this.type = obj.product_type
486
- this.packingType = obj.product_packing_type
487
- this.expirationPeriod = obj.product_expiration_period
488
- this.weightUnit = obj.product_weight_unit
489
- this.weight = obj.product_weight
490
- this.density = obj.product_density
491
- this.lengthUnit = obj.product_length_unit
492
- this.costPrice = obj.product_cost_price
493
- this.sellPrice = obj.product_sell_price
494
- this.width = obj.product_width
495
- this.depth = obj.product_depth
496
- this.height = obj.product_height
497
- this.primaryUnit = obj.product_primary_unit
498
- this.primaryValue = obj.product_primary_value
499
- this.auxUnit1 = obj.product_aux_unit_1
500
- this.auxValue1 = obj.product_aux_value_1
501
- this.auxUnit2 = obj.product_aux_unit_2
502
- this.auxValue2 = obj.product_aux_value_2
503
- this.auxUnit3 = obj.product_aux_unit_3
504
- this.auxValue3 = obj.product_aux_value_3
505
- this.createdAt = obj.product_created_at
506
- this.updatedAt = obj.product_updated_at
507
- this.movement = obj.product_movement
508
- this.inventoryAccountCode = obj.product_inventory_account_code
509
- this.cogsAccountCode = obj.product_cogs_account_code
510
- this.isTrackedAsInventory = obj.product_is_tracked_as_inventory
511
- this.mrpPrice = obj.product_mrp_price
512
- this.afterTaxCostPrice = obj.product_after_tax_cost_price
513
- this.afterTaxSalesPrice = obj.product_after_tax_sales_price
514
- this.bufferQty = obj.product_buffer_qty
515
- this.discountId = obj.product_discount_id
516
- this.status = obj.product_status
517
- this.brandSku = obj.product_brand_sku
518
- this.brand = obj.product_brand
519
- this.subBrand = obj.product_sub_brand
520
- this.gtin = obj.product_gtin
521
- this.caseGtin = obj.product_case_gtin
522
- this.grossWeight = obj.product_gross_weight
523
- this.caseWeight = obj.product_case_weight
524
- this.caseGrossWeight = obj.product_case_gross_weight
525
- this.volume = obj.product_volume
526
- this.caseWidth = obj.product_case_width
527
- this.caseDepth = obj.product_case_depth
528
- this.caseHeight = obj.product_case_height
529
- this.caseVolume = obj.product_case_volume
530
- this.volumeSize = obj.product_volume_size
531
- this.minQty = obj.product_min_qty
532
- this.maxQty = obj.product_max_qty
533
- this.isCompany = obj.product_is_company
534
- this.deletedAt = obj.product_deleted_at
535
- this.isRequiredCheckExpiry = obj.product_is_required_check_expiry
536
- this.isRequireSerialNumberScanning = obj.product_is_require_serial_number_scanning
537
- this.isRequireSerialNumberScanningInbound = obj.product_is_require_serial_number_scanning_inbound
538
- this.isRequireSerialNumberScanningOutbound = obj.product_is_require_serial_number_scanning_outbound
539
- this.bizplace = { id: obj.product_bizplace_id } as any
540
- this.domain = { id: obj.product_domain_id } as any
541
- this.inboundUnit = obj.product_inbound_unit
542
- this.convertWeight = obj.product_convert_weight
543
- this.category = obj.product_category
544
- this.boxInQty = obj.product_box_in_qty
545
- this.isAuction = obj.product_is_auction
546
- }
547
- }
548
- }
@@ -1,42 +0,0 @@
1
- import _ from 'lodash'
2
- import { EntityManager, IsNull, Not } from 'typeorm'
3
-
4
- import { User } from '@things-factory/auth-base'
5
- import { Domain } from '@things-factory/shell'
6
-
7
- import { Product } from './product'
8
-
9
- export async function validateProduct(product: Product, context: ResolverContext) {
10
- const { tx } = context.state
11
-
12
- let errors = []
13
-
14
- if (_.isEmpty(product.sku) || '') {
15
- errors.push('Product SKU is required')
16
- }
17
- if (_.isEmpty(product.name) || '') {
18
- errors.push('Product name is required')
19
- }
20
- if (_.isEmpty(product.type) || '') {
21
- errors.push('Product type is required')
22
- }
23
-
24
- if (
25
- (await tx.getRepository(Product).count({
26
- where: {
27
- sku: product.sku,
28
- bizplace: { id: product.bizplace.id },
29
- domain: { id: product.domain.id },
30
- id: product?.id == null ? Not(IsNull()) : Not(product.id)
31
- }
32
- })) > 0
33
- ) {
34
- errors.push('Duplicated SKU found.')
35
- }
36
-
37
- if (errors.length > 0) {
38
- throw new Error(errors.join(', '))
39
- }
40
-
41
- return true
42
- }
@@ -1,6 +0,0 @@
1
- import { ProductBundle } from './product-bundle'
2
- import { ProductBundleMutation } from './product-bundle-mutation'
3
- import { ProductBundleQuery } from './product-bundle-query'
4
-
5
- export const entities = [ProductBundle]
6
- export const resolvers = [ProductBundleQuery, ProductBundleMutation]