@things-factory/biz-base 8.0.0-beta.9 → 8.0.0
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/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/server/index.ts +3 -0
- package/server/middlewares/index.ts +0 -0
- package/server/migrations/index.ts +9 -0
- package/server/service/biz-option/biz-option-mutation.ts +65 -0
- package/server/service/biz-option/biz-option-query.ts +30 -0
- package/server/service/biz-option/biz-option-types.ts +44 -0
- package/server/service/biz-option/biz-option.ts +70 -0
- package/server/service/biz-option/index.ts +6 -0
- package/server/service/biz-option-detail/biz-option-detail-mutation.ts +59 -0
- package/server/service/biz-option-detail/biz-option-detail-query.ts +27 -0
- package/server/service/biz-option-detail/biz-option-detail-types.ts +38 -0
- package/server/service/biz-option-detail/biz-option-detail.ts +62 -0
- package/server/service/biz-option-detail/index.ts +6 -0
- package/server/service/bizplace/bizplace-mutation.ts +144 -0
- package/server/service/bizplace/bizplace-query.ts +236 -0
- package/server/service/bizplace/bizplace-types.ts +89 -0
- package/server/service/bizplace/bizplace.ts +108 -0
- package/server/service/bizplace/index.ts +6 -0
- package/server/service/company/company-mutation.ts +122 -0
- package/server/service/company/company-query.ts +70 -0
- package/server/service/company/company-types.ts +68 -0
- package/server/service/company/company.ts +105 -0
- package/server/service/company/index.ts +6 -0
- package/server/service/contact-point/contact-point-mutation.ts +165 -0
- package/server/service/contact-point/contact-point-query.ts +43 -0
- package/server/service/contact-point/contact-point-types.ts +152 -0
- package/server/service/contact-point/contact-point.ts +132 -0
- package/server/service/contact-point/index.ts +6 -0
- package/server/service/index.ts +46 -0
- package/server/service/worker/index.ts +6 -0
- package/server/service/worker/worker-mutation.ts +111 -0
- package/server/service/worker/worker-query.ts +37 -0
- package/server/service/worker/worker-types.ts +50 -0
- package/server/service/worker/worker.ts +58 -0
- package/server/utils/get-permitted-bizplaces.ts +342 -0
- package/server/utils/index.ts +1 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { Field, 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 { Domain } from '@things-factory/shell'
|
|
16
|
+
|
|
17
|
+
import { Bizplace } from '../bizplace/bizplace'
|
|
18
|
+
|
|
19
|
+
@Entity()
|
|
20
|
+
@Index('ix_companies_0', (company: Company) => [company.name], { unique: true })
|
|
21
|
+
@Index('ix_companies_1', (company: Company) => [company.domain], { unique: false })
|
|
22
|
+
@ObjectType()
|
|
23
|
+
export class Company {
|
|
24
|
+
@PrimaryGeneratedColumn('uuid')
|
|
25
|
+
@Field(type => ID)
|
|
26
|
+
readonly id: string
|
|
27
|
+
|
|
28
|
+
@ManyToOne(type => Domain)
|
|
29
|
+
@Field(type => Domain)
|
|
30
|
+
domain?: Domain
|
|
31
|
+
|
|
32
|
+
@RelationId((company: Company) => company.domain)
|
|
33
|
+
@Field()
|
|
34
|
+
domainId: string
|
|
35
|
+
|
|
36
|
+
@Column()
|
|
37
|
+
@Field()
|
|
38
|
+
name: string
|
|
39
|
+
|
|
40
|
+
@Column({
|
|
41
|
+
nullable: true
|
|
42
|
+
})
|
|
43
|
+
@Field({ nullable: true })
|
|
44
|
+
description: string
|
|
45
|
+
|
|
46
|
+
@Column()
|
|
47
|
+
@Field()
|
|
48
|
+
countryCode: string
|
|
49
|
+
|
|
50
|
+
@Column()
|
|
51
|
+
@Field()
|
|
52
|
+
brn: string
|
|
53
|
+
|
|
54
|
+
@Column()
|
|
55
|
+
@Field()
|
|
56
|
+
address: string
|
|
57
|
+
|
|
58
|
+
@Column({
|
|
59
|
+
nullable: true
|
|
60
|
+
})
|
|
61
|
+
@Field({ nullable: true })
|
|
62
|
+
postalCode: string
|
|
63
|
+
|
|
64
|
+
@Column({
|
|
65
|
+
nullable: true
|
|
66
|
+
})
|
|
67
|
+
@Field({ nullable: true })
|
|
68
|
+
type: string
|
|
69
|
+
|
|
70
|
+
@Column({
|
|
71
|
+
nullable: true
|
|
72
|
+
})
|
|
73
|
+
@Field({ nullable: true })
|
|
74
|
+
status: string
|
|
75
|
+
|
|
76
|
+
@OneToMany(type => Bizplace, bizplace => bizplace.company)
|
|
77
|
+
@Field(type => [Bizplace])
|
|
78
|
+
bizplaces: Bizplace[]
|
|
79
|
+
|
|
80
|
+
@ManyToOne(type => User, {
|
|
81
|
+
nullable: true
|
|
82
|
+
})
|
|
83
|
+
@Field(type => User, { nullable: true })
|
|
84
|
+
creator: User
|
|
85
|
+
|
|
86
|
+
@RelationId((company: Company) => company.creator)
|
|
87
|
+
creatorId: string
|
|
88
|
+
|
|
89
|
+
@ManyToOne(type => User, {
|
|
90
|
+
nullable: true
|
|
91
|
+
})
|
|
92
|
+
@Field(type => User, { nullable: true })
|
|
93
|
+
updater: User
|
|
94
|
+
|
|
95
|
+
@RelationId((company: Company) => company.updater)
|
|
96
|
+
updaterId: string
|
|
97
|
+
|
|
98
|
+
@CreateDateColumn()
|
|
99
|
+
@Field({ nullable: true })
|
|
100
|
+
createdAt: Date
|
|
101
|
+
|
|
102
|
+
@UpdateDateColumn()
|
|
103
|
+
@Field({ nullable: true })
|
|
104
|
+
updatedAt: Date
|
|
105
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'
|
|
2
|
+
import { EntityManager, Repository } from 'typeorm'
|
|
3
|
+
|
|
4
|
+
import { getRepository } from '@things-factory/shell'
|
|
5
|
+
|
|
6
|
+
import { Bizplace } from '../bizplace/bizplace'
|
|
7
|
+
import { ContactPoint } from './contact-point'
|
|
8
|
+
import { ContactPointPatch, NewContactPoint } from './contact-point-types'
|
|
9
|
+
|
|
10
|
+
@Resolver(ContactPoint)
|
|
11
|
+
export class ContactPointMutation {
|
|
12
|
+
@Directive('@privilege(category: "contact_point", privilege: "mutation")')
|
|
13
|
+
@Mutation(returns => ContactPoint)
|
|
14
|
+
async createContactPoint(
|
|
15
|
+
@Arg('contactPoint') contactPoint: NewContactPoint,
|
|
16
|
+
@Ctx() context: ResolverContext
|
|
17
|
+
): Promise<ContactPoint> {
|
|
18
|
+
return await createContactPoint(contactPoint as any, context)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@Directive('@privilege(category: "contact_point", privilege: "mutation")')
|
|
22
|
+
@Mutation(returns => ContactPoint)
|
|
23
|
+
async updateContactPoint(
|
|
24
|
+
@Arg('id') id: string,
|
|
25
|
+
@Arg('patch') patch: ContactPointPatch,
|
|
26
|
+
@Ctx() context: ResolverContext
|
|
27
|
+
): Promise<ContactPoint> {
|
|
28
|
+
const contactPoint = await getRepository(ContactPoint).findOneBy({ id })
|
|
29
|
+
|
|
30
|
+
if (patch.bizplace && patch.bizplace.id) {
|
|
31
|
+
patch.bizplace = await getRepository(Bizplace).findOneBy({ id: patch.bizplace.id })
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return await getRepository(ContactPoint).save({
|
|
35
|
+
...contactPoint,
|
|
36
|
+
...patch,
|
|
37
|
+
updater: context.state.user
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@Directive('@privilege(category: "contact_point", privilege: "mutation")')
|
|
42
|
+
@Mutation(returns => [ContactPoint])
|
|
43
|
+
async updateMultipleContactPoint(
|
|
44
|
+
@Arg('patches', type => [ContactPointPatch]) patches: ContactPointPatch[],
|
|
45
|
+
@Ctx() context: ResolverContext
|
|
46
|
+
): Promise<ContactPoint[]> {
|
|
47
|
+
const { tx } = context.state
|
|
48
|
+
let results = []
|
|
49
|
+
const { createRecords, updateRecords, deleteRecords } = patches.reduce(
|
|
50
|
+
(records, patch) => {
|
|
51
|
+
if (patch.cuFlag.toUpperCase() === '+') {
|
|
52
|
+
records.createRecords.push(patch)
|
|
53
|
+
} else if (patch.cuFlag.toUpperCase() === 'M') {
|
|
54
|
+
records.updateRecords.push(patch)
|
|
55
|
+
} else {
|
|
56
|
+
records.deleteRecords.push(patch)
|
|
57
|
+
}
|
|
58
|
+
return records
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
createRecords: [],
|
|
62
|
+
updateRecords: [],
|
|
63
|
+
deleteRecords: []
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
if (createRecords.length > 0) {
|
|
68
|
+
for (let i = 0; i < createRecords.length; i++) {
|
|
69
|
+
const result = await createContactPoint(createRecords[i], context, tx)
|
|
70
|
+
results.push(result)
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (updateRecords.length > 0) {
|
|
75
|
+
for (let i = 0; i < updateRecords.length; i++) {
|
|
76
|
+
const result = await updateContactPoint(updateRecords[i].id, updateRecords[i], context, tx)
|
|
77
|
+
results.push(result)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (deleteRecords.length > 0) {
|
|
82
|
+
for (let i = 0; i < deleteRecords.length; i++) {
|
|
83
|
+
await deleteContactPoint(deleteRecords[i].id, tx)
|
|
84
|
+
results.push(deleteRecords[i])
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return results
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@Directive('@privilege(category: "contact_point", privilege: "mutation")')
|
|
92
|
+
@Mutation(returns => Boolean)
|
|
93
|
+
async deleteContactPoint(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Boolean> {
|
|
94
|
+
await deleteContactPoint(id, context.state.tx)
|
|
95
|
+
|
|
96
|
+
return true
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
@Directive('@privilege(category: "contact_point", privilege: "mutation")')
|
|
100
|
+
@Mutation(returns => Boolean)
|
|
101
|
+
async deleteContactPoints(
|
|
102
|
+
@Arg('ids', type => [String]) ids: string[],
|
|
103
|
+
@Ctx() context: ResolverContext
|
|
104
|
+
): Promise<Boolean> {
|
|
105
|
+
await getRepository(ContactPoint).delete(ids)
|
|
106
|
+
|
|
107
|
+
return true
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export async function createContactPoint(
|
|
112
|
+
contactPoint: Partial<ContactPoint>,
|
|
113
|
+
context: any,
|
|
114
|
+
tx?: EntityManager
|
|
115
|
+
): Promise<ContactPoint> {
|
|
116
|
+
const { domain, user } = context.state
|
|
117
|
+
|
|
118
|
+
const bizplaceRepo: Repository<Bizplace> = tx?.getRepository(Bizplace) || getRepository(Bizplace)
|
|
119
|
+
const contactPointRepo: Repository<ContactPoint> = tx?.getRepository(ContactPoint) || getRepository(ContactPoint)
|
|
120
|
+
|
|
121
|
+
if (!contactPoint.bizplace?.id) {
|
|
122
|
+
contactPoint.bizplace = await bizplaceRepo.findOne({ where: { name: domain.name } })
|
|
123
|
+
} else {
|
|
124
|
+
contactPoint.bizplace = await bizplaceRepo.findOneBy({ id: contactPoint.bizplace.id })
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return await contactPointRepo.save({
|
|
128
|
+
...contactPoint,
|
|
129
|
+
domain,
|
|
130
|
+
creator: user,
|
|
131
|
+
updater: user
|
|
132
|
+
})
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export async function updateContactPoint(
|
|
136
|
+
id: string,
|
|
137
|
+
patch: Partial<ContactPoint>,
|
|
138
|
+
context: any,
|
|
139
|
+
tx?: EntityManager
|
|
140
|
+
): Promise<ContactPoint> {
|
|
141
|
+
const bizplaceRepo: Repository<Bizplace> = tx?.getRepository(Bizplace) || getRepository(Bizplace)
|
|
142
|
+
const contactPointRepo: Repository<ContactPoint> = tx?.getRepository(ContactPoint) || getRepository(ContactPoint)
|
|
143
|
+
|
|
144
|
+
const { domain, user } = context.state
|
|
145
|
+
let contactPoint: ContactPoint = await contactPointRepo.findOne({ where: { id }, relations: ['bizplace'] })
|
|
146
|
+
|
|
147
|
+
if (!contactPoint?.bizplace?.id) {
|
|
148
|
+
patch.bizplace = await bizplaceRepo.findOne({ where: { name: domain.name } })
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (patch?.bizplace?.id) {
|
|
152
|
+
patch.bizplace = await bizplaceRepo.findOneBy({ id: patch.bizplace.id })
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return await contactPointRepo.save({
|
|
156
|
+
...contactPoint,
|
|
157
|
+
...patch,
|
|
158
|
+
updater: user
|
|
159
|
+
})
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export async function deleteContactPoint(id: string, tx?: EntityManager): Promise<void> {
|
|
163
|
+
const contactPointRepo: Repository<ContactPoint> = tx?.getRepository(ContactPoint) || getRepository(ContactPoint)
|
|
164
|
+
await contactPointRepo.delete(id)
|
|
165
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Arg, Args, Ctx, Directive, Query, Resolver } from 'type-graphql'
|
|
2
|
+
|
|
3
|
+
import { getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
|
|
4
|
+
|
|
5
|
+
import { ContactPoint } from './contact-point'
|
|
6
|
+
import { ContactPointList } from './contact-point-types'
|
|
7
|
+
|
|
8
|
+
@Resolver(ContactPoint)
|
|
9
|
+
export class ContactPointQuery {
|
|
10
|
+
@Directive('@privilege(category: "contact_point", privilege: "query", domainOwnerGranted: true)')
|
|
11
|
+
@Query(returns => ContactPoint)
|
|
12
|
+
async contactPoint(@Arg('name') name: string, @Ctx() context: ResolverContext): Promise<ContactPoint> {
|
|
13
|
+
return await getRepository(ContactPoint).findOne({
|
|
14
|
+
where: { domain: { id: context.state.domain.id }, name },
|
|
15
|
+
relations: ['domain', 'bizplace', 'creator', 'updater']
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@Directive('@privilege(category: "contact_point", privilege: "query", domainOwnerGranted: true)')
|
|
20
|
+
@Query(returns => ContactPointList)
|
|
21
|
+
async contactPoints(
|
|
22
|
+
@Args(type => ListParam) params: ListParam,
|
|
23
|
+
@Ctx() context: ResolverContext
|
|
24
|
+
): Promise<ContactPointList> {
|
|
25
|
+
const { domain } = context.state
|
|
26
|
+
const queryBuilder = await getQueryBuilderFromListParams({
|
|
27
|
+
repository: getRepository(ContactPoint),
|
|
28
|
+
alias: 'ContactPoint',
|
|
29
|
+
params,
|
|
30
|
+
domain,
|
|
31
|
+
searchables: ['name', 'address', 'postCode', 'phone', 'email']
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
const [items, total] = await queryBuilder
|
|
35
|
+
.leftJoinAndSelect('ContactPoint.domain', 'Domain')
|
|
36
|
+
.leftJoinAndSelect('ContactPoint.bizplace', 'Bizplace')
|
|
37
|
+
.leftJoinAndSelect('ContactPoint.creator', 'Creator')
|
|
38
|
+
.leftJoinAndSelect('ContactPoint.updater', 'Updater')
|
|
39
|
+
.getManyAndCount()
|
|
40
|
+
|
|
41
|
+
return { items, total }
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { Field, InputType, Int, ObjectType } from 'type-graphql'
|
|
2
|
+
|
|
3
|
+
import { ObjectRef } from '@things-factory/shell'
|
|
4
|
+
|
|
5
|
+
import { ContactPoint } from './contact-point'
|
|
6
|
+
|
|
7
|
+
@ObjectType()
|
|
8
|
+
export class ContactPointList {
|
|
9
|
+
@Field(type => [ContactPoint], { nullable: true })
|
|
10
|
+
items: ContactPoint[]
|
|
11
|
+
|
|
12
|
+
@Field(type => Int, { nullable: true })
|
|
13
|
+
total: number
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@InputType()
|
|
17
|
+
export class ContactPointPatch {
|
|
18
|
+
@Field({ nullable: true })
|
|
19
|
+
id?: string
|
|
20
|
+
|
|
21
|
+
@Field(type => ObjectRef, { nullable: true })
|
|
22
|
+
bizplace?: ObjectRef
|
|
23
|
+
|
|
24
|
+
@Field({ nullable: true })
|
|
25
|
+
name?: string
|
|
26
|
+
|
|
27
|
+
@Field({ nullable: true })
|
|
28
|
+
email?: string
|
|
29
|
+
|
|
30
|
+
@Field({ nullable: true })
|
|
31
|
+
companyName?: string
|
|
32
|
+
|
|
33
|
+
@Field({ nullable: true })
|
|
34
|
+
representativeName?: string
|
|
35
|
+
|
|
36
|
+
@Field({ nullable: true })
|
|
37
|
+
managerName?: string
|
|
38
|
+
|
|
39
|
+
@Field({ nullable: true })
|
|
40
|
+
accountNo?: string
|
|
41
|
+
|
|
42
|
+
@Field({ nullable: true })
|
|
43
|
+
address?: string
|
|
44
|
+
|
|
45
|
+
@Field({ nullable: true })
|
|
46
|
+
address2?: string
|
|
47
|
+
|
|
48
|
+
@Field({ nullable: true })
|
|
49
|
+
city?: string
|
|
50
|
+
|
|
51
|
+
@Field({ nullable: true })
|
|
52
|
+
state?: string
|
|
53
|
+
|
|
54
|
+
@Field({ nullable: true })
|
|
55
|
+
postCode?: string
|
|
56
|
+
|
|
57
|
+
@Field({ nullable: true })
|
|
58
|
+
billingAddress?: string
|
|
59
|
+
|
|
60
|
+
@Field({ nullable: true })
|
|
61
|
+
fax?: string
|
|
62
|
+
|
|
63
|
+
@Field({ nullable: true })
|
|
64
|
+
fax2?: string
|
|
65
|
+
|
|
66
|
+
@Field({ nullable: true })
|
|
67
|
+
phone?: string
|
|
68
|
+
|
|
69
|
+
@Field({ nullable: true })
|
|
70
|
+
phone2?: string
|
|
71
|
+
|
|
72
|
+
@Field({ nullable: true })
|
|
73
|
+
description?: string
|
|
74
|
+
|
|
75
|
+
@Field({ nullable: true })
|
|
76
|
+
type?: string
|
|
77
|
+
|
|
78
|
+
@Field({ nullable: true })
|
|
79
|
+
registrationNo?: string
|
|
80
|
+
|
|
81
|
+
@Field({ nullable: true })
|
|
82
|
+
businessType?: string
|
|
83
|
+
|
|
84
|
+
@Field({ nullable: true })
|
|
85
|
+
cuFlag?: string
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@InputType()
|
|
89
|
+
export class NewContactPoint {
|
|
90
|
+
@Field(type => ObjectRef)
|
|
91
|
+
bizplace: ObjectRef
|
|
92
|
+
|
|
93
|
+
@Field()
|
|
94
|
+
name: string
|
|
95
|
+
|
|
96
|
+
@Field({ nullable: true })
|
|
97
|
+
email?: string
|
|
98
|
+
|
|
99
|
+
@Field({ nullable: true })
|
|
100
|
+
companyName?: string
|
|
101
|
+
|
|
102
|
+
@Field({ nullable: true })
|
|
103
|
+
accountNo?: string
|
|
104
|
+
|
|
105
|
+
@Field({ nullable: true })
|
|
106
|
+
address?: string
|
|
107
|
+
|
|
108
|
+
@Field({ nullable: true })
|
|
109
|
+
address2?: string
|
|
110
|
+
|
|
111
|
+
@Field({ nullable: true })
|
|
112
|
+
city?: string
|
|
113
|
+
|
|
114
|
+
@Field({ nullable: true })
|
|
115
|
+
state?: string
|
|
116
|
+
|
|
117
|
+
@Field({ nullable: true })
|
|
118
|
+
postCode?: string
|
|
119
|
+
|
|
120
|
+
@Field({ nullable: true })
|
|
121
|
+
billingAddress?: string
|
|
122
|
+
|
|
123
|
+
@Field({ nullable: true })
|
|
124
|
+
fax?: string
|
|
125
|
+
|
|
126
|
+
@Field({ nullable: true })
|
|
127
|
+
fax2?: string
|
|
128
|
+
|
|
129
|
+
@Field({ nullable: true })
|
|
130
|
+
phone?: string
|
|
131
|
+
|
|
132
|
+
@Field({ nullable: true })
|
|
133
|
+
phone2?: string
|
|
134
|
+
|
|
135
|
+
@Field({ nullable: true })
|
|
136
|
+
representativeName?: string
|
|
137
|
+
|
|
138
|
+
@Field({ nullable: true })
|
|
139
|
+
managerName?: string
|
|
140
|
+
|
|
141
|
+
@Field({ nullable: true })
|
|
142
|
+
description?: string
|
|
143
|
+
|
|
144
|
+
@Field({ nullable: true })
|
|
145
|
+
type?: string
|
|
146
|
+
|
|
147
|
+
@Field({ nullable: true })
|
|
148
|
+
registrationNo?: string
|
|
149
|
+
|
|
150
|
+
@Field({ nullable: true })
|
|
151
|
+
businessType?: string
|
|
152
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { Field, ID, ObjectType } from 'type-graphql'
|
|
2
|
+
import { Column, CreateDateColumn, Entity, Index, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'
|
|
3
|
+
|
|
4
|
+
import { User } from '@things-factory/auth-base'
|
|
5
|
+
import { Domain } from '@things-factory/shell'
|
|
6
|
+
|
|
7
|
+
import { Bizplace } from '../bizplace/bizplace'
|
|
8
|
+
|
|
9
|
+
@Entity()
|
|
10
|
+
@Index(
|
|
11
|
+
'ix_contact_points_0',
|
|
12
|
+
(contactPoint: ContactPoint) => [
|
|
13
|
+
contactPoint.name,
|
|
14
|
+
contactPoint.email,
|
|
15
|
+
contactPoint.companyName,
|
|
16
|
+
contactPoint.address,
|
|
17
|
+
contactPoint.billingAddress,
|
|
18
|
+
contactPoint.accountNo
|
|
19
|
+
],
|
|
20
|
+
{ unique: true }
|
|
21
|
+
)
|
|
22
|
+
@Index('ix_contact_points_1', (contactPoint: ContactPoint) => [contactPoint.registrationNo, contactPoint.type])
|
|
23
|
+
@ObjectType()
|
|
24
|
+
export class ContactPoint {
|
|
25
|
+
@PrimaryGeneratedColumn('uuid')
|
|
26
|
+
@Field(type => ID)
|
|
27
|
+
id: string
|
|
28
|
+
|
|
29
|
+
@ManyToOne(type => Domain)
|
|
30
|
+
@Field(type => Domain)
|
|
31
|
+
domain?: Domain
|
|
32
|
+
|
|
33
|
+
@ManyToOne(type => Bizplace)
|
|
34
|
+
@Field(type => Bizplace)
|
|
35
|
+
bizplace: Bizplace
|
|
36
|
+
|
|
37
|
+
@Column()
|
|
38
|
+
@Field()
|
|
39
|
+
name: string
|
|
40
|
+
|
|
41
|
+
@Column({ nullable: true })
|
|
42
|
+
@Field({ nullable: true })
|
|
43
|
+
email: string
|
|
44
|
+
|
|
45
|
+
@Column({ nullable: true })
|
|
46
|
+
@Field({ nullable: true })
|
|
47
|
+
address: string
|
|
48
|
+
|
|
49
|
+
@Column({ nullable: true })
|
|
50
|
+
@Field({ nullable: true })
|
|
51
|
+
address2: string
|
|
52
|
+
|
|
53
|
+
@Column({ nullable: true })
|
|
54
|
+
@Field({ nullable: true })
|
|
55
|
+
postCode: string
|
|
56
|
+
|
|
57
|
+
@Column({ nullable: true })
|
|
58
|
+
@Field({ nullable: true })
|
|
59
|
+
city: string
|
|
60
|
+
|
|
61
|
+
@Column({ nullable: true })
|
|
62
|
+
@Field({ nullable: true })
|
|
63
|
+
state: string
|
|
64
|
+
|
|
65
|
+
@Column({ nullable: true })
|
|
66
|
+
@Field({ nullable: true })
|
|
67
|
+
billingAddress: string
|
|
68
|
+
|
|
69
|
+
@Column({ nullable: true })
|
|
70
|
+
@Field({ nullable: true })
|
|
71
|
+
fax: string
|
|
72
|
+
|
|
73
|
+
@Column({ nullable: true })
|
|
74
|
+
@Field({ nullable: true })
|
|
75
|
+
fax2: string
|
|
76
|
+
|
|
77
|
+
@Column({ nullable: true })
|
|
78
|
+
@Field({ nullable: true })
|
|
79
|
+
phone: string
|
|
80
|
+
|
|
81
|
+
@Column({ nullable: true })
|
|
82
|
+
@Field({ nullable: true })
|
|
83
|
+
phone2: string
|
|
84
|
+
|
|
85
|
+
@Column({ nullable: true })
|
|
86
|
+
@Field({ nullable: true })
|
|
87
|
+
companyName: string
|
|
88
|
+
|
|
89
|
+
@Column({ nullable: true })
|
|
90
|
+
@Field({ nullable: true })
|
|
91
|
+
representativeName: string
|
|
92
|
+
|
|
93
|
+
@Column({ nullable: true })
|
|
94
|
+
@Field({ nullable: true })
|
|
95
|
+
managerName: string
|
|
96
|
+
|
|
97
|
+
@Column({ nullable: true })
|
|
98
|
+
@Field({ nullable: true })
|
|
99
|
+
accountNo: string
|
|
100
|
+
|
|
101
|
+
@Column({ nullable: true })
|
|
102
|
+
@Field({ nullable: true })
|
|
103
|
+
type: string
|
|
104
|
+
|
|
105
|
+
@Column({ nullable: true })
|
|
106
|
+
@Field({ nullable: true })
|
|
107
|
+
description: string
|
|
108
|
+
|
|
109
|
+
@Column({ nullable: true })
|
|
110
|
+
@Field({ nullable: true })
|
|
111
|
+
registrationNo: string
|
|
112
|
+
|
|
113
|
+
@Column({ nullable: true })
|
|
114
|
+
@Field({ nullable: true })
|
|
115
|
+
businessType: string
|
|
116
|
+
|
|
117
|
+
@ManyToOne(type => User, { nullable: true })
|
|
118
|
+
@Field({ nullable: true })
|
|
119
|
+
creator: User
|
|
120
|
+
|
|
121
|
+
@ManyToOne(type => User, { nullable: true })
|
|
122
|
+
@Field({ nullable: true })
|
|
123
|
+
updater: User
|
|
124
|
+
|
|
125
|
+
@CreateDateColumn()
|
|
126
|
+
@Field({ nullable: true })
|
|
127
|
+
createdAt: Date
|
|
128
|
+
|
|
129
|
+
@UpdateDateColumn()
|
|
130
|
+
@Field({ nullable: true })
|
|
131
|
+
updatedAt: Date
|
|
132
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ContactPoint } from './contact-point'
|
|
2
|
+
import { ContactPointMutation } from './contact-point-mutation'
|
|
3
|
+
import { ContactPointQuery } from './contact-point-query'
|
|
4
|
+
|
|
5
|
+
export const entities = [ContactPoint]
|
|
6
|
+
export const resolvers = [ContactPointQuery, ContactPointMutation]
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/* IMPORT ENTITIES AND RESOLVERS */
|
|
2
|
+
import { entities as BizOptionEntities, resolvers as BizOptionResolvers } from './biz-option'
|
|
3
|
+
import { entities as BizOptionDetailEntities, resolvers as BizOptionDetailResolvers } from './biz-option-detail'
|
|
4
|
+
import { entities as BizplaceEntities, resolvers as BizplaceResolvers } from './bizplace'
|
|
5
|
+
import { entities as CompanyEntities, resolvers as CompanyResolvers } from './company'
|
|
6
|
+
import { entities as ContactPointEntities, resolvers as ContactPointResolvers } from './contact-point'
|
|
7
|
+
import { entities as WorkerEntities, resolvers as WorkerResolvers } from './worker'
|
|
8
|
+
|
|
9
|
+
/* EXPORT ENTITY TYPES */
|
|
10
|
+
export * from './company/company'
|
|
11
|
+
export * from './bizplace/bizplace'
|
|
12
|
+
export * from './biz-option/biz-option'
|
|
13
|
+
export * from './biz-option-detail/biz-option-detail'
|
|
14
|
+
export * from './contact-point/contact-point'
|
|
15
|
+
export * from './worker/worker'
|
|
16
|
+
|
|
17
|
+
/* EXPORT TYPES */
|
|
18
|
+
export * from './company/company-types'
|
|
19
|
+
export * from './bizplace/bizplace-types'
|
|
20
|
+
export * from './biz-option/biz-option-types'
|
|
21
|
+
export * from './biz-option-detail/biz-option-detail-types'
|
|
22
|
+
export * from './contact-point/contact-point-types'
|
|
23
|
+
export * from './worker/worker-types'
|
|
24
|
+
|
|
25
|
+
export const entities = [
|
|
26
|
+
...CompanyEntities,
|
|
27
|
+
...BizplaceEntities,
|
|
28
|
+
...BizOptionEntities,
|
|
29
|
+
...BizOptionDetailEntities,
|
|
30
|
+
...ContactPointEntities,
|
|
31
|
+
...WorkerEntities
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
export const schema = {
|
|
35
|
+
resolverClasses: [
|
|
36
|
+
...CompanyResolvers,
|
|
37
|
+
...BizplaceResolvers,
|
|
38
|
+
...BizOptionResolvers,
|
|
39
|
+
...BizOptionDetailResolvers,
|
|
40
|
+
...ContactPointResolvers,
|
|
41
|
+
...WorkerResolvers
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { createCompany, deleteCompanies, deleteCompany, updateCompany } from './company/company-mutation'
|
|
46
|
+
export { createWorker, deleteWorker, deleteWorkers, updateWorker } from './worker/worker-mutation'
|