@things-factory/routing-base 5.0.15 → 6.0.0-alpha.10

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 (30) hide show
  1. package/dist-server/service/operation/operation-mutation.js +4 -4
  2. package/dist-server/service/operation/operation-mutation.js.map +1 -1
  3. package/dist-server/service/operation/operation-query.js +9 -11
  4. package/dist-server/service/operation/operation-query.js.map +1 -1
  5. package/dist-server/service/operation/operation-type.js.map +1 -1
  6. package/dist-server/service/operation/operation.js +3 -4
  7. package/dist-server/service/operation/operation.js.map +1 -1
  8. package/dist-server/service/routing/routing-mutation.js +4 -4
  9. package/dist-server/service/routing/routing-mutation.js.map +1 -1
  10. package/dist-server/service/routing/routing-query.js +10 -12
  11. package/dist-server/service/routing/routing-query.js.map +1 -1
  12. package/dist-server/service/routing/routing-type.js.map +1 -1
  13. package/dist-server/service/routing/routing.js +3 -4
  14. package/dist-server/service/routing/routing.js.map +1 -1
  15. package/dist-server/service/routing-item/routing-item-mutation.js +4 -4
  16. package/dist-server/service/routing-item/routing-item-mutation.js.map +1 -1
  17. package/dist-server/service/routing-item/routing-item-query.js +7 -9
  18. package/dist-server/service/routing-item/routing-item-query.js.map +1 -1
  19. package/dist-server/service/routing-item/routing-item-type.js +4 -5
  20. package/dist-server/service/routing-item/routing-item-type.js.map +1 -1
  21. package/dist-server/service/routing-item/routing-item.js +3 -4
  22. package/dist-server/service/routing-item/routing-item.js.map +1 -1
  23. package/dist-server/tsconfig.tsbuildinfo +1 -1
  24. package/package.json +5 -5
  25. package/server/service/operation/operation-mutation.ts +15 -9
  26. package/server/service/operation/operation-query.ts +8 -9
  27. package/server/service/routing/routing-mutation.ts +12 -14
  28. package/server/service/routing/routing-query.ts +19 -12
  29. package/server/service/routing-item/routing-item-mutation.ts +17 -20
  30. package/server/service/routing-item/routing-item-query.ts +7 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/routing-base",
3
- "version": "5.0.15",
3
+ "version": "6.0.0-alpha.10",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -24,9 +24,9 @@
24
24
  "migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
25
25
  },
26
26
  "dependencies": {
27
- "@things-factory/attachment-base": "^5.0.15",
28
- "@things-factory/auth-base": "^5.0.15",
29
- "@things-factory/shell": "^5.0.15"
27
+ "@things-factory/attachment-base": "^6.0.0-alpha.10",
28
+ "@things-factory/auth-base": "^6.0.0-alpha.10",
29
+ "@things-factory/shell": "^6.0.0-alpha.8"
30
30
  },
31
- "gitHead": "87b738da786f92983d009d72548918be93e4ae2c"
31
+ "gitHead": "9ec9c564e157ebe830839e5a9cf8cfd6ec4e44b1"
32
32
  }
