@dssp/project 0.0.36 → 1.0.0-alpha.1
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-client/pages/project/project-schedule.js +31 -22
- package/dist-client/pages/project/project-schedule.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -11
- package/client/bootstrap.ts +0 -0
- package/client/index.ts +0 -0
- package/client/pages/lib/select2-component.ts +0 -175
- package/client/pages/lib/waether.ts +0 -159
- package/client/pages/project/component/project-update-header.ts +0 -88
- package/client/pages/project/popup/popup-plan-upload.ts +0 -138
- package/client/pages/project/popup/popup-project-create.ts +0 -147
- package/client/pages/project/popup/popup-schedule-upload.ts +0 -102
- package/client/pages/project/project-completed-list.ts +0 -281
- package/client/pages/project/project-detail.ts +0 -738
- package/client/pages/project/project-list.ts +0 -418
- package/client/pages/project/project-plan-management.ts +0 -476
- package/client/pages/project/project-schedule-list.ts +0 -294
- package/client/pages/project/project-schedule.ts +0 -393
- package/client/pages/project/project-setting-list.ts +0 -393
- package/client/pages/project/project-update.ts +0 -876
- package/client/pages/resource/construction-detail-type-popup.ts +0 -201
- package/client/pages/resource/construction-type-management.ts +0 -212
- package/client/pages/resource/inspection-drawing-type-management.ts +0 -245
- package/client/pages/resource/inspection-part-popup.ts +0 -201
- package/client/pages/resource/resource-importer.ts +0 -97
- package/client/pages/resource/resource-list-page.ts +0 -356
- package/client/pages/resource/worker-type-management.ts +0 -192
- package/client/pages/task/task-importer.ts +0 -94
- package/client/pages/task/task-list-page.ts +0 -340
- package/client/pages/task-resource/task-resource-importer.ts +0 -97
- package/client/pages/task-resource/task-resource-list-page.ts +0 -356
- package/client/route.ts +0 -55
- package/client/tsconfig.json +0 -11
- package/server/controllers/export-tasks.ts +0 -40
- package/server/controllers/import-task.ts +0 -134
- package/server/controllers/index.ts +0 -0
- package/server/controllers/parse-excel.ts +0 -86
- package/server/controllers/types.ts +0 -20
- package/server/index.ts +0 -4
- package/server/middlewares/index.ts +0 -3
- package/server/migrations/1723861466413-seed-roles.ts +0 -128
- package/server/migrations/1723861466414-seed-codes.ts +0 -157
- package/server/migrations/1723861476419-seed-resources.ts +0 -62
- package/server/migrations/1723861478420-seed-/bsample-project.ts +0 -87
- package/server/migrations/1723861478421-seed-/bsample-tasks.ts +0 -194
- package/server/migrations/index.ts +0 -9
- package/server/routes.ts +0 -108
- package/server/service/construction-detail-type/construction-detail-type-mutation.ts +0 -57
- package/server/service/construction-detail-type/construction-detail-type-query.ts +0 -31
- package/server/service/construction-detail-type/construction-detail-type-type.ts +0 -26
- package/server/service/construction-detail-type/construction-detail-type.ts +0 -52
- package/server/service/construction-detail-type/index.ts +0 -6
- package/server/service/construction-type/construction-type-mutation.ts +0 -66
- package/server/service/construction-type/construction-type-query.ts +0 -56
- package/server/service/construction-type/construction-type-type.ts +0 -26
- package/server/service/construction-type/construction-type.ts +0 -74
- package/server/service/construction-type/index.ts +0 -6
- package/server/service/index.ts +0 -56
- package/server/service/inspection-drawing-type/index.ts +0 -6
- package/server/service/inspection-drawing-type/inspection-drawing-type-mutation.ts +0 -69
- package/server/service/inspection-drawing-type/inspection-drawing-type-query.ts +0 -55
- package/server/service/inspection-drawing-type/inspection-drawing-type-type.ts +0 -23
- package/server/service/inspection-drawing-type/inspection-drawing-type.ts +0 -68
- package/server/service/inspection-part/index.ts +0 -6
- package/server/service/inspection-part/inspection-part-mutation.ts +0 -52
- package/server/service/inspection-part/inspection-part-query.ts +0 -41
- package/server/service/inspection-part/inspection-part-type.ts +0 -26
- package/server/service/inspection-part/inspection-part.ts +0 -51
- package/server/service/manager/index.ts +0 -6
- package/server/service/manager/manager-mutation.ts +0 -42
- package/server/service/manager/manager-query.ts +0 -28
- package/server/service/manager/manager-type.ts +0 -40
- package/server/service/manager/manager.ts +0 -29
- package/server/service/project/index.ts +0 -6
- package/server/service/project/project-mutation.ts +0 -255
- package/server/service/project/project-query.ts +0 -105
- package/server/service/project/project-type.ts +0 -72
- package/server/service/project/project.ts +0 -134
- package/server/service/resource/index.ts +0 -7
- package/server/service/resource/resource-mutation.ts +0 -137
- package/server/service/resource/resource-query.ts +0 -50
- package/server/service/resource/resource-type.ts +0 -41
- package/server/service/resource/resource.ts +0 -82
- package/server/service/task/index.ts +0 -6
- package/server/service/task/task-mutation.ts +0 -135
- package/server/service/task/task-query.ts +0 -169
- package/server/service/task/task-type.ts +0 -75
- package/server/service/task/task.ts +0 -130
- package/server/service/task-resource/index.ts +0 -7
- package/server/service/task-resource/task-resource-mutation.ts +0 -140
- package/server/service/task-resource/task-resource-query.ts +0 -36
- package/server/service/task-resource/task-resource-type.ts +0 -41
- package/server/service/task-resource/task-resource.ts +0 -51
- package/server/service/worker-type/index.ts +0 -6
- package/server/service/worker-type/worker-type-mutation.ts +0 -66
- package/server/service/worker-type/worker-type-query.ts +0 -47
- package/server/service/worker-type/worker-type-type.ts +0 -26
- package/server/service/worker-type/worker-type.ts +0 -68
- package/server/tsconfig.json +0 -10
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'
|
|
2
|
-
import { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
|
|
3
|
-
import { User } from '@things-factory/auth-base'
|
|
4
|
-
import { InspectionDrawingType } from './inspection-drawing-type'
|
|
5
|
-
import { InspectionDrawingTypeList } from './inspection-drawing-type-type'
|
|
6
|
-
import { InspectionPart } from '../inspection-part/inspection-part'
|
|
7
|
-
|
|
8
|
-
@Resolver(InspectionDrawingType)
|
|
9
|
-
export class InspectionDrawingTypeQuery {
|
|
10
|
-
@Query(returns => InspectionDrawingType!, { nullable: true, description: 'To fetch a InspectionDrawingType' })
|
|
11
|
-
async inspectionDrawingType(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<InspectionDrawingType> {
|
|
12
|
-
const { domain } = context.state
|
|
13
|
-
|
|
14
|
-
return await getRepository(InspectionDrawingType).findOne({
|
|
15
|
-
where: { domain: { id: domain.id }, id }
|
|
16
|
-
})
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
@Query(returns => InspectionDrawingTypeList, { description: 'To fetch multiple InspectionDrawingTypes' })
|
|
20
|
-
async inspectionDrawingTypes(
|
|
21
|
-
@Args(type => ListParam) params: ListParam,
|
|
22
|
-
@Ctx() context: ResolverContext
|
|
23
|
-
): Promise<InspectionDrawingTypeList> {
|
|
24
|
-
const { domain } = context.state
|
|
25
|
-
|
|
26
|
-
const queryBuilder = getQueryBuilderFromListParams({
|
|
27
|
-
domain,
|
|
28
|
-
params,
|
|
29
|
-
repository: await getRepository(InspectionDrawingType),
|
|
30
|
-
searchables: ['name']
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
const [items, total] = await queryBuilder.getManyAndCount()
|
|
34
|
-
|
|
35
|
-
return { items, total }
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
@FieldResolver(type => [InspectionPart])
|
|
39
|
-
async inspectionParts(@Root() inspectionDrawingType: InspectionDrawingType): Promise<InspectionPart[]> {
|
|
40
|
-
return await getRepository(InspectionPart).find({
|
|
41
|
-
where: { inspectionDrawingType: { id: inspectionDrawingType.id } },
|
|
42
|
-
order: { sequence: 'ASC' }
|
|
43
|
-
})
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
@FieldResolver(type => User)
|
|
47
|
-
async updater(@Root() inspectionDrawingType: InspectionDrawingType): Promise<User> {
|
|
48
|
-
return inspectionDrawingType.updaterId && (await getRepository(User).findOneBy({ id: inspectionDrawingType.updaterId }))
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
@FieldResolver(type => User)
|
|
52
|
-
async creator(@Root() inspectionDrawingType: InspectionDrawingType): Promise<User> {
|
|
53
|
-
return inspectionDrawingType.creatorId && (await getRepository(User).findOneBy({ id: inspectionDrawingType.creatorId }))
|
|
54
|
-
}
|
|
55
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'
|
|
2
|
-
import { InspectionDrawingType } from './inspection-drawing-type'
|
|
3
|
-
|
|
4
|
-
@InputType()
|
|
5
|
-
export class InspectionDrawingTypePatch {
|
|
6
|
-
@Field(type => ID, { nullable: true })
|
|
7
|
-
id?: string
|
|
8
|
-
|
|
9
|
-
@Field({ nullable: true })
|
|
10
|
-
name?: string
|
|
11
|
-
|
|
12
|
-
@Field({ nullable: true })
|
|
13
|
-
cuFlag?: string
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
@ObjectType()
|
|
17
|
-
export class InspectionDrawingTypeList {
|
|
18
|
-
@Field(type => [InspectionDrawingType])
|
|
19
|
-
items: InspectionDrawingType[]
|
|
20
|
-
|
|
21
|
-
@Field(type => Int)
|
|
22
|
-
total: number
|
|
23
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CreateDateColumn,
|
|
3
|
-
UpdateDateColumn,
|
|
4
|
-
Entity,
|
|
5
|
-
Index,
|
|
6
|
-
Column,
|
|
7
|
-
RelationId,
|
|
8
|
-
ManyToOne,
|
|
9
|
-
OneToMany,
|
|
10
|
-
PrimaryGeneratedColumn
|
|
11
|
-
} from 'typeorm'
|
|
12
|
-
import { ObjectType, Field, ID } from 'type-graphql'
|
|
13
|
-
import { User } from '@things-factory/auth-base'
|
|
14
|
-
import { Domain } from '@things-factory/shell'
|
|
15
|
-
import { InspectionPart } from '../inspection-part/inspection-part'
|
|
16
|
-
|
|
17
|
-
@Entity()
|
|
18
|
-
@Index(
|
|
19
|
-
'ix_inspection_drawing_type_0',
|
|
20
|
-
(inspectionDrawingType: InspectionDrawingType) => [inspectionDrawingType.domain, inspectionDrawingType.name],
|
|
21
|
-
{
|
|
22
|
-
unique: true
|
|
23
|
-
}
|
|
24
|
-
)
|
|
25
|
-
@ObjectType({ description: 'Entity for InspectionDrawingType' })
|
|
26
|
-
export class InspectionDrawingType {
|
|
27
|
-
@PrimaryGeneratedColumn('uuid')
|
|
28
|
-
@Field(type => ID)
|
|
29
|
-
readonly id: string
|
|
30
|
-
|
|
31
|
-
@ManyToOne(type => Domain)
|
|
32
|
-
@Field({ nullable: true })
|
|
33
|
-
domain?: Domain
|
|
34
|
-
|
|
35
|
-
@RelationId((inspectionDrawingType: InspectionDrawingType) => inspectionDrawingType.domain)
|
|
36
|
-
domainId?: string
|
|
37
|
-
|
|
38
|
-
@Column({ nullable: false, comment: '검측 도면 타입 이름' })
|
|
39
|
-
@Field({ nullable: true })
|
|
40
|
-
name?: string
|
|
41
|
-
|
|
42
|
-
// 검측 부위 정보 (하위 테이블 참조)
|
|
43
|
-
@Field(() => [InspectionPart], { nullable: true })
|
|
44
|
-
@OneToMany(() => InspectionPart, inspectionPart => inspectionPart.inspectionDrawingType)
|
|
45
|
-
inspectionParts?: InspectionPart[]
|
|
46
|
-
|
|
47
|
-
@CreateDateColumn()
|
|
48
|
-
@Field({ nullable: true })
|
|
49
|
-
createdAt?: Date
|
|
50
|
-
|
|
51
|
-
@UpdateDateColumn()
|
|
52
|
-
@Field({ nullable: true })
|
|
53
|
-
updatedAt?: Date
|
|
54
|
-
|
|
55
|
-
@ManyToOne(type => User, { nullable: true })
|
|
56
|
-
@Field(type => User, { nullable: true })
|
|
57
|
-
creator?: User
|
|
58
|
-
|
|
59
|
-
@RelationId((inspectionDrawingType: InspectionDrawingType) => inspectionDrawingType.creator)
|
|
60
|
-
creatorId?: string
|
|
61
|
-
|
|
62
|
-
@ManyToOne(type => User, { nullable: true })
|
|
63
|
-
@Field(type => User, { nullable: true })
|
|
64
|
-
updater?: User
|
|
65
|
-
|
|
66
|
-
@RelationId((inspectionDrawingType: InspectionDrawingType) => inspectionDrawingType.updater)
|
|
67
|
-
updaterId?: string
|
|
68
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { InspectionPart } from './inspection-part'
|
|
2
|
-
import { InspectionPartQuery } from './inspection-part-query'
|
|
3
|
-
import { InspectionPartMutation } from './inspection-part-mutation'
|
|
4
|
-
|
|
5
|
-
export const entities = [InspectionPart]
|
|
6
|
-
export const resolvers = [InspectionPartQuery, InspectionPartMutation]
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
|
|
2
|
-
import { In } from 'typeorm'
|
|
3
|
-
import { getRepository } from '@things-factory/shell'
|
|
4
|
-
import { InspectionPart } from './inspection-part'
|
|
5
|
-
import { InspectionPartPatch } from './inspection-part-type'
|
|
6
|
-
import { InspectionDrawingType } from '../inspection-drawing-type/inspection-drawing-type'
|
|
7
|
-
|
|
8
|
-
@Resolver(InspectionPart)
|
|
9
|
-
export class InspectionPartMutation {
|
|
10
|
-
@Directive('@transaction')
|
|
11
|
-
@Mutation(returns => [InspectionPart], { description: "To modify multiple InspectionParts' information" })
|
|
12
|
-
async updateMultipleInspectionPart(
|
|
13
|
-
@Arg('patches', type => [InspectionPartPatch]) patches: InspectionPartPatch[],
|
|
14
|
-
@Arg('inspectionDrawingTypeId') inspectionDrawingTypeId: string,
|
|
15
|
-
@Ctx() context: ResolverContext
|
|
16
|
-
): Promise<InspectionPart[]> {
|
|
17
|
-
const { user, tx } = context.state
|
|
18
|
-
|
|
19
|
-
let results = []
|
|
20
|
-
|
|
21
|
-
const inspectionPartRepo = tx.getRepository(InspectionPart)
|
|
22
|
-
const inspectionDrawingType = await tx.getRepository(InspectionDrawingType).findOneBy({ id: inspectionDrawingTypeId })
|
|
23
|
-
|
|
24
|
-
await inspectionPartRepo.delete({ inspectionDrawingType: { id: inspectionDrawingTypeId } })
|
|
25
|
-
|
|
26
|
-
for (let i = 0; i < patches.length; i++) {
|
|
27
|
-
const result = await inspectionPartRepo.save({
|
|
28
|
-
...patches[i],
|
|
29
|
-
sequence: i,
|
|
30
|
-
inspectionDrawingType,
|
|
31
|
-
creator: user,
|
|
32
|
-
updater: user
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
results.push({ ...result, cuFlag: '+' })
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return results
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
@Directive('@transaction')
|
|
42
|
-
@Mutation(returns => Boolean, { description: 'To delete multiple InspectionParts' })
|
|
43
|
-
async deleteInspectionParts(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {
|
|
44
|
-
const { domain, tx } = context.state
|
|
45
|
-
|
|
46
|
-
await getRepository(InspectionPart, tx).delete({
|
|
47
|
-
id: In(ids)
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
return true
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx } from 'type-graphql'
|
|
2
|
-
import { getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
|
|
3
|
-
import { User } from '@things-factory/auth-base'
|
|
4
|
-
import { InspectionPart } from './inspection-part'
|
|
5
|
-
import { InspectionPartList } from './inspection-part-type'
|
|
6
|
-
|
|
7
|
-
@Resolver(InspectionPart)
|
|
8
|
-
export class InspectionPartQuery {
|
|
9
|
-
@Query(returns => InspectionPart!, { nullable: true, description: 'To fetch a InspectionPart' })
|
|
10
|
-
async inspectionPart(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<InspectionPart> {
|
|
11
|
-
return await getRepository(InspectionPart).findOne({
|
|
12
|
-
where: { id }
|
|
13
|
-
})
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
@Query(returns => InspectionPartList, { description: 'To fetch multiple InspectionParts' })
|
|
17
|
-
async inspectionParts(
|
|
18
|
-
@Args(type => ListParam) params: ListParam,
|
|
19
|
-
@Ctx() context: ResolverContext
|
|
20
|
-
): Promise<InspectionPartList> {
|
|
21
|
-
const queryBuilder = getQueryBuilderFromListParams({
|
|
22
|
-
params,
|
|
23
|
-
repository: await getRepository(InspectionPart),
|
|
24
|
-
searchables: ['name', 'description']
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
const [items, total] = await queryBuilder.getManyAndCount()
|
|
28
|
-
|
|
29
|
-
return { items, total }
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
@FieldResolver(type => User)
|
|
33
|
-
async updater(@Root() inspectionPart: InspectionPart): Promise<User> {
|
|
34
|
-
return inspectionPart.updaterId && (await getRepository(User).findOneBy({ id: inspectionPart.updaterId }))
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
@FieldResolver(type => User)
|
|
38
|
-
async creator(@Root() inspectionPart: InspectionPart): Promise<User> {
|
|
39
|
-
return inspectionPart.creatorId && (await getRepository(User).findOneBy({ id: inspectionPart.creatorId }))
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'
|
|
2
|
-
import { InspectionPart } from './inspection-part'
|
|
3
|
-
|
|
4
|
-
@InputType()
|
|
5
|
-
export class InspectionPartPatch {
|
|
6
|
-
@Field(type => ID, { nullable: true })
|
|
7
|
-
id?: string
|
|
8
|
-
|
|
9
|
-
@Field({ nullable: true })
|
|
10
|
-
name?: string
|
|
11
|
-
|
|
12
|
-
@Field(type => Int, { nullable: true })
|
|
13
|
-
sequence?: number
|
|
14
|
-
|
|
15
|
-
@Field({ nullable: true })
|
|
16
|
-
cuFlag?: string
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
@ObjectType()
|
|
20
|
-
export class InspectionPartList {
|
|
21
|
-
@Field(type => [InspectionPart])
|
|
22
|
-
items: InspectionPart[]
|
|
23
|
-
|
|
24
|
-
@Field(type => Int)
|
|
25
|
-
total: number
|
|
26
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { CreateDateColumn, UpdateDateColumn, Entity, Index, Column, RelationId, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'
|
|
2
|
-
import { ObjectType, Field, ID, Int } from 'type-graphql'
|
|
3
|
-
import { User } from '@things-factory/auth-base'
|
|
4
|
-
import { InspectionDrawingType } from '../inspection-drawing-type/inspection-drawing-type'
|
|
5
|
-
|
|
6
|
-
@Entity()
|
|
7
|
-
@Index('ix_inspection_part_0', (inspectionPart: InspectionPart) => [inspectionPart.sequence])
|
|
8
|
-
@ObjectType({ description: 'Entity for InspectionPart' })
|
|
9
|
-
export class InspectionPart {
|
|
10
|
-
@PrimaryGeneratedColumn('uuid')
|
|
11
|
-
@Field(type => ID)
|
|
12
|
-
readonly id: string
|
|
13
|
-
|
|
14
|
-
@Column({ nullable: false, comment: '검측 부위' })
|
|
15
|
-
@Field({ nullable: true })
|
|
16
|
-
name?: string
|
|
17
|
-
|
|
18
|
-
@Column({ nullable: true, comment: '시퀀스' })
|
|
19
|
-
@Field(type => Int, { nullable: true })
|
|
20
|
-
sequence?: number
|
|
21
|
-
|
|
22
|
-
// 검측 도면 정보 (상위 테이블 참조)
|
|
23
|
-
@ManyToOne(type => InspectionDrawingType)
|
|
24
|
-
@Field(type => InspectionDrawingType, { nullable: true })
|
|
25
|
-
inspectionDrawingType?: InspectionDrawingType
|
|
26
|
-
|
|
27
|
-
@RelationId((inspectionPart: InspectionPart) => inspectionPart.inspectionDrawingType)
|
|
28
|
-
inspectionDrawingTypeId?: string
|
|
29
|
-
|
|
30
|
-
@CreateDateColumn()
|
|
31
|
-
@Field({ nullable: true })
|
|
32
|
-
createdAt?: Date
|
|
33
|
-
|
|
34
|
-
@UpdateDateColumn()
|
|
35
|
-
@Field({ nullable: true })
|
|
36
|
-
updatedAt?: Date
|
|
37
|
-
|
|
38
|
-
@ManyToOne(type => User, { nullable: true })
|
|
39
|
-
@Field(type => User, { nullable: true })
|
|
40
|
-
creator?: User
|
|
41
|
-
|
|
42
|
-
@RelationId((inspectionPart: InspectionPart) => inspectionPart.creator)
|
|
43
|
-
creatorId?: string
|
|
44
|
-
|
|
45
|
-
@ManyToOne(type => User, { nullable: true })
|
|
46
|
-
@Field(type => User, { nullable: true })
|
|
47
|
-
updater?: User
|
|
48
|
-
|
|
49
|
-
@RelationId((inspectionPart: InspectionPart) => inspectionPart.updater)
|
|
50
|
-
updaterId?: string
|
|
51
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
|
|
2
|
-
import { Manager } from './manager'
|
|
3
|
-
import { ManagerPatch } from './manager-type'
|
|
4
|
-
import { User } from '@things-factory/auth-base'
|
|
5
|
-
|
|
6
|
-
@Resolver(Manager)
|
|
7
|
-
export class ManagerMutation {
|
|
8
|
-
@Directive('@transaction')
|
|
9
|
-
@Mutation(returns => [Manager], { description: "To modify multiple Managers' information" })
|
|
10
|
-
async updateMultipleManager(
|
|
11
|
-
@Arg('patches', type => [ManagerPatch]) patches: ManagerPatch[],
|
|
12
|
-
@Ctx() context: ResolverContext
|
|
13
|
-
): Promise<Manager[]> {
|
|
14
|
-
const { tx, user } = context.state
|
|
15
|
-
|
|
16
|
-
let results = []
|
|
17
|
-
const managerRepo = tx.getRepository(Manager)
|
|
18
|
-
const userRepo = tx.getRepository(User)
|
|
19
|
-
|
|
20
|
-
for (let i = 0; i < patches.length; i++) {
|
|
21
|
-
const updateRecord = patches[i]
|
|
22
|
-
const manager = updateRecord.id ? await managerRepo.findOneBy({ id: updateRecord.id }) : {}
|
|
23
|
-
const managerUser = await userRepo.findOneBy({ id: updateRecord.userId })
|
|
24
|
-
|
|
25
|
-
await userRepo.save({
|
|
26
|
-
...managerUser,
|
|
27
|
-
name: updateRecord.name,
|
|
28
|
-
updater: user
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
const result = await managerRepo.save({
|
|
32
|
-
...manager,
|
|
33
|
-
user: managerUser,
|
|
34
|
-
...updateRecord
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
results.push({ ...result })
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return results
|
|
41
|
-
}
|
|
42
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Resolver, Query, Ctx } from 'type-graphql'
|
|
2
|
-
import { getRepository } from '@things-factory/shell'
|
|
3
|
-
import { Manager } from './manager'
|
|
4
|
-
import { ManagerOutput } from './manager-type'
|
|
5
|
-
import { User } from '@things-factory/auth-base'
|
|
6
|
-
|
|
7
|
-
@Resolver(Manager)
|
|
8
|
-
export class ManagerQuery {
|
|
9
|
-
@Query(returns => [ManagerOutput], { description: '담당자 리스트' })
|
|
10
|
-
async managers(@Ctx() context: ResolverContext): Promise<ManagerOutput[]> {
|
|
11
|
-
const { domain } = context.state
|
|
12
|
-
|
|
13
|
-
const queryBuilder = await getRepository(User)
|
|
14
|
-
.createQueryBuilder('u')
|
|
15
|
-
.select('m.id', 'id')
|
|
16
|
-
.addSelect('m.phone', 'phone')
|
|
17
|
-
.addSelect('m.position', 'position')
|
|
18
|
-
.addSelect('u.id', 'userId')
|
|
19
|
-
.addSelect('u.name', 'name')
|
|
20
|
-
.addSelect('u.updated_at', 'updatedAt')
|
|
21
|
-
.innerJoin('users_domains', 'ud', 'u.id = ud.users_id')
|
|
22
|
-
.leftJoin('managers', 'm', 'u.id = m.user_id')
|
|
23
|
-
.where('ud.domains_id = :domain', { domain: domain.id })
|
|
24
|
-
.orderBy('u.name', 'DESC')
|
|
25
|
-
|
|
26
|
-
return await queryBuilder.getRawMany()
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { ObjectType, Field, InputType, ID } from 'type-graphql'
|
|
2
|
-
|
|
3
|
-
@InputType()
|
|
4
|
-
export class ManagerPatch {
|
|
5
|
-
@Field(type => ID, { nullable: true })
|
|
6
|
-
id?: string
|
|
7
|
-
|
|
8
|
-
@Field({ nullable: true })
|
|
9
|
-
phone?: string
|
|
10
|
-
|
|
11
|
-
@Field({ nullable: true })
|
|
12
|
-
position?: string
|
|
13
|
-
|
|
14
|
-
@Field(type => ID, { nullable: true })
|
|
15
|
-
userId?: string
|
|
16
|
-
|
|
17
|
-
@Field({ nullable: true })
|
|
18
|
-
name?: string
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
@ObjectType()
|
|
22
|
-
export class ManagerOutput {
|
|
23
|
-
@Field(type => ID, { nullable: true })
|
|
24
|
-
id?: string
|
|
25
|
-
|
|
26
|
-
@Field({ nullable: true })
|
|
27
|
-
phone?: string
|
|
28
|
-
|
|
29
|
-
@Field({ nullable: true })
|
|
30
|
-
position?: string
|
|
31
|
-
|
|
32
|
-
@Field(type => ID)
|
|
33
|
-
userId?: string
|
|
34
|
-
|
|
35
|
-
@Field({ nullable: true })
|
|
36
|
-
name?: string
|
|
37
|
-
|
|
38
|
-
@Field({ nullable: true })
|
|
39
|
-
updatedAt?: string
|
|
40
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Entity, Index, Column, RelationId, OneToOne, PrimaryGeneratedColumn, JoinColumn } from 'typeorm'
|
|
2
|
-
import { ObjectType, Field, ID } from 'type-graphql'
|
|
3
|
-
import { Domain } from '@things-factory/shell'
|
|
4
|
-
import { User } from '@things-factory/auth-base'
|
|
5
|
-
|
|
6
|
-
@Entity()
|
|
7
|
-
@Index('ix_manager_0', (manager: Manager) => [manager.user])
|
|
8
|
-
@ObjectType({ description: '담당자 관리' })
|
|
9
|
-
export class Manager {
|
|
10
|
-
@PrimaryGeneratedColumn('uuid')
|
|
11
|
-
@Field(type => ID)
|
|
12
|
-
readonly id: string
|
|
13
|
-
|
|
14
|
-
@Column({ nullable: true, comment: '핸드폰 번호' })
|
|
15
|
-
@Field({ nullable: true })
|
|
16
|
-
phone?: string
|
|
17
|
-
|
|
18
|
-
@Column({ nullable: true, comment: '직위' })
|
|
19
|
-
@Field({ nullable: true })
|
|
20
|
-
position?: string
|
|
21
|
-
|
|
22
|
-
@OneToOne(type => User)
|
|
23
|
-
@JoinColumn()
|
|
24
|
-
@Field({ nullable: true })
|
|
25
|
-
user?: User
|
|
26
|
-
|
|
27
|
-
@RelationId((manager: Manager) => manager.user)
|
|
28
|
-
userId?: string
|
|
29
|
-
}
|