@things-factory/product-base 8.0.0-beta.9 → 8.0.2
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/dist-server/service/product/product-mutation.js +1 -1
- package/dist-server/service/product/product-mutation.js.map +1 -1
- package/dist-server/service/product/product-query.d.ts +1 -1
- package/dist-server/service/product/product-query.js +5 -5
- package/dist-server/service/product/product-query.js.map +1 -1
- package/dist-server/service/product/product-types.d.ts +4 -2
- package/dist-server/service/product/product-types.js +10 -2
- package/dist-server/service/product/product-types.js.map +1 -1
- package/dist-server/service/product/product.d.ts +2 -1
- package/dist-server/service/product/product.js +6 -1
- package/dist-server/service/product/product.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/server/constants/index.ts +1 -0
- package/server/constants/product.ts +24 -0
- package/server/controllers/index.ts +0 -0
- package/server/index.ts +2 -0
- package/server/middlewares/index.ts +0 -0
- package/server/migrations/index.ts +9 -0
- package/server/service/index.ts +61 -0
- package/server/service/product/index.ts +6 -0
- package/server/service/product/product-mutation.ts +407 -0
- package/server/service/product/product-query.ts +336 -0
- package/server/service/product/product-types.ts +458 -0
- package/server/service/product/product.ts +548 -0
- package/server/service/product/validate-product.ts +42 -0
- package/server/service/product-bundle/index.ts +6 -0
- package/server/service/product-bundle/product-bundle-mutation.ts +140 -0
- package/server/service/product-bundle/product-bundle-query.ts +104 -0
- package/server/service/product-bundle/product-bundle-types.ts +51 -0
- package/server/service/product-bundle/product-bundle.ts +102 -0
- package/server/service/product-bundle-setting/index.ts +6 -0
- package/server/service/product-bundle-setting/product-bundle-setting-mutation.ts +168 -0
- package/server/service/product-bundle-setting/product-bundle-setting-query.ts +139 -0
- package/server/service/product-bundle-setting/product-bundle-setting-types.ts +41 -0
- package/server/service/product-bundle-setting/product-bundle-setting.ts +45 -0
- package/server/service/product-combination/index.ts +6 -0
- package/server/service/product-combination/product-combination-mutation.ts +148 -0
- package/server/service/product-combination/product-combination-query.ts +48 -0
- package/server/service/product-combination/product-combination-type.ts +50 -0
- package/server/service/product-combination/product-combination.ts +116 -0
- package/server/service/product-combination-setting/index.ts +6 -0
- package/server/service/product-combination-setting/product-combination-setting-mutation.ts +248 -0
- package/server/service/product-combination-setting/product-combination-setting-query.ts +176 -0
- package/server/service/product-combination-setting/product-combination-setting-type.ts +44 -0
- package/server/service/product-combination-setting/product-combination-setting.ts +77 -0
- package/server/service/product-detail/index.ts +6 -0
- package/server/service/product-detail/product-detail-mutation.ts +238 -0
- package/server/service/product-detail/product-detail-query.ts +213 -0
- package/server/service/product-detail/product-detail-types.ts +280 -0
- package/server/service/product-detail/product-detail.ts +388 -0
- package/server/service/product-detail-bizplace-setting/index.ts +6 -0
- package/server/service/product-detail-bizplace-setting/product-detail-bizplace-setting-mutation.ts +118 -0
- package/server/service/product-detail-bizplace-setting/product-detail-bizplace-setting-query.ts +90 -0
- package/server/service/product-detail-bizplace-setting/product-detail-bizplace-setting-types.ts +62 -0
- package/server/service/product-detail-bizplace-setting/product-detail-bizplace-setting.ts +104 -0
- package/server/service/product-set/index.ts +6 -0
- package/server/service/product-set/product-set-mutation.ts +149 -0
- package/server/service/product-set/product-set-query.ts +114 -0
- package/server/service/product-set/product-set-types.ts +45 -0
- package/server/service/product-set/product-set.ts +95 -0
- package/server/utils/index.ts +1 -0
- package/server/utils/product-util.ts +11 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { User } from '@things-factory/auth-base'
|
|
2
|
+
import { Bizplace } from '@things-factory/biz-base'
|
|
3
|
+
import { Domain } from '@things-factory/shell'
|
|
4
|
+
import { Field, ID, ObjectType } from 'type-graphql'
|
|
5
|
+
import {
|
|
6
|
+
Column,
|
|
7
|
+
CreateDateColumn,
|
|
8
|
+
Entity,
|
|
9
|
+
Index,
|
|
10
|
+
ManyToOne,
|
|
11
|
+
OneToMany,
|
|
12
|
+
PrimaryGeneratedColumn,
|
|
13
|
+
RelationId,
|
|
14
|
+
UpdateDateColumn
|
|
15
|
+
} from 'typeorm'
|
|
16
|
+
import { Product } from '../product/product'
|
|
17
|
+
|
|
18
|
+
@Entity()
|
|
19
|
+
@Index('ix_product_set_0', (productSet: ProductSet) => [productSet.bizplace, productSet.name], { unique: true })
|
|
20
|
+
@ObjectType()
|
|
21
|
+
export class ProductSet {
|
|
22
|
+
@PrimaryGeneratedColumn('uuid')
|
|
23
|
+
@Field(type => ID)
|
|
24
|
+
readonly id: string
|
|
25
|
+
|
|
26
|
+
@ManyToOne(type => Domain)
|
|
27
|
+
@Field(type => Domain)
|
|
28
|
+
domain: Domain
|
|
29
|
+
|
|
30
|
+
@RelationId((productSet: ProductSet) => productSet.domain)
|
|
31
|
+
domainId: string
|
|
32
|
+
|
|
33
|
+
@ManyToOne(type => Bizplace, {
|
|
34
|
+
nullable: false
|
|
35
|
+
})
|
|
36
|
+
@Field({ nullable: true })
|
|
37
|
+
bizplace: Bizplace
|
|
38
|
+
|
|
39
|
+
@Column({ nullable: true })
|
|
40
|
+
@Field({ nullable: true })
|
|
41
|
+
code: string
|
|
42
|
+
|
|
43
|
+
@Column()
|
|
44
|
+
@Field()
|
|
45
|
+
name: string
|
|
46
|
+
|
|
47
|
+
@Column({
|
|
48
|
+
nullable: true
|
|
49
|
+
})
|
|
50
|
+
@Field({ nullable: true })
|
|
51
|
+
description: string
|
|
52
|
+
|
|
53
|
+
@OneToMany(type => Product, product => product.productSet, {
|
|
54
|
+
nullable: true
|
|
55
|
+
})
|
|
56
|
+
@Field(type => [Product], { nullable: true })
|
|
57
|
+
product: Product[]
|
|
58
|
+
|
|
59
|
+
@Column({
|
|
60
|
+
nullable: true,
|
|
61
|
+
default: 'ACTIVE'
|
|
62
|
+
})
|
|
63
|
+
@Field({ nullable: true })
|
|
64
|
+
status: string
|
|
65
|
+
|
|
66
|
+
@Column()
|
|
67
|
+
@Field()
|
|
68
|
+
type: string
|
|
69
|
+
|
|
70
|
+
@CreateDateColumn()
|
|
71
|
+
@Field({ nullable: true })
|
|
72
|
+
createdAt: Date
|
|
73
|
+
|
|
74
|
+
@UpdateDateColumn()
|
|
75
|
+
@Field({ nullable: true })
|
|
76
|
+
updatedAt: Date
|
|
77
|
+
|
|
78
|
+
@ManyToOne(type => User, {
|
|
79
|
+
nullable: true
|
|
80
|
+
})
|
|
81
|
+
@Field({ nullable: true })
|
|
82
|
+
creator: User
|
|
83
|
+
|
|
84
|
+
@RelationId((productSet: ProductSet) => productSet.creator)
|
|
85
|
+
creatorId: string
|
|
86
|
+
|
|
87
|
+
@ManyToOne(type => User, {
|
|
88
|
+
nullable: true
|
|
89
|
+
})
|
|
90
|
+
@Field({ nullable: true })
|
|
91
|
+
updater: User
|
|
92
|
+
|
|
93
|
+
@RelationId((productSet: ProductSet) => productSet.updater)
|
|
94
|
+
updaterId: string
|
|
95
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './product-util'
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export class ProductUtil {
|
|
2
|
+
static productSetCode() {
|
|
3
|
+
return 'PS' + generateRandomString(10)
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const generateRandomString = function (length, randomString = '') {
|
|
8
|
+
randomString += Math.random().toString(20).substr(2, length)
|
|
9
|
+
if (randomString.length > length) return randomString.slice(0, length)
|
|
10
|
+
return generateRandomString(length, randomString)
|
|
11
|
+
}
|