@@ -10,7 +10,10 @@ import { NewOperation, OperationPatch } from './operation-type'
10
10
  export class OperationMutation {
11
11
  @Directive('@transaction')
12
12
  @Mutation(returns => Operation, { description: 'To create new Operation' })
13
- async createOperation(@Arg('operation') operation: NewOperation, @Ctx() context: any): Promise<Operation> {
13
+ async createOperation(
14
+ @Arg('operation') operation: NewOperation,
15
+ @Ctx() context: ResolverContext
16
+ ): Promise<Operation> {
14
17
  const { domain, user, tx } = context.state
15
18
 
16
19
  const result = await tx.getRepository(Operation).save({
@@ -42,13 +45,13 @@ export class OperationMutation {
42
45
  async updateOperation(
43
46
  @Arg('id') id: string,
44
47
  @Arg('patch') patch: OperationPatch,
45
- @Ctx() context: any
48
+ @Ctx() context: ResolverContext
46
49
  ): Promise<Operation> {
47
50
  const { domain, user, tx } = context.state
48
51
 
49
52
  const repository = tx.getRepository(Operation)
50
53
  const operation = await repository.findOne({
51
- where: { domain, id }
54
+ where: { domain: { id: domain.id }, id }
52
55
  })
53
56
 
54
57
  const result = await repository.save({
@@ -80,7 +83,7 @@ export class OperationMutation {
80
83
  @Mutation(returns => [Operation], { description: "To modify multiple Operations' information" })
81
84
  async updateMultipleOperation(
82
85
  @Arg('patches', type => [OperationPatch]) patches: OperationPatch[],
83
- @Ctx() context: any
86
+ @Ctx() context: ResolverContext
84
87
  ): Promise<Operation[]> {
85
88
  const { domain, user, tx } = context.state
86
89
 
@@ -121,7 +124,7 @@ export class OperationMutation {
121
124
  if (_updateRecords.length > 0) {
122
125
  for (let i = 0; i < _updateRecords.length; i++) {
123
126
  const newRecord = _updateRecords[i]
124
- const operation = await operationRepo.findOne(newRecord.id)
127
+ const operation = await operationRepo.findOneBy({ id: newRecord.id })
125
128
 
126
129
  const result = await operationRepo.save({
127
130
  ...operation,
@@ -153,10 +156,10 @@ export class OperationMutation {
153
156
 
154
157
  @Directive('@transaction')
155
158
  @Mutation(returns => Boolean, { description: 'To delete Operation' })
156
- async deleteOperation(@Arg('id') id: string, @Ctx() context: any): Promise<boolean> {
159
+ async deleteOperation(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
157
160
  const { domain, tx } = context.state
158
161
 
159
- await tx.getRepository(Operation).delete({ domain, id })
162
+ await tx.getRepository(Operation).delete({ domain: { id: domain.id }, id })
160
163
  await deleteAttachmentsByRef(null, { refBys: [id] }, context)
161
164
 
162
165
  return true
@@ -164,11 +167,14 @@ export class OperationMutation {
164
167
 
165
168
  @Directive('@transaction')
166
169
  @Mutation(returns => Boolean, { description: 'To delete multiple operations' })
167
- async deleteOperations(@Arg('ids', type => [String]) ids: string[], @Ctx() context: any): Promise<boolean> {
170
+ async deleteOperations(
171
+ @Arg('ids', type => [String]) ids: string[],
172
+ @Ctx() context: ResolverContext
173
+ ): Promise<boolean> {
168
174
  const { domain, tx } = context.state
169
175
 
170
176
  await tx.getRepository(Operation).delete({
171
- domain,
177
+ domain: { id: domain.id },
172
178
  id: In(ids)
173
179
  })
174
180
 
@@ -1,9 +1,8 @@
1
1
  import { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'
2
- import { getRepository } from 'typeorm'
3
2
 
4
3
  import { Attachment } from '@things-factory/attachment-base'
5
4
  import { User } from '@things-factory/auth-base'
6
- import { Domain, getQueryBuilderFromListParams, ListParam } from '@things-factory/shell'
5
+ import { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
7
6
 
8
7
  import { Operation } from './operation'
9
8
  import { OperationList } from './operation-type'
@@ -11,16 +10,16 @@ import { OperationList } from './operation-type'
11
10
  @Resolver(Operation)
12
11
  export class OperationQuery {
13
12
  @Query(returns => Operation, { description: 'To fetch a Operation' })
14
- async operation(@Arg('id') id: string, @Ctx() context: any): Promise<Operation> {
13
+ async operation(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Operation> {
15
14
  const { domain } = context.state
16
15
 
17
16
  return await getRepository(Operation).findOne({
18
- where: { domain, id }
17
+ where: { domain: { id: domain.id }, id }
19
18
  })
20
19
  }
21
20
 
22
21
  @Query(returns => OperationList, { description: 'To fetch multiple Operations' })
23
- async operations(@Args() params: ListParam, @Ctx() context: any): Promise<OperationList> {
22
+ async operations(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<OperationList> {
24
23
  const { domain } = context.state
25
24
 
26
25
  const queryBuilder = getQueryBuilderFromListParams({
@@ -37,24 +36,24 @@ export class OperationQuery {
37
36
 
38
37
  @FieldResolver(type => Domain)
39
38
  async domain(@Root() operation: Operation): Promise<Domain> {
40
- return await getRepository(Domain).findOne(operation.domainId)
39
+ return await getRepository(Domain).findOneBy({ id: operation.domainId })
41
40
  }
42
41
 
43
42
  @FieldResolver(type => User)
44
43
  async updater(@Root() operation: Operation): Promise<User> {
45
- return await getRepository(User).findOne(operation.updaterId)
44
+ return await getRepository(User).findOneBy({ id: operation.updaterId })
46
45
  }
47
46
 
48
47
  @FieldResolver(type => User)
49
48
  async creator(@Root() operation: Operation): Promise<User> {
50
- return await getRepository(User).findOne(operation.creatorId)
49
+ return await getRepository(User).findOneBy({ id: operation.creatorId })
51
50
  }
52
51
 
53
52
  @FieldResolver(type => String)
54
53
  async thumbnail(@Root() operation: Operation): Promise<string | undefined> {
55
54
  const attachment: Attachment = await getRepository(Attachment).findOne({
56
55
  where: {
57
- domain: operation.domainId,
56
+ domain: { id: operation.domainId },
58
57
  refBy: operation.id
59
58
  }
60
59
  })
@@ -1,5 +1,6 @@
1
- import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
2
- import { getRepository, In } from 'typeorm'
1
+ import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'
2
+ import { In } from 'typeorm'
3
+
3
4
  import { Routing } from './routing'
4
5
  import { NewRouting, RoutingPatch } from './routing-type'
5
6
 
@@ -7,7 +8,7 @@ import { NewRouting, RoutingPatch } from './routing-type'
7
8
  export class RoutingMutation {
8
9
  @Directive('@transaction')
9
10
  @Mutation(returns => Routing, { description: 'To create new Routing' })
10
- async createRouting(@Arg('routing') routing: NewRouting, @Ctx() context: any): Promise<Routing> {
11
+ async createRouting(@Arg('routing') routing: NewRouting, @Ctx() context: ResolverContext): Promise<Routing> {
11
12
  const { domain, user, tx } = context.state
12
13
 
13
14
  return await tx.getRepository(Routing).save({
@@ -23,13 +24,13 @@ export class RoutingMutation {
23
24
  async updateRouting(
24
25
  @Arg('id') id: string,
25
26
  @Arg('patch') patch: RoutingPatch,
26
- @Ctx() context: any
27
+ @Ctx() context: ResolverContext
27
28
  ): Promise<Routing> {
28
29
  const { domain, user, tx } = context.state
29
30
 
30
31
  const repository = tx.getRepository(Routing)
31
32
  const routing = await repository.findOne({
32
- where: { domain, id }
33
+ where: { domain: { id: domain.id }, id }
33
34
  })
34
35
 
35
36
  return await repository.save({
@@ -43,7 +44,7 @@ export class RoutingMutation {
43
44
  @Mutation(returns => [Routing], { description: "To modify multiple Routings' information" })
44
45
  async updateMultipleRouting(
45
46
  @Arg('patches', type => [RoutingPatch]) patches: RoutingPatch[],
46
- @Ctx() context: any
47
+ @Ctx() context: ResolverContext
47
48
  ): Promise<Routing[]> {
48
49
  const { domain, user, tx } = context.state
49
50
 
@@ -70,7 +71,7 @@ export class RoutingMutation {
70
71
  if (_updateRecords.length > 0) {
71
72
  for (let i = 0; i < _updateRecords.length; i++) {
72
73
  const newRecord = _updateRecords[i]
73
- const routing = await routingRepo.findOne(newRecord.id)
74
+ const routing = await routingRepo.findOneBy({ id: newRecord.id })
74
75
 
75
76
  const result = await routingRepo.save({
76
77
  ...routing,
@@ -87,23 +88,20 @@ export class RoutingMutation {
87
88
 
88
89
  @Directive('@transaction')
89
90
  @Mutation(returns => Boolean, { description: 'To delete Routing' })
90
- async deleteRouting(@Arg('id') id: string, @Ctx() context: any): Promise<boolean> {
91
+ async deleteRouting(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
91
92
  const { domain, tx } = context.state
92
93
 
93
- await tx.getRepository(Routing).delete({ domain, id })
94
+ await tx.getRepository(Routing).delete({ domain: { id: domain.id }, id })
94
95
  return true
95
96
  }
96
97
 
97
98
  @Directive('@transaction')
98
99
  @Mutation(returns => Boolean, { description: 'To delete multiple routings' })
99
- async deleteRoutings(
100
- @Arg('ids', type => [String]) ids: string[],
101
- @Ctx() context: any
102
- ): Promise<boolean> {
100
+ async deleteRoutings(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {
103
101
  const { domain, tx } = context.state
104
102
 
105
103
  await tx.getRepository(Routing).delete({
106
- domain,
104
+ domain: { id: domain.id },
107
105
  id: In(ids)
108
106
  })
109
107
 
@@ -1,8 +1,7 @@
1
1
  import { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'
2
- import { getRepository } from 'typeorm'
3
2
 
4
3
  import { User } from '@things-factory/auth-base'
5
- import { Domain, getQueryBuilderFromListParams, ListParam } from '@things-factory/shell'
4
+ import { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
6
5
 
7
6
  import { Operation } from '../operation/operation'
8
7
  import { Routing } from './routing'
@@ -11,16 +10,16 @@ import { RoutingList } from './routing-type'
11
10
  @Resolver(Routing)
12
11
  export class RoutingQuery {
13
12
  @Query(returns => Routing, { description: 'To fetch a Routing' })
14
- async routing(@Arg('id') id: string, @Ctx() context: any): Promise<Routing> {
13
+ async routing(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Routing> {
15
14
  const { domain } = context.state
16
15
 
17
16
  return await getRepository(Routing).findOne({
18
- where: { domain, name }
17
+ where: { domain: { id: domain.id }, id }
19
18
  })
20
19
  }
21
20
 
22
21
  @Query(returns => RoutingList, { description: 'To fetch multiple Routings' })
23
- async routings(@Args() params: ListParam, @Ctx() context: any): Promise<RoutingList> {
22
+ async routings(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<RoutingList> {
24
23
  const { domain } = context.state
25
24
 
26
25
  const queryBuilder = getQueryBuilderFromListParams({
@@ -37,21 +36,21 @@ export class RoutingQuery {
37
36
 
38
37
  @FieldResolver(type => Domain)
39
38
  async domain(@Root() routing: Routing): Promise<Domain> {
40
- return await getRepository(Domain).findOne(routing.domainId)
39
+ return await getRepository(Domain).findOneBy({ id: routing.domainId })
41
40
  }
42
41
 
43
42
  @FieldResolver(type => User)
44
43
  async updater(@Root() routing: Routing): Promise<User> {
45
- return await getRepository(User).findOne(routing.updaterId)
44
+ return await getRepository(User).findOneBy({ id: routing.updaterId })
46
45
  }
47
46
 
48
47
  @FieldResolver(type => User)
49
48
  async creator(@Root() routing: Routing): Promise<User> {
50
- return await getRepository(User).findOne(routing.creatorId)
49
+ return await getRepository(User).findOneBy({ id: routing.creatorId })
51
50
  }
52
51
  }
53
52
 
54
- export async function firstOperation(routingId: string, context: any): Promise<Operation> {
53
+ export async function firstOperation(routingId: string, context: ResolverContext): Promise<Operation> {
55
54
  const { domain, user, tx } = context.state
56
55
  const operation: Operation = await tx.getRepository(Operation).query(
57
56
  `
@@ -84,7 +83,11 @@ export async function firstOperation(routingId: string, context: any): Promise<O
84
83
  return operation
85
84
  }
86
85
 
87
- export async function nextOperation(operationId: string, routingId: string, context: any): Promise<Operation> {
86
+ export async function nextOperation(
87
+ operationId: string,
88
+ routingId: string,
89
+ context: ResolverContext
90
+ ): Promise<Operation> {
88
91
  const operation = await getRepository(Operation).query(
89
92
  `
90
93
  select
@@ -128,7 +131,11 @@ export async function nextOperation(operationId: string, routingId: string, cont
128
131
  return operation
129
132
  }
130
133
 
131
- export async function prevOperation(operationId: string, routingId: string, context: any): Promise<Operation> {
134
+ export async function prevOperation(
135
+ operationId: string,
136
+ routingId: string,
137
+ context: ResolverContext
138
+ ): Promise<Operation> {
132
139
  const operation = await getRepository(Operation).query(
133
140
  `
134
141
  select
@@ -173,7 +180,7 @@ export async function prevOperation(operationId: string, routingId: string, cont
173
180
  return operation
174
181
  }
175
182
 
176
- export async function lastOperation(routingId: string, context: any): Promise<Operation> {
183
+ export async function lastOperation(routingId: string, context: ResolverContext): Promise<Operation> {
177
184
  const operation = await getRepository(Operation).query(
178
185
  `
179
186
  select
@@ -1,23 +1,17 @@
1
- import {
2
- Arg,
3
- Ctx,
4
- Directive,
5
- Mutation,
6
- Resolver
7
- } from 'type-graphql'
1
+ import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'
8
2
  import { In } from 'typeorm'
9
3
 
10
4
  import { RoutingItem } from './routing-item'
11
- import {
12
- NewRoutingItem,
13
- RoutingItemPatch
14
- } from './routing-item-type'
5
+ import { NewRoutingItem, RoutingItemPatch } from './routing-item-type'
15
6
 
16
7
  @Resolver(RoutingItem)
17
8
  export class RoutingItemMutation {
18
9
  @Directive('@transaction')
19
10
  @Mutation(returns => RoutingItem, { description: 'To create new RoutingItem' })
20
- async createRoutingItem(@Arg('routingItem') routingItem: NewRoutingItem, @Ctx() context: any): Promise<RoutingItem> {
11
+ async createRoutingItem(
12
+ @Arg('routingItem') routingItem: NewRoutingItem,
13
+ @Ctx() context: ResolverContext
14
+ ): Promise<RoutingItem> {
21
15
  const { domain, user, tx } = context.state
22
16
 
23
17
  return await tx.getRepository(RoutingItem).save({
@@ -33,13 +27,13 @@ export class RoutingItemMutation {
33
27
  async updateRoutingItem(
34
28
  @Arg('id') id: string,
35
29
  @Arg('patch') patch: RoutingItemPatch,
36
- @Ctx() context: any
30
+ @Ctx() context: ResolverContext
37
31
  ): Promise<RoutingItem> {
38
32
  const { domain, user, tx } = context.state
39
33
 
40
34
  const repository = tx.getRepository(RoutingItem)
41
35
  const routingItem = await repository.findOne({
42
- where: { domain, id }
36
+ where: { domain: { id: domain.id }, id }
43
37
  })
44
38
 
45
39
  return await repository.save({
@@ -53,7 +47,7 @@ export class RoutingItemMutation {
53
47
  @Mutation(returns => [RoutingItem], { description: "To modify multiple RoutingItems' information" })
54
48
  async updateMultipleRoutingItem(
55
49
  @Arg('patches', type => [RoutingItemPatch]) patches: RoutingItemPatch[],
56
- @Ctx() context: any
50
+ @Ctx() context: ResolverContext
57
51
  ): Promise<RoutingItem[]> {
58
52
  const { domain, user, tx } = context.state
59
53
 
@@ -80,7 +74,7 @@ export class RoutingItemMutation {
80
74
  if (_updateRecords.length > 0) {
81
75
  for (let i = 0; i < _updateRecords.length; i++) {
82
76
  const newRecord = _updateRecords[i]
83
- const routingItem = await routingItemRepo.findOne(newRecord.id)
77
+ const routingItem = await routingItemRepo.findOneBy({ id: newRecord.id })
84
78
 
85
79
  const result = await routingItemRepo.save({
86
80
  ...routingItem,
@@ -97,20 +91,23 @@ export class RoutingItemMutation {
97
91
 
98
92
  @Directive('@transaction')
99
93
  @Mutation(returns => Boolean, { description: 'To delete RoutingItem' })
100
- async deleteRoutingItem(@Arg('id') id: string, @Ctx() context: any): Promise<boolean> {
94
+ async deleteRoutingItem(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
101
95
  const { domain, tx } = context.state
102
96
 
103
- await tx.getRepository(RoutingItem).delete({ domain, id })
97
+ await tx.getRepository(RoutingItem).delete({ domain: { id: domain.id }, id })
104
98
  return true
105
99
  }
106
100
 
107
101
  @Directive('@transaction')
108
102
  @Mutation(returns => Boolean, { description: 'To delete multiple routingItems' })
109
- async deleteRoutingItems(@Arg('ids', type => [String]) ids: string[], @Ctx() context: any): Promise<boolean> {
103
+ async deleteRoutingItems(
104
+ @Arg('ids', type => [String]) ids: string[],
105
+ @Ctx() context: ResolverContext
106
+ ): Promise<boolean> {
110
107
  const { domain, tx } = context.state
111
108
 
112
109
  await tx.getRepository(RoutingItem).delete({
113
- domain,
110
+ domain: { id: domain.id },
114
111
  id: In(ids)
115
112
  })
116
113
 
@@ -1,8 +1,7 @@
1
1
  import { Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'
2
- import { getRepository } from 'typeorm'
3
2
 
4
3
  import { User } from '@things-factory/auth-base'
5
- import { Domain, getQueryBuilderFromListParams, ListParam } from '@things-factory/shell'
4
+ import { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
6
5
 
7
6
  import { Operation } from '../operation/operation'
8
7
  import { Routing } from '../routing/routing'
@@ -12,7 +11,7 @@ import { RoutingItemList } from './routing-item-type'
12
11
  @Resolver(RoutingItem)
13
12
  export class RoutingItemQuery {
14
13
  @Query(returns => RoutingItemList, { description: 'To fetch multiple RoutingItems' })
15
- async routingItems(@Args() params: ListParam, @Ctx() context: any): Promise<RoutingItemList> {
14
+ async routingItems(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<RoutingItemList> {
16
15
  const { domain } = context.state
17
16
 
18
17
  const queryBuilder = getQueryBuilderFromListParams({
@@ -33,26 +32,26 @@ export class RoutingItemQuery {
33
32
 
34
33
  @FieldResolver(type => Routing)
35
34
  async routing(@Root() routingItem: RoutingItem): Promise<Routing> {
36
- return routingItem.routing || (await getRepository(Routing).findOne(routingItem.routingId))
35
+ return routingItem.routing || (await getRepository(Routing).findOneBy({ id: routingItem.routingId }))
37
36
  }
38
37
 
39
38
  @FieldResolver(type => Operation)
40
39
  async operation(@Root() routingItem: RoutingItem): Promise<Operation> {
41
- return routingItem.operation || (await getRepository(Operation).findOne(routingItem.operationId))
40
+ return routingItem.operation || (await getRepository(Operation).findOneBy({ id: routingItem.operationId }))
42
41
  }
43
42
 
44
43
  @FieldResolver(type => Domain)
45
44
  async domain(@Root() routingItem: RoutingItem): Promise<Domain> {
46
- return await getRepository(Domain).findOne(routingItem.domainId)
45
+ return await getRepository(Domain).findOneBy({ id: routingItem.domainId })
47
46
  }
48
47
 
49
48
  @FieldResolver(type => User)
50
49
  async updater(@Root() routingItem: RoutingItem): Promise<User> {
51
- return await getRepository(User).findOne(routingItem.updaterId)
50
+ return await getRepository(User).findOneBy({ id: routingItem.updaterId })
52
51
  }
53
52
 
54
53
  @FieldResolver(type => User)
55
54
  async creator(@Root() routingItem: RoutingItem): Promise<User> {
56
- return await getRepository(User).findOne(routingItem.creatorId)
55
+ return await getRepository(User).findOneBy({ id: routingItem.creatorId })
57
56
  }
58
57
  }