@things-factory/menu-base 8.0.38 → 9.0.0-9.0.0-beta.59.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 +0 -1
- package/server/service/index.ts +0 -37
- package/server/service/menu/index.ts +0 -6
- package/server/service/menu/menu-mutation.ts +0 -244
- package/server/service/menu/menu-query.ts +0 -256
- package/server/service/menu/menu-type.ts +0 -78
- package/server/service/menu/menu.ts +0 -183
- package/server/service/menu-button/index.ts +0 -6
- package/server/service/menu-button/menu-button-mutation.ts +0 -142
- package/server/service/menu-button/menu-button-query.ts +0 -59
- package/server/service/menu-button/menu-button-type.ts +0 -31
- package/server/service/menu-button/menu-button.ts +0 -86
- package/server/service/menu-column/index.ts +0 -6
- package/server/service/menu-column/menu-column-mutation.ts +0 -143
- package/server/service/menu-column/menu-column-query.ts +0 -59
- package/server/service/menu-column/menu-column-type.ts +0 -92
- package/server/service/menu-column/menu-column.ts +0 -200
- package/server/service/menu-detail/index.ts +0 -6
- package/server/service/menu-detail/menu-detail-mutation.ts +0 -142
- package/server/service/menu-detail/menu-detail-query.ts +0 -75
- package/server/service/menu-detail/menu-detail-type.ts +0 -46
- package/server/service/menu-detail/menu-detail.ts +0 -111
- package/server/service/menu-detail-button/index.ts +0 -6
- package/server/service/menu-detail-button/menu-detail-button-mutation.ts +0 -143
- package/server/service/menu-detail-button/menu-detail-button-query.ts +0 -61
- package/server/service/menu-detail-button/menu-detail-button-type.ts +0 -34
- package/server/service/menu-detail-button/menu-detail-button.ts +0 -86
- package/server/service/menu-detail-column/index.ts +0 -6
- package/server/service/menu-detail-column/menu-detail-column-mutation.ts +0 -145
- package/server/service/menu-detail-column/menu-detail-column-query.ts +0 -61
- package/server/service/menu-detail-column/menu-detail-column-type.ts +0 -92
- package/server/service/menu-detail-column/menu-detail-column.ts +0 -205
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'
|
|
2
|
-
|
|
3
|
-
import { User } from '@things-factory/auth-base'
|
|
4
|
-
import { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
|
|
5
|
-
|
|
6
|
-
import { Menu } from '../menu/menu'
|
|
7
|
-
import { MenuColumn } from './menu-column'
|
|
8
|
-
import { MenuColumnList } from './menu-column-type'
|
|
9
|
-
|
|
10
|
-
@Resolver(MenuColumn)
|
|
11
|
-
export class MenuColumnQuery {
|
|
12
|
-
@Query(returns => MenuColumn, { description: 'To fetch a MenuColumn' })
|
|
13
|
-
async menuColumn(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<MenuColumn> {
|
|
14
|
-
const { domain } = context.state
|
|
15
|
-
|
|
16
|
-
return await getRepository(MenuColumn).findOne({
|
|
17
|
-
where: { domain: { id: domain.id }, id }
|
|
18
|
-
})
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
@Query(returns => MenuColumnList, { description: 'To fetch multiple MenuColumns' })
|
|
22
|
-
async menuColumns(
|
|
23
|
-
@Args(type => ListParam) params: ListParam,
|
|
24
|
-
@Ctx() context: ResolverContext
|
|
25
|
-
): Promise<MenuColumnList> {
|
|
26
|
-
const { domain } = context.state
|
|
27
|
-
|
|
28
|
-
const queryBuilder = getQueryBuilderFromListParams({
|
|
29
|
-
domain,
|
|
30
|
-
params,
|
|
31
|
-
repository: await getRepository(MenuColumn),
|
|
32
|
-
searchables: ['name', 'description']
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
const [items, total] = await queryBuilder.getManyAndCount()
|
|
36
|
-
|
|
37
|
-
return { items, total }
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
@FieldResolver(type => Menu)
|
|
41
|
-
async menu(@Root() menuColumn: MenuColumn): Promise<Menu> {
|
|
42
|
-
return menuColumn.menu || (await getRepository(Menu).findOneBy({ id: menuColumn.menuId }))
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
@FieldResolver(type => Domain)
|
|
46
|
-
async domain(@Root() menuColumn: MenuColumn): Promise<Domain> {
|
|
47
|
-
return await getRepository(Domain).findOneBy({ id: menuColumn.domainId })
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
@FieldResolver(type => User)
|
|
51
|
-
async updater(@Root() menuColumn: MenuColumn): Promise<User> {
|
|
52
|
-
return await getRepository(User).findOneBy({ id: menuColumn.updaterId })
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
@FieldResolver(type => User)
|
|
56
|
-
async creator(@Root() menuColumn: MenuColumn): Promise<User> {
|
|
57
|
-
return await getRepository(User).findOneBy({ id: menuColumn.creatorId })
|
|
58
|
-
}
|
|
59
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { Field, InputType, Int, ObjectType } from 'type-graphql'
|
|
2
|
-
|
|
3
|
-
import { MenuColumn } from './menu-column'
|
|
4
|
-
|
|
5
|
-
@InputType()
|
|
6
|
-
export class NewMenuColumn {
|
|
7
|
-
@Field() menu: string
|
|
8
|
-
@Field() name: string
|
|
9
|
-
@Field() colType: string
|
|
10
|
-
|
|
11
|
-
@Field({ nullable: true }) description?: string
|
|
12
|
-
@Field(type => Int, { nullable: true }) rank?: number
|
|
13
|
-
@Field({ nullable: true }) term?: string
|
|
14
|
-
@Field(type => Int, { nullable: true }) colSize?: number
|
|
15
|
-
@Field({ nullable: true }) nullable?: boolean
|
|
16
|
-
@Field({ nullable: true }) refType?: string
|
|
17
|
-
@Field({ nullable: true }) refName?: string
|
|
18
|
-
@Field({ nullable: true }) refUrl?: string
|
|
19
|
-
@Field({ nullable: true }) refParams?: string
|
|
20
|
-
@Field({ nullable: true }) refRelated?: string
|
|
21
|
-
@Field(type => Int, { nullable: true }) searchRank?: number
|
|
22
|
-
@Field(type => Int, { nullable: true }) sortRank?: number
|
|
23
|
-
@Field({ nullable: true }) reverseSort?: boolean
|
|
24
|
-
@Field({ nullable: true }) virtualField?: boolean
|
|
25
|
-
@Field({ nullable: true }) extField?: boolean
|
|
26
|
-
@Field({ nullable: true }) searchName?: string
|
|
27
|
-
@Field({ nullable: true }) searchEditor?: string
|
|
28
|
-
@Field({ nullable: true }) searchOper?: string
|
|
29
|
-
@Field({ nullable: true }) searchInitVal?: string
|
|
30
|
-
@Field(type => Int, { nullable: true }) gridRank?: number
|
|
31
|
-
@Field({ nullable: true }) gridEditor?: string
|
|
32
|
-
@Field({ nullable: true }) gridFormat?: string
|
|
33
|
-
@Field({ nullable: true }) gridValidator?: string
|
|
34
|
-
@Field(type => Int, { nullable: true }) gridWidth?: number
|
|
35
|
-
@Field({ nullable: true }) gridAlign?: string
|
|
36
|
-
@Field(type => Int, { nullable: true }) uniqRank?: number
|
|
37
|
-
@Field({ nullable: true }) formEditor?: string
|
|
38
|
-
@Field({ nullable: true }) formValidator?: string
|
|
39
|
-
@Field({ nullable: true }) formFormat?: string
|
|
40
|
-
@Field({ nullable: true }) defVal?: string
|
|
41
|
-
@Field({ nullable: true }) rangeVal?: string
|
|
42
|
-
@Field({ nullable: true }) ignoreOnSave?: boolean
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
@InputType()
|
|
46
|
-
export class MenuColumnPatch {
|
|
47
|
-
@Field({ nullable: true }) menu: string
|
|
48
|
-
@Field({ nullable: true }) name: string
|
|
49
|
-
@Field({ nullable: true }) colType: string
|
|
50
|
-
|
|
51
|
-
@Field({ nullable: true }) description?: string
|
|
52
|
-
@Field(type => Int, { nullable: true }) rank?: number
|
|
53
|
-
@Field({ nullable: true }) term?: string
|
|
54
|
-
@Field(type => Int, { nullable: true }) colSize?: number
|
|
55
|
-
@Field({ nullable: true }) nullable?: boolean
|
|
56
|
-
@Field({ nullable: true }) refType?: string
|
|
57
|
-
@Field({ nullable: true }) refName?: string
|
|
58
|
-
@Field({ nullable: true }) refUrl?: string
|
|
59
|
-
@Field({ nullable: true }) refParams?: string
|
|
60
|
-
@Field({ nullable: true }) refRelated?: string
|
|
61
|
-
@Field(type => Int, { nullable: true }) searchRank?: number
|
|
62
|
-
@Field(type => Int, { nullable: true }) sortRank?: number
|
|
63
|
-
@Field({ nullable: true }) reverseSort?: boolean
|
|
64
|
-
@Field({ nullable: true }) virtualField?: boolean
|
|
65
|
-
@Field({ nullable: true }) extField?: boolean
|
|
66
|
-
@Field({ nullable: true }) searchName?: string
|
|
67
|
-
@Field({ nullable: true }) searchEditor?: string
|
|
68
|
-
@Field({ nullable: true }) searchOper?: string
|
|
69
|
-
@Field({ nullable: true }) searchInitVal?: string
|
|
70
|
-
@Field(type => Int, { nullable: true }) gridRank?: number
|
|
71
|
-
@Field({ nullable: true }) gridEditor?: string
|
|
72
|
-
@Field({ nullable: true }) gridFormat?: string
|
|
73
|
-
@Field({ nullable: true }) gridValidator?: string
|
|
74
|
-
@Field(type => Int, { nullable: true }) gridWidth?: number
|
|
75
|
-
@Field({ nullable: true }) gridAlign?: string
|
|
76
|
-
@Field(type => Int, { nullable: true }) uniqRank?: number
|
|
77
|
-
@Field({ nullable: true }) formEditor?: string
|
|
78
|
-
@Field({ nullable: true }) formValidator?: string
|
|
79
|
-
@Field({ nullable: true }) formFormat?: string
|
|
80
|
-
@Field({ nullable: true }) defVal?: string
|
|
81
|
-
@Field({ nullable: true }) rangeVal?: string
|
|
82
|
-
@Field({ nullable: true }) ignoreOnSave?: boolean
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
@ObjectType()
|
|
86
|
-
export class MenuColumnList {
|
|
87
|
-
@Field(type => [MenuColumn])
|
|
88
|
-
items: MenuColumn[]
|
|
89
|
-
|
|
90
|
-
@Field(type => Int)
|
|
91
|
-
total: number
|
|
92
|
-
}
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import { Field, ID, 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 } from '@things-factory/shell'
|
|
15
|
-
|
|
16
|
-
import { Menu } from '../menu/menu'
|
|
17
|
-
|
|
18
|
-
@Entity()
|
|
19
|
-
@Index('ix_menu_column_0', (menuColumn: MenuColumn) => [menuColumn.domain, menuColumn.menu, menuColumn.name], {
|
|
20
|
-
unique: true
|
|
21
|
-
})
|
|
22
|
-
@Index('ix_menu_column_1', (menuColumn: MenuColumn) => [menuColumn.menu, menuColumn.rank])
|
|
23
|
-
@ObjectType({ description: 'Entity for MenuColumn' })
|
|
24
|
-
export class MenuColumn {
|
|
25
|
-
@PrimaryGeneratedColumn('uuid')
|
|
26
|
-
@Field(type => ID)
|
|
27
|
-
readonly id: string
|
|
28
|
-
|
|
29
|
-
@ManyToOne(type => Domain)
|
|
30
|
-
@Field(type => Domain)
|
|
31
|
-
domain?: Domain
|
|
32
|
-
|
|
33
|
-
@RelationId((menuColumn: MenuColumn) => menuColumn.domain)
|
|
34
|
-
domainId?: string
|
|
35
|
-
|
|
36
|
-
@Column()
|
|
37
|
-
@Field()
|
|
38
|
-
name: string
|
|
39
|
-
|
|
40
|
-
@Column({ nullable: true })
|
|
41
|
-
@Field({ nullable: true })
|
|
42
|
-
description?: string
|
|
43
|
-
|
|
44
|
-
@ManyToOne(type => Menu, menu => menu.columns)
|
|
45
|
-
@Field(type => Menu, { nullable: true })
|
|
46
|
-
menu?: Menu
|
|
47
|
-
|
|
48
|
-
@RelationId((menuColumn: MenuColumn) => menuColumn.menu)
|
|
49
|
-
menuId?: string
|
|
50
|
-
|
|
51
|
-
@Column({ nullable: true })
|
|
52
|
-
@Field({ nullable: true })
|
|
53
|
-
rank?: number
|
|
54
|
-
|
|
55
|
-
@Column({ nullable: true })
|
|
56
|
-
@Field({ nullable: true })
|
|
57
|
-
term?: string
|
|
58
|
-
|
|
59
|
-
@Column()
|
|
60
|
-
@Field({ nullable: true })
|
|
61
|
-
colType?: string
|
|
62
|
-
|
|
63
|
-
@Column('int', { nullable: true })
|
|
64
|
-
@Field({ nullable: true })
|
|
65
|
-
colSize?: number
|
|
66
|
-
|
|
67
|
-
@Column({ nullable: true, default: true })
|
|
68
|
-
@Field({ nullable: true })
|
|
69
|
-
nullable?: boolean = true
|
|
70
|
-
|
|
71
|
-
@Column({ nullable: true })
|
|
72
|
-
@Field({ nullable: true })
|
|
73
|
-
refType?: string
|
|
74
|
-
|
|
75
|
-
@Column({ nullable: true })
|
|
76
|
-
@Field({ nullable: true })
|
|
77
|
-
refName?: string
|
|
78
|
-
|
|
79
|
-
@Column({ nullable: true })
|
|
80
|
-
@Field({ nullable: true })
|
|
81
|
-
refUrl?: string
|
|
82
|
-
|
|
83
|
-
@Column({ nullable: true })
|
|
84
|
-
@Field({ nullable: true })
|
|
85
|
-
refParams?: string
|
|
86
|
-
|
|
87
|
-
@Column({ nullable: true })
|
|
88
|
-
@Field({ nullable: true })
|
|
89
|
-
refRelated?: string
|
|
90
|
-
|
|
91
|
-
@Column('int', { nullable: true })
|
|
92
|
-
@Field({ nullable: true })
|
|
93
|
-
searchRank?: number
|
|
94
|
-
|
|
95
|
-
@Column('int', { nullable: true })
|
|
96
|
-
@Field({ nullable: true })
|
|
97
|
-
sortRank?: number
|
|
98
|
-
|
|
99
|
-
@Column({ nullable: true })
|
|
100
|
-
@Field({ nullable: true })
|
|
101
|
-
reverseSort?: boolean
|
|
102
|
-
|
|
103
|
-
@Column({ nullable: true })
|
|
104
|
-
@Field({ nullable: true })
|
|
105
|
-
virtualField?: boolean
|
|
106
|
-
|
|
107
|
-
@Column({ nullable: true })
|
|
108
|
-
@Field({ nullable: true })
|
|
109
|
-
extField?: boolean
|
|
110
|
-
|
|
111
|
-
@Column({ nullable: true })
|
|
112
|
-
@Field({ nullable: true })
|
|
113
|
-
searchName?: string
|
|
114
|
-
|
|
115
|
-
@Column({ nullable: true })
|
|
116
|
-
@Field({ nullable: true })
|
|
117
|
-
searchEditor?: string
|
|
118
|
-
|
|
119
|
-
@Column({ nullable: true })
|
|
120
|
-
@Field({ nullable: true })
|
|
121
|
-
searchOper?: string
|
|
122
|
-
|
|
123
|
-
@Column({ nullable: true })
|
|
124
|
-
@Field({ nullable: true })
|
|
125
|
-
searchInitVal?: string
|
|
126
|
-
|
|
127
|
-
@Column('int', { nullable: true })
|
|
128
|
-
@Field({ nullable: true })
|
|
129
|
-
gridRank?: number
|
|
130
|
-
|
|
131
|
-
@Column({ nullable: true })
|
|
132
|
-
@Field({ nullable: true })
|
|
133
|
-
gridEditor?: string
|
|
134
|
-
|
|
135
|
-
@Column({ nullable: true })
|
|
136
|
-
@Field({ nullable: true })
|
|
137
|
-
gridFormat?: string
|
|
138
|
-
|
|
139
|
-
@Column({ nullable: true })
|
|
140
|
-
@Field({ nullable: true })
|
|
141
|
-
gridValidator?: string
|
|
142
|
-
|
|
143
|
-
@Column('int', { nullable: true })
|
|
144
|
-
@Field({ nullable: true })
|
|
145
|
-
gridWidth?: number
|
|
146
|
-
|
|
147
|
-
@Column({ nullable: true })
|
|
148
|
-
@Field({ nullable: true })
|
|
149
|
-
gridAlign?: string
|
|
150
|
-
|
|
151
|
-
@Column('int', { nullable: true })
|
|
152
|
-
@Field({ nullable: true })
|
|
153
|
-
uniqRank?: number
|
|
154
|
-
|
|
155
|
-
@Column({ nullable: true })
|
|
156
|
-
@Field({ nullable: true })
|
|
157
|
-
formEditor?: string
|
|
158
|
-
|
|
159
|
-
@Column({ nullable: true })
|
|
160
|
-
@Field({ nullable: true })
|
|
161
|
-
formValidator?: string
|
|
162
|
-
|
|
163
|
-
@Column({ nullable: true })
|
|
164
|
-
@Field({ nullable: true })
|
|
165
|
-
formFormat?: string
|
|
166
|
-
|
|
167
|
-
@Column({ nullable: true })
|
|
168
|
-
@Field({ nullable: true })
|
|
169
|
-
defVal?: string
|
|
170
|
-
|
|
171
|
-
@Column({ nullable: true })
|
|
172
|
-
@Field({ nullable: true })
|
|
173
|
-
rangeVal?: string
|
|
174
|
-
|
|
175
|
-
@Column({ nullable: true, default: false })
|
|
176
|
-
@Field({ nullable: true })
|
|
177
|
-
ignoreOnSave?: boolean = false
|
|
178
|
-
|
|
179
|
-
@CreateDateColumn()
|
|
180
|
-
@Field({ nullable: true })
|
|
181
|
-
createdAt?: Date
|
|
182
|
-
|
|
183
|
-
@UpdateDateColumn()
|
|
184
|
-
@Field({ nullable: true })
|
|
185
|
-
updatedAt?: Date
|
|
186
|
-
|
|
187
|
-
@ManyToOne(type => User, { nullable: true })
|
|
188
|
-
@Field(type => User, { nullable: true })
|
|
189
|
-
creator?: User
|
|
190
|
-
|
|
191
|
-
@RelationId((menuColumn: MenuColumn) => menuColumn.creator)
|
|
192
|
-
creatorId?: string
|
|
193
|
-
|
|
194
|
-
@ManyToOne(type => User, { nullable: true })
|
|
195
|
-
@Field(type => User, { nullable: true })
|
|
196
|
-
updater?: User
|
|
197
|
-
|
|
198
|
-
@RelationId((menuColumn: MenuColumn) => menuColumn.updater)
|
|
199
|
-
updaterId?: string
|
|
200
|
-
}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'
|
|
2
|
-
import { In } from 'typeorm'
|
|
3
|
-
|
|
4
|
-
import { Menu } from '../menu/menu'
|
|
5
|
-
import { MenuDetail } from './menu-detail'
|
|
6
|
-
import { MenuDetailPatch, NewMenuDetail } from './menu-detail-type'
|
|
7
|
-
|
|
8
|
-
@Resolver(MenuDetail)
|
|
9
|
-
export class MenuDetailMutation {
|
|
10
|
-
@Directive('@transaction')
|
|
11
|
-
@Mutation(returns => MenuDetail, { description: 'To create new MenuDetail' })
|
|
12
|
-
async createMenuDetail(
|
|
13
|
-
@Arg('menuDetail') menuDetail: NewMenuDetail,
|
|
14
|
-
@Ctx() context: ResolverContext
|
|
15
|
-
): Promise<MenuDetail> {
|
|
16
|
-
const { domain, user, tx } = context.state
|
|
17
|
-
|
|
18
|
-
return await tx.getRepository(MenuDetail).save({
|
|
19
|
-
...(menuDetail as any),
|
|
20
|
-
menu: await tx.getRepository(Menu).findOne({ where: { domain: { id: domain.id }, id: menuDetail.menu } }),
|
|
21
|
-
domain,
|
|
22
|
-
creator: user,
|
|
23
|
-
updater: user
|
|
24
|
-
})
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
@Directive('@transaction')
|
|
28
|
-
@Mutation(returns => MenuDetail, { description: 'To modify MenuDetail information' })
|
|
29
|
-
async updateMenuDetail(
|
|
30
|
-
@Arg('id') id: string,
|
|
31
|
-
@Arg('patch') patch: MenuDetailPatch,
|
|
32
|
-
@Ctx() context: ResolverContext
|
|
33
|
-
): Promise<MenuDetail> {
|
|
34
|
-
const { domain, user, tx } = context.state
|
|
35
|
-
|
|
36
|
-
const repository = tx.getRepository(MenuDetail)
|
|
37
|
-
const menuDetail = await repository.findOne({
|
|
38
|
-
where: { domain: { id: domain.id }, id },
|
|
39
|
-
relations: ['menu']
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
if (patch.menu) {
|
|
43
|
-
patch.menu = (await tx.getRepository(Menu).findOne({
|
|
44
|
-
where: { domain: { id: domain.id }, id: menuDetail.menu.id }
|
|
45
|
-
})) as any
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return await repository.save({
|
|
49
|
-
...menuDetail,
|
|
50
|
-
...(patch as any),
|
|
51
|
-
updater: user
|
|
52
|
-
})
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// @Directive('@transaction')
|
|
56
|
-
// @Mutation(returns => [MenuDetail], { description: "To modify multiple MenuDetails' information" })
|
|
57
|
-
// async updateMultipleMenuDetail(
|
|
58
|
-
// @Arg('patches', type => [MenuDetailPatch]) patches: MenuDetailPatch[],
|
|
59
|
-
// @Ctx() context: ResolverContext
|
|
60
|
-
// ): Promise<MenuDetail[]> {
|
|
61
|
-
// const { domain, user, tx } = context.state
|
|
62
|
-
|
|
63
|
-
// let results = []
|
|
64
|
-
// const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
|
|
65
|
-
// const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
|
|
66
|
-
// const menuDetailRepo = tx.getRepository(MenuDetail)
|
|
67
|
-
|
|
68
|
-
// if (_createRecords.length > 0) {
|
|
69
|
-
// for (let i = 0; i < _createRecords.length; i++) {
|
|
70
|
-
// const newRecord = _createRecords[i]
|
|
71
|
-
|
|
72
|
-
// const result = await menuDetailRepo.save({
|
|
73
|
-
// ...newRecord,
|
|
74
|
-
// domain,
|
|
75
|
-
// creator: user,
|
|
76
|
-
// updater: user
|
|
77
|
-
// })
|
|
78
|
-
|
|
79
|
-
// results.push({ ...result, cuFlag: '+' })
|
|
80
|
-
// }
|
|
81
|
-
// }
|
|
82
|
-
|
|
83
|
-
// if (_updateRecords.length > 0) {
|
|
84
|
-
// for (let i = 0; i < _updateRecords.length; i++) {
|
|
85
|
-
// const newRecord = _updateRecords[i]
|
|
86
|
-
// const menuDetail = await menuDetailRepo.findOneBy({ id: newRecord.id })
|
|
87
|
-
|
|
88
|
-
// const result = await menuDetailRepo.save({
|
|
89
|
-
// ...menuDetail,
|
|
90
|
-
// ...newRecord,
|
|
91
|
-
// updater: user
|
|
92
|
-
// })
|
|
93
|
-
|
|
94
|
-
// results.push({ ...result, cuFlag: 'M' })
|
|
95
|
-
// }
|
|
96
|
-
// }
|
|
97
|
-
|
|
98
|
-
// return results
|
|
99
|
-
// }
|
|
100
|
-
|
|
101
|
-
@Directive('@transaction')
|
|
102
|
-
@Mutation(returns => Boolean, { description: 'To delete MenuDetail' })
|
|
103
|
-
async deleteMenuDetail(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
|
|
104
|
-
const { domain, tx } = context.state
|
|
105
|
-
|
|
106
|
-
await tx.getRepository(MenuDetail).delete({ domain: { id: domain.id }, id })
|
|
107
|
-
return true
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
@Directive('@transaction')
|
|
111
|
-
@Mutation(returns => Boolean, { description: 'To delete multiple MenuDetails' })
|
|
112
|
-
async deleteMenuDetails(
|
|
113
|
-
@Arg('ids', type => [String]) ids: string[],
|
|
114
|
-
@Ctx() context: ResolverContext
|
|
115
|
-
): Promise<boolean> {
|
|
116
|
-
const { domain, tx } = context.state
|
|
117
|
-
|
|
118
|
-
await tx.getRepository(MenuDetail).delete({
|
|
119
|
-
domain: { id: domain.id },
|
|
120
|
-
id: In(ids)
|
|
121
|
-
})
|
|
122
|
-
|
|
123
|
-
return true
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
@Directive('@transaction')
|
|
127
|
-
@Mutation(returns => Boolean, { description: 'To import multiple MenuDetails' })
|
|
128
|
-
async importMenuDetails(
|
|
129
|
-
@Arg('menuDetails', type => [MenuDetailPatch]) menuDetails: MenuDetailPatch[],
|
|
130
|
-
@Ctx() context: ResolverContext
|
|
131
|
-
): Promise<boolean> {
|
|
132
|
-
const { domain, tx } = context.state
|
|
133
|
-
|
|
134
|
-
await Promise.all(
|
|
135
|
-
menuDetails.map(async (menuDetail: MenuDetailPatch) => {
|
|
136
|
-
await tx.getRepository(MenuDetail).save({ domain, ...(menuDetail as any) })
|
|
137
|
-
})
|
|
138
|
-
)
|
|
139
|
-
|
|
140
|
-
return true
|
|
141
|
-
}
|
|
142
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'
|
|
2
|
-
|
|
3
|
-
import { User } from '@things-factory/auth-base'
|
|
4
|
-
import { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
|
|
5
|
-
|
|
6
|
-
import { MenuDetailButton } from '../menu-detail-button/menu-detail-button'
|
|
7
|
-
import { MenuDetailColumn } from '../menu-detail-column/menu-detail-column'
|
|
8
|
-
import { Menu } from '../menu/menu'
|
|
9
|
-
import { MenuDetail } from './menu-detail'
|
|
10
|
-
import { MenuDetailList } from './menu-detail-type'
|
|
11
|
-
|
|
12
|
-
@Resolver(MenuDetail)
|
|
13
|
-
export class MenuDetailQuery {
|
|
14
|
-
@Query(returns => MenuDetail, { description: 'To fetch a MenuDetail' })
|
|
15
|
-
async menuDetail(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<MenuDetail> {
|
|
16
|
-
const { domain } = context.state
|
|
17
|
-
|
|
18
|
-
return await getRepository(MenuDetail).findOne({
|
|
19
|
-
where: { domain: { id: domain.id }, id }
|
|
20
|
-
})
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
@Query(returns => MenuDetailList, { description: 'To fetch multiple MenuDetails' })
|
|
24
|
-
async menuDetails(
|
|
25
|
-
@Args(type => ListParam) params: ListParam,
|
|
26
|
-
@Ctx() context: ResolverContext
|
|
27
|
-
): Promise<MenuDetailList> {
|
|
28
|
-
const { domain } = context.state
|
|
29
|
-
|
|
30
|
-
const queryBuilder = getQueryBuilderFromListParams({
|
|
31
|
-
domain,
|
|
32
|
-
params,
|
|
33
|
-
repository: await getRepository(MenuDetail),
|
|
34
|
-
searchables: ['name', 'description']
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
const [items, total] = await queryBuilder.getManyAndCount()
|
|
38
|
-
|
|
39
|
-
return { items, total }
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@FieldResolver(type => [Menu])
|
|
43
|
-
async menu(@Root() menuDetail: MenuDetail): Promise<Menu> {
|
|
44
|
-
return menuDetail.menu || (await getRepository(Menu).findOneBy({ id: menuDetail.menuId }))
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
@FieldResolver(type => [MenuDetailButton])
|
|
48
|
-
async buttons(@Root() menuDetail: MenuDetail): Promise<MenuDetailButton[]> {
|
|
49
|
-
return await getRepository(MenuDetailButton).findBy({
|
|
50
|
-
menuDetail: { id: menuDetail.id }
|
|
51
|
-
})
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
@FieldResolver(type => [MenuDetailColumn])
|
|
55
|
-
async columns(@Root() menuDetail: MenuDetail): Promise<MenuDetailColumn[]> {
|
|
56
|
-
return await getRepository(MenuDetailColumn).findBy({
|
|
57
|
-
menuDetail: { id: menuDetail.id }
|
|
58
|
-
})
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
@FieldResolver(type => Domain)
|
|
62
|
-
async domain(@Root() menuDetail: MenuDetail): Promise<Domain> {
|
|
63
|
-
return await getRepository(Domain).findOneBy({ id: menuDetail.domainId })
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
@FieldResolver(type => User)
|
|
67
|
-
async updater(@Root() menuDetail: MenuDetail): Promise<User> {
|
|
68
|
-
return await getRepository(User).findOneBy({ id: menuDetail.updaterId })
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
@FieldResolver(type => User)
|
|
72
|
-
async creator(@Root() menuDetail: MenuDetail): Promise<User> {
|
|
73
|
-
return await getRepository(User).findOneBy({ id: menuDetail.creatorId })
|
|
74
|
-
}
|
|
75
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { Field, InputType, Int, ObjectType } from 'type-graphql'
|
|
2
|
-
|
|
3
|
-
import { MenuDetail } from './menu-detail'
|
|
4
|
-
|
|
5
|
-
@InputType()
|
|
6
|
-
export class NewMenuDetail {
|
|
7
|
-
@Field() menu: string
|
|
8
|
-
@Field() name: string
|
|
9
|
-
@Field() viewSection: string
|
|
10
|
-
|
|
11
|
-
@Field({ nullable: true }) entityId?: string
|
|
12
|
-
@Field({ nullable: true }) dataProp?: string
|
|
13
|
-
@Field({ nullable: true }) association?: string
|
|
14
|
-
@Field({ nullable: true }) searchUrl?: string
|
|
15
|
-
@Field({ nullable: true }) saveUrl?: string
|
|
16
|
-
@Field({ nullable: true }) masterField?: string
|
|
17
|
-
@Field({ nullable: true }) customView?: string
|
|
18
|
-
@Field(type => [String], { nullable: true }) columns?: string[]
|
|
19
|
-
@Field(type => [String], { nullable: true }) buttons?: string[]
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
@InputType()
|
|
23
|
-
export class MenuDetailPatch {
|
|
24
|
-
@Field({ nullable: true }) menu?: string
|
|
25
|
-
@Field({ nullable: true }) name?: string
|
|
26
|
-
@Field({ nullable: true }) viewSection?: string
|
|
27
|
-
|
|
28
|
-
@Field({ nullable: true }) entityId?: string
|
|
29
|
-
@Field({ nullable: true }) dataProp?: string
|
|
30
|
-
@Field({ nullable: true }) association?: string
|
|
31
|
-
@Field({ nullable: true }) searchUrl?: string
|
|
32
|
-
@Field({ nullable: true }) saveUrl?: string
|
|
33
|
-
@Field({ nullable: true }) masterField?: string
|
|
34
|
-
@Field({ nullable: true }) customView?: string
|
|
35
|
-
@Field(type => [String], { nullable: true }) columns?: string[]
|
|
36
|
-
@Field(type => [String], { nullable: true }) buttons?: string[]
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
@ObjectType()
|
|
40
|
-
export class MenuDetailList {
|
|
41
|
-
@Field(type => [MenuDetail])
|
|
42
|
-
items: MenuDetail[]
|
|
43
|
-
|
|
44
|
-
@Field(type => Int)
|
|
45
|
-
total: number
|
|
46
|
-
}
|