@things-factory/code-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.
@@ -0,0 +1,86 @@
1
+ import { Field, ID, InputType, ObjectType } from 'type-graphql'
2
+ import {
3
+ Column,
4
+ CreateDateColumn,
5
+ Entity,
6
+ Index,
7
+ ManyToOne,
8
+ PrimaryGeneratedColumn,
9
+ RelationId,
10
+ UpdateDateColumn
11
+ } from 'typeorm'
12
+
13
+ import { User } from '@things-factory/auth-base'
14
+ import { Domain, ScalarObject } from '@things-factory/shell'
15
+
16
+ import { CommonCode } from '../common-code/common-code'
17
+
18
+ @Entity()
19
+ @Index(
20
+ 'ix_common_code_detail_0',
21
+ (commonCodeDetail: CommonCodeDetail) => [commonCodeDetail.commonCode, commonCodeDetail.name],
22
+ { unique: true }
23
+ )
24
+ @Index(
25
+ 'ix_common_code_detail_1',
26
+ (commonCodeDetail: CommonCodeDetail) => [commonCodeDetail.commonCode, commonCodeDetail.rank],
27
+ { unique: true }
28
+ )
29
+ @ObjectType({ description: 'Entity for CommonCodeDetail' })
30
+ export class CommonCodeDetail {
31
+ @PrimaryGeneratedColumn('uuid')
32
+ @Field(type => ID)
33
+ readonly id: string
34
+
35
+ @ManyToOne(type => Domain)
36
+ @Field(type => Domain)
37
+ domain?: Domain
38
+
39
+ @RelationId((commonCodeDetail: CommonCodeDetail) => commonCodeDetail.domain)
40
+ domainId?: string
41
+
42
+ @ManyToOne(type => CommonCode, commonCode => commonCode.details, { onDelete: 'CASCADE' })
43
+ @Field({ nullable: true })
44
+ commonCode?: CommonCode
45
+
46
+ @RelationId((commonCodeDetail: CommonCodeDetail) => commonCodeDetail.commonCode)
47
+ commonCodeId?: string
48
+
49
+ @Column()
50
+ @Field()
51
+ name: string
52
+
53
+ @Column({ nullable: true })
54
+ @Field({ nullable: true })
55
+ description?: string
56
+
57
+ @Column('simple-json', { nullable: true })
58
+ @Field(type => ScalarObject, { nullable: true })
59
+ labels?: any // { [lng: string]: string }
60
+
61
+ @Column()
62
+ @Field({ nullable: true })
63
+ rank: number
64
+
65
+ @CreateDateColumn()
66
+ @Field({ nullable: true })
67
+ createdAt?: Date
68
+
69
+ @UpdateDateColumn()
70
+ @Field({ nullable: true })
71
+ updatedAt?: Date
72
+
73
+ @ManyToOne(type => User, { nullable: true })
74
+ @Field(type => User, { nullable: true })
75
+ creator?: User
76
+
77
+ @RelationId((commonCodeDetail: CommonCodeDetail) => commonCodeDetail.creator)
78
+ creatorId?: string
79
+
80
+ @ManyToOne(type => User, { nullable: true })
81
+ @Field(type => User, { nullable: true })
82
+ updater?: User
83
+
84
+ @RelationId((commonCodeDetail: CommonCodeDetail) => commonCodeDetail.updater)
85
+ updaterId?: string
86
+ }
@@ -0,0 +1,6 @@
1
+ import { CommonCodeDetail } from './common-code-detail'
2
+ import { CommonCodeDetailQuery } from './common-code-detail-query'
3
+ import { CommonCodeDetailMutation } from './common-code-detail-mutation'
4
+
5
+ export const entities = [CommonCodeDetail]
6
+ export const resolvers = [CommonCodeDetailQuery, CommonCodeDetailMutation]
@@ -0,0 +1,22 @@
1
+ /* EXPORT ENTITY TYPES */
2
+ export * from './common-code-detail/common-code-detail'
3
+ export * from './common-code/common-code'
4
+
5
+ /* IMPORT ENTITIES AND RESOLVERS */
6
+ import { entities as CommonCodeDetailEntities, resolvers as CommonCodeDetailResolvers } from './common-code-detail'
7
+ import { entities as CommonCodeEntities, resolvers as CommonCodeResolvers } from './common-code'
8
+
9
+ export const entities = [
10
+ /* ENTITIES */
11
+ ...CommonCodeDetailEntities,
12
+ ...CommonCodeEntities,
13
+ ]
14
+
15
+
16
+ export const schema = {
17
+ resolverClasses: [
18
+ /* RESOLVER CLASSES */
19
+ ...CommonCodeDetailResolvers,
20
+ ...CommonCodeResolvers,
21
+ ]
22
+ }