@dssp/project 0.0.2 → 0.0.5
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/client/pages/checklist/checklist-importer.ts +6 -8
- package/client/pages/checklist/checklist-list-page.ts +10 -25
- package/client/pages/project/popup/popup-plan-upload.ts +138 -0
- package/client/pages/project/{project-create-popup.ts → popup/popup-project-create.ts} +2 -3
- package/client/pages/project/project-detail.ts +8 -7
- package/client/pages/project/project-list.ts +17 -10
- package/client/pages/project/project-plan-management.ts +117 -39
- package/client/pages/project/project-schedule-list.ts +2 -0
- package/client/pages/project/project-schedule.ts +296 -7
- package/client/pages/project/project-setting-list.ts +10 -6
- package/client/pages/project/project-update.ts +5 -2
- package/client/pages/resource/construction-type-management.ts +192 -0
- package/client/pages/resource/manager-management.ts +181 -0
- package/client/pages/resource/worker-type-management.ts +194 -0
- package/client/pages/task/task-importer.ts +6 -8
- package/client/pages/task/task-list-page.ts +10 -25
- package/client/route.ts +8 -4
- package/dist-client/pages/checklist/checklist-importer.d.ts +1 -0
- package/dist-client/pages/checklist/checklist-importer.js +3 -2
- package/dist-client/pages/checklist/checklist-importer.js.map +1 -1
- package/dist-client/pages/checklist/checklist-list-page.d.ts +1 -0
- package/dist-client/pages/checklist/checklist-list-page.js +8 -16
- package/dist-client/pages/checklist/checklist-list-page.js.map +1 -1
- package/dist-client/pages/project/popup/popup-plan-upload.d.ts +10 -0
- package/dist-client/pages/project/popup/popup-plan-upload.js +139 -0
- package/dist-client/pages/project/popup/popup-plan-upload.js.map +1 -0
- package/dist-client/pages/project/{project-create-popup.d.ts → popup/popup-project-create.d.ts} +1 -3
- package/dist-client/pages/project/{project-create-popup.js → popup/popup-project-create.js} +9 -10
- package/dist-client/pages/project/popup/popup-project-create.js.map +1 -0
- package/dist-client/pages/project/project-detail.d.ts +5 -4
- package/dist-client/pages/project/project-detail.js +7 -6
- package/dist-client/pages/project/project-detail.js.map +1 -1
- package/dist-client/pages/project/project-list.d.ts +12 -2
- package/dist-client/pages/project/project-list.js +11 -14
- package/dist-client/pages/project/project-list.js.map +1 -1
- package/dist-client/pages/project/project-plan-management.d.ts +9 -4
- package/dist-client/pages/project/project-plan-management.js +105 -35
- package/dist-client/pages/project/project-plan-management.js.map +1 -1
- package/dist-client/pages/project/project-schedule-list.d.ts +1 -0
- package/dist-client/pages/project/project-schedule-list.js +1 -0
- package/dist-client/pages/project/project-schedule-list.js.map +1 -1
- package/dist-client/pages/project/project-schedule.d.ts +10 -3
- package/dist-client/pages/project/project-schedule.js +294 -7
- package/dist-client/pages/project/project-schedule.js.map +1 -1
- package/dist-client/pages/project/project-setting-list.d.ts +3 -2
- package/dist-client/pages/project/project-setting-list.js +9 -6
- package/dist-client/pages/project/project-setting-list.js.map +1 -1
- package/dist-client/pages/project/project-update.d.ts +3 -2
- package/dist-client/pages/project/project-update.js +4 -2
- package/dist-client/pages/project/project-update.js.map +1 -1
- package/dist-client/pages/resource/construction-type-management.d.ts +27 -0
- package/dist-client/pages/resource/construction-type-management.js +189 -0
- package/dist-client/pages/resource/construction-type-management.js.map +1 -0
- package/dist-client/pages/resource/manager-management.d.ts +31 -0
- package/dist-client/pages/resource/manager-management.js +175 -0
- package/dist-client/pages/resource/manager-management.js.map +1 -0
- package/dist-client/pages/resource/worker-type-management.d.ts +27 -0
- package/dist-client/pages/resource/worker-type-management.js +191 -0
- package/dist-client/pages/resource/worker-type-management.js.map +1 -0
- package/dist-client/pages/task/task-importer.d.ts +1 -0
- package/dist-client/pages/task/task-importer.js +3 -2
- package/dist-client/pages/task/task-importer.js.map +1 -1
- package/dist-client/pages/task/task-list-page.d.ts +1 -0
- package/dist-client/pages/task/task-list-page.js +8 -16
- package/dist-client/pages/task/task-list-page.js.map +1 -1
- package/dist-client/route.d.ts +1 -1
- package/dist-client/route.js +7 -4
- package/dist-client/route.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/controllers/index.d.ts +0 -0
- package/dist-server/controllers/project-to-excel.d.ts +7 -0
- package/dist-server/index.d.ts +2 -0
- package/dist-server/middlewares/index.d.ts +1 -0
- package/dist-server/routes.d.ts +1 -0
- package/dist-server/service/check-item/check-item-mutation.d.ts +10 -0
- package/dist-server/service/check-item/check-item-query.d.ts +11 -0
- package/dist-server/service/check-item/check-item-type.d.ts +18 -0
- package/dist-server/service/check-item/check-item.d.ts +18 -0
- package/dist-server/service/check-item/index.d.ts +5 -0
- package/dist-server/service/checklist/checklist-mutation.d.ts +10 -0
- package/dist-server/service/checklist/checklist-query.d.ts +11 -0
- package/dist-server/service/checklist/checklist-type.d.ts +18 -0
- package/dist-server/service/checklist/checklist.d.ts +26 -0
- package/dist-server/service/checklist/index.d.ts +5 -0
- package/dist-server/service/construction-type/construction-type-mutation.d.ts +6 -0
- package/dist-server/service/construction-type/construction-type-mutation.js +64 -0
- package/dist-server/service/construction-type/construction-type-mutation.js.map +1 -0
- package/dist-server/service/construction-type/construction-type-query.d.ts +11 -0
- package/dist-server/service/construction-type/construction-type-query.js +78 -0
- package/dist-server/service/construction-type/construction-type-query.js.map +1 -0
- package/dist-server/service/construction-type/construction-type-type.d.ts +11 -0
- package/dist-server/service/construction-type/construction-type-type.js +43 -0
- package/dist-server/service/construction-type/construction-type-type.js.map +1 -0
- package/dist-server/service/construction-type/construction-type.d.ts +16 -0
- package/dist-server/service/construction-type/construction-type.js +77 -0
- package/dist-server/service/construction-type/construction-type.js.map +1 -0
- package/dist-server/service/construction-type/index.d.ts +5 -0
- package/dist-server/service/construction-type/index.js +9 -0
- package/dist-server/service/construction-type/index.js.map +1 -0
- package/dist-server/service/index.d.ts +12 -0
- package/dist-server/service/index.js +12 -4
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/manager/index.d.ts +5 -0
- package/dist-server/service/manager/index.js +9 -0
- package/dist-server/service/manager/index.js.map +1 -0
- package/dist-server/service/manager/manager-mutation.d.ts +5 -0
- package/dist-server/service/manager/manager-mutation.js +39 -0
- package/dist-server/service/manager/manager-mutation.js.map +1 -0
- package/dist-server/service/manager/manager-query.d.ts +4 -0
- package/dist-server/service/manager/manager-query.js +39 -0
- package/dist-server/service/manager/manager-query.js.map +1 -0
- package/dist-server/service/manager/manager-type.d.ts +15 -0
- package/dist-server/service/manager/manager-type.js +62 -0
- package/dist-server/service/manager/manager-type.js.map +1 -0
- package/dist-server/service/manager/manager.d.ts +8 -0
- package/dist-server/service/manager/manager.js +41 -0
- package/dist-server/service/manager/manager.js.map +1 -0
- package/dist-server/service/project/index.d.ts +7 -0
- package/dist-server/service/project/project-mutation.d.ts +9 -0
- package/dist-server/service/project/project-mutation.js +61 -55
- package/dist-server/service/project/project-mutation.js.map +1 -1
- package/dist-server/service/project/project-query.d.ts +16 -0
- package/dist-server/service/project/project-query.js +3 -3
- package/dist-server/service/project/project-query.js.map +1 -1
- package/dist-server/service/project/project-type.d.ts +29 -0
- package/dist-server/service/project/project-type.js +1 -2
- package/dist-server/service/project/project-type.js.map +1 -1
- package/dist-server/service/project/project.d.ts +35 -0
- package/dist-server/service/project/project.js +1 -2
- package/dist-server/service/project/project.js.map +1 -1
- package/dist-server/service/task/index.d.ts +5 -0
- package/dist-server/service/task/task-mutation.d.ts +10 -0
- package/dist-server/service/task/task-query.d.ts +11 -0
- package/dist-server/service/task/task-type.d.ts +18 -0
- package/dist-server/service/task/task.d.ts +25 -0
- package/dist-server/service/worker-type/index.d.ts +5 -0
- package/dist-server/service/worker-type/index.js +9 -0
- package/dist-server/service/worker-type/index.js.map +1 -0
- package/dist-server/service/worker-type/worker-type-mutation.d.ts +6 -0
- package/dist-server/service/worker-type/worker-type-mutation.js +64 -0
- package/dist-server/service/worker-type/worker-type-mutation.js.map +1 -0
- package/dist-server/service/worker-type/worker-type-query.d.ts +11 -0
- package/dist-server/service/{resource/resource-query.js → worker-type/worker-type-query.js} +31 -39
- package/dist-server/service/worker-type/worker-type-query.js.map +1 -0
- package/dist-server/service/worker-type/worker-type-type.d.ts +11 -0
- package/dist-server/service/worker-type/worker-type-type.js +43 -0
- package/dist-server/service/worker-type/worker-type-type.js.map +1 -0
- package/dist-server/service/worker-type/worker-type.d.ts +16 -0
- package/dist-server/service/{resource/resource.js → worker-type/worker-type.js} +35 -20
- package/dist-server/service/worker-type/worker-type.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/server/service/construction-type/construction-type-mutation.ts +66 -0
- package/server/service/construction-type/construction-type-query.ts +47 -0
- package/server/service/construction-type/construction-type-type.ts +26 -0
- package/server/service/{resource/resource.ts → construction-type/construction-type.ts} +18 -6
- package/server/service/construction-type/index.ts +6 -0
- package/server/service/index.ts +12 -4
- package/server/service/manager/index.ts +6 -0
- package/server/service/manager/manager-mutation.ts +42 -0
- package/server/service/manager/manager-query.ts +28 -0
- package/server/service/manager/manager-type.ts +40 -0
- package/server/service/manager/manager.ts +29 -0
- package/server/service/project/project-mutation.ts +101 -79
- package/server/service/project/project-query.ts +4 -4
- package/server/service/worker-type/index.ts +6 -0
- package/server/service/worker-type/worker-type-mutation.ts +66 -0
- package/server/service/worker-type/worker-type-query.ts +47 -0
- package/server/service/worker-type/worker-type-type.ts +26 -0
- package/server/service/worker-type/worker-type.ts +68 -0
- package/things-factory.config.js +3 -0
- package/client/pages/project/ox-progress-circle.ts +0 -133
- package/client/pages/resource/resource-importer.ts +0 -96
- package/client/pages/resource/resource-list-page.ts +0 -355
- package/dist-client/pages/project/ox-progress-circle.d.ts +0 -41
- package/dist-client/pages/project/ox-progress-circle.js +0 -182
- package/dist-client/pages/project/ox-progress-circle.js.map +0 -1
- package/dist-client/pages/project/project-create-popup.js.map +0 -1
- package/dist-client/pages/resource/resource-importer.d.ts +0 -9
- package/dist-client/pages/resource/resource-importer.js +0 -100
- package/dist-client/pages/resource/resource-importer.js.map +0 -1
- package/dist-client/pages/resource/resource-list-page.d.ts +0 -62
- package/dist-client/pages/resource/resource-list-page.js +0 -331
- package/dist-client/pages/resource/resource-list-page.js.map +0 -1
- package/dist-server/service/resource/index.js +0 -9
- package/dist-server/service/resource/index.js.map +0 -1
- package/dist-server/service/resource/resource-mutation.js +0 -129
- package/dist-server/service/resource/resource-mutation.js.map +0 -1
- package/dist-server/service/resource/resource-query.js.map +0 -1
- package/dist-server/service/resource/resource-type.js +0 -69
- package/dist-server/service/resource/resource-type.js.map +0 -1
- package/dist-server/service/resource/resource.js.map +0 -1
- package/server/service/resource/index.ts +0 -6
- package/server/service/resource/resource-mutation.ts +0 -139
- package/server/service/resource/resource-query.ts +0 -56
- package/server/service/resource/resource-type.ts +0 -49
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dssp/project",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "dist-client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
"migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@dssp/building-complex": "^0.0.
|
|
30
|
+
"@dssp/building-complex": "^0.0.5",
|
|
31
31
|
"@operato/graphql": "^7.0.0",
|
|
32
32
|
"@operato/shell": "^7.0.0",
|
|
33
33
|
"@things-factory/auth-base": "^7.0.0",
|
|
34
34
|
"@things-factory/shell": "^7.0.0",
|
|
35
35
|
"exceljs": "^4.4.0"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "5ccd5b966f8b5b5cabf6cb9f65f0d43d6c87c0c7"
|
|
38
38
|
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
|
|
2
|
+
import { In } from 'typeorm'
|
|
3
|
+
import { ConstructionType } from './construction-type'
|
|
4
|
+
import { ConstructionTypePatch } from './construction-type-type'
|
|
5
|
+
|
|
6
|
+
@Resolver(ConstructionType)
|
|
7
|
+
export class ConstructionTypeMutation {
|
|
8
|
+
@Directive('@transaction')
|
|
9
|
+
@Mutation(returns => [ConstructionType], { description: "To modify multiple ConstructionTypes' information" })
|
|
10
|
+
async updateMultipleConstructionType(
|
|
11
|
+
@Arg('patches', type => [ConstructionTypePatch]) patches: ConstructionTypePatch[],
|
|
12
|
+
@Ctx() context: ResolverContext
|
|
13
|
+
): Promise<ConstructionType[]> {
|
|
14
|
+
const { domain, user, tx } = context.state
|
|
15
|
+
|
|
16
|
+
let results = []
|
|
17
|
+
const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
|
|
18
|
+
const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
|
|
19
|
+
const constructionTypeRepo = tx.getRepository(ConstructionType)
|
|
20
|
+
|
|
21
|
+
if (_createRecords.length > 0) {
|
|
22
|
+
for (let i = 0; i < _createRecords.length; i++) {
|
|
23
|
+
const newRecord = _createRecords[i]
|
|
24
|
+
|
|
25
|
+
const result = await constructionTypeRepo.save({
|
|
26
|
+
...newRecord,
|
|
27
|
+
domain,
|
|
28
|
+
creator: user,
|
|
29
|
+
updater: user
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
results.push({ ...result, cuFlag: '+' })
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (_updateRecords.length > 0) {
|
|
37
|
+
for (let i = 0; i < _updateRecords.length; i++) {
|
|
38
|
+
const updateRecord = _updateRecords[i]
|
|
39
|
+
const constructionType = await constructionTypeRepo.findOneBy({ id: updateRecord.id })
|
|
40
|
+
|
|
41
|
+
const result = await constructionTypeRepo.save({
|
|
42
|
+
...constructionType,
|
|
43
|
+
...updateRecord,
|
|
44
|
+
updater: user
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
results.push({ ...result, cuFlag: 'M' })
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return results
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@Directive('@transaction')
|
|
55
|
+
@Mutation(returns => Boolean, { description: 'To delete multiple ConstructionTypes' })
|
|
56
|
+
async deleteConstructionTypes(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {
|
|
57
|
+
const { domain, tx } = context.state
|
|
58
|
+
|
|
59
|
+
await tx.getRepository(ConstructionType).softDelete({
|
|
60
|
+
domain: { id: domain.id },
|
|
61
|
+
id: In(ids)
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
return true
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx } from 'type-graphql'
|
|
2
|
+
import { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
|
|
3
|
+
import { User } from '@things-factory/auth-base'
|
|
4
|
+
import { ConstructionType } from './construction-type'
|
|
5
|
+
import { ConstructionTypeList } from './construction-type-type'
|
|
6
|
+
|
|
7
|
+
@Resolver(ConstructionType)
|
|
8
|
+
export class ConstructionTypeQuery {
|
|
9
|
+
@Query(returns => ConstructionType!, { nullable: true, description: 'To fetch a ConstructionType' })
|
|
10
|
+
async constructionType(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<ConstructionType> {
|
|
11
|
+
const { domain } = context.state
|
|
12
|
+
|
|
13
|
+
return await getRepository(ConstructionType).findOne({
|
|
14
|
+
where: { domain: { id: domain.id }, id }
|
|
15
|
+
})
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@Query(returns => ConstructionTypeList, { description: 'To fetch multiple ConstructionTypes' })
|
|
19
|
+
async constructionTypes(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<ConstructionTypeList> {
|
|
20
|
+
const { domain } = context.state
|
|
21
|
+
|
|
22
|
+
const queryBuilder = getQueryBuilderFromListParams({
|
|
23
|
+
domain,
|
|
24
|
+
params,
|
|
25
|
+
repository: await getRepository(ConstructionType)
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
const [items, total] = await queryBuilder.getManyAndCount()
|
|
29
|
+
|
|
30
|
+
return { items, total }
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@FieldResolver(type => Domain)
|
|
34
|
+
async domain(@Root() constructionType: ConstructionType): Promise<Domain> {
|
|
35
|
+
return await getRepository(Domain).findOneBy({ id: constructionType.domainId })
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@FieldResolver(type => User)
|
|
39
|
+
async updater(@Root() constructionType: ConstructionType): Promise<User> {
|
|
40
|
+
return await getRepository(User).findOneBy({ id: constructionType.updaterId })
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@FieldResolver(type => User)
|
|
44
|
+
async creator(@Root() constructionType: ConstructionType): Promise<User> {
|
|
45
|
+
return await getRepository(User).findOneBy({ id: constructionType.creatorId })
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'
|
|
2
|
+
import { ConstructionType } from './construction-type'
|
|
3
|
+
|
|
4
|
+
@InputType()
|
|
5
|
+
export class ConstructionTypePatch {
|
|
6
|
+
@Field(type => ID, { nullable: true })
|
|
7
|
+
id?: string
|
|
8
|
+
|
|
9
|
+
@Field({ nullable: true })
|
|
10
|
+
name?: string
|
|
11
|
+
|
|
12
|
+
@Field({ nullable: true })
|
|
13
|
+
description?: string
|
|
14
|
+
|
|
15
|
+
@Field({ nullable: true })
|
|
16
|
+
cuFlag?: string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@ObjectType()
|
|
20
|
+
export class ConstructionTypeList {
|
|
21
|
+
@Field(type => [ConstructionType])
|
|
22
|
+
items: ConstructionType[]
|
|
23
|
+
|
|
24
|
+
@Field(type => Int)
|
|
25
|
+
total: number
|
|
26
|
+
}
|
|
@@ -11,23 +11,35 @@ import {
|
|
|
11
11
|
} from 'typeorm'
|
|
12
12
|
import { ObjectType, Field, ID } from 'type-graphql'
|
|
13
13
|
|
|
14
|
+
import { Domain } from '@things-factory/shell'
|
|
14
15
|
import { User } from '@things-factory/auth-base'
|
|
15
16
|
|
|
16
17
|
@Entity()
|
|
17
|
-
@Index('
|
|
18
|
+
@Index('ix_construction_type_0', (constructionType: ConstructionType) => [constructionType.domain, constructionType.name], {
|
|
18
19
|
unique: true,
|
|
19
20
|
where: '"deleted_at" IS NULL'
|
|
20
21
|
})
|
|
21
|
-
@ObjectType({ description: '
|
|
22
|
-
export class
|
|
22
|
+
@ObjectType({ description: '공종 타입' })
|
|
23
|
+
export class ConstructionType {
|
|
23
24
|
@PrimaryGeneratedColumn('uuid')
|
|
24
25
|
@Field(type => ID)
|
|
25
26
|
readonly id: string
|
|
26
27
|
|
|
27
|
-
@
|
|
28
|
+
@ManyToOne(type => Domain)
|
|
29
|
+
@Field({ nullable: true })
|
|
30
|
+
domain?: Domain
|
|
31
|
+
|
|
32
|
+
@RelationId((constructionType: ConstructionType) => constructionType.domain)
|
|
33
|
+
domainId?: string
|
|
34
|
+
|
|
35
|
+
@Column()
|
|
28
36
|
@Field({ nullable: true })
|
|
29
37
|
name?: string
|
|
30
38
|
|
|
39
|
+
@Column({ nullable: true })
|
|
40
|
+
@Field({ nullable: true })
|
|
41
|
+
description?: string
|
|
42
|
+
|
|
31
43
|
@CreateDateColumn()
|
|
32
44
|
@Field({ nullable: true })
|
|
33
45
|
createdAt?: Date
|
|
@@ -44,13 +56,13 @@ export class Resource {
|
|
|
44
56
|
@Field(type => User, { nullable: true })
|
|
45
57
|
creator?: User
|
|
46
58
|
|
|
47
|
-
@RelationId((
|
|
59
|
+
@RelationId((constructionType: ConstructionType) => constructionType.creator)
|
|
48
60
|
creatorId?: string
|
|
49
61
|
|
|
50
62
|
@ManyToOne(type => User, { nullable: true })
|
|
51
63
|
@Field(type => User, { nullable: true })
|
|
52
64
|
updater?: User
|
|
53
65
|
|
|
54
|
-
@RelationId((
|
|
66
|
+
@RelationId((constructionType: ConstructionType) => constructionType.updater)
|
|
55
67
|
updaterId?: string
|
|
56
68
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ConstructionType } from './construction-type'
|
|
2
|
+
import { ConstructionTypeQuery } from './construction-type-query'
|
|
3
|
+
import { ConstructionTypeMutation } from './construction-type-mutation'
|
|
4
|
+
|
|
5
|
+
export const entities = [ConstructionType]
|
|
6
|
+
export const resolvers = [ConstructionTypeQuery, ConstructionTypeMutation]
|
package/server/service/index.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
/* EXPORT ENTITY TYPES */
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './construction-type/construction-type'
|
|
3
|
+
export * from './worker-type/worker-type'
|
|
4
|
+
export * from './manager/manager'
|
|
3
5
|
export * from './check-item/check-item'
|
|
4
6
|
export * from './checklist/checklist'
|
|
5
7
|
export * from './task/task'
|
|
6
8
|
export * from './project/project'
|
|
7
9
|
|
|
8
10
|
/* IMPORT ENTITIES AND RESOLVERS */
|
|
9
|
-
import { entities as
|
|
11
|
+
import { entities as ConstructionTypeEntities, resolvers as ConstructionTypeResolvers } from './construction-type'
|
|
12
|
+
import { entities as WorkerTypeEntities, resolvers as WorkerTypeResolvers } from './worker-type'
|
|
13
|
+
import { entities as ManagerEntities, resolvers as ManagerResolvers } from './manager'
|
|
10
14
|
import { entities as CheckItemEntities, resolvers as CheckItemResolvers } from './check-item'
|
|
11
15
|
import { entities as ChecklistEntities, resolvers as ChecklistResolvers } from './checklist'
|
|
12
16
|
import { entities as TaskEntities, resolvers as TaskResolvers } from './task'
|
|
@@ -14,7 +18,9 @@ import { entities as ProjectEntities, resolvers as ProjectResolvers, types as Pr
|
|
|
14
18
|
|
|
15
19
|
export const entities = [
|
|
16
20
|
/* ENTITIES */
|
|
17
|
-
...
|
|
21
|
+
...ConstructionTypeEntities,
|
|
22
|
+
...WorkerTypeEntities,
|
|
23
|
+
...ManagerEntities,
|
|
18
24
|
...CheckItemEntities,
|
|
19
25
|
...ChecklistEntities,
|
|
20
26
|
...TaskEntities,
|
|
@@ -24,7 +30,9 @@ export const entities = [
|
|
|
24
30
|
export const schema = {
|
|
25
31
|
resolverClasses: [
|
|
26
32
|
/* RESOLVER CLASSES */
|
|
27
|
-
...
|
|
33
|
+
...ConstructionTypeResolvers,
|
|
34
|
+
...WorkerTypeResolvers,
|
|
35
|
+
...ManagerResolvers,
|
|
28
36
|
...CheckItemResolvers,
|
|
29
37
|
...ChecklistResolvers,
|
|
30
38
|
...TaskResolvers,
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { Resolver, Mutation, Arg,
|
|
2
|
-
import { In
|
|
3
|
-
|
|
4
|
-
import { createAttachment, deleteAttachmentsByRef } from '@things-factory/attachment-base'
|
|
5
|
-
|
|
1
|
+
import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
|
|
2
|
+
import { In } from 'typeorm'
|
|
3
|
+
import { createAttachment, deleteAttachmentsByRef, ATTACHMENT_PATH } from '@things-factory/attachment-base'
|
|
6
4
|
import { Project } from './project'
|
|
7
5
|
import { NewProject, ProjectPatch } from './project-type'
|
|
8
6
|
import { BuildingComplex, Building, BuildingLevel } from '@dssp/building-complex'
|
|
7
|
+
import { pdfToImage } from '@things-factory/board-service/dist-server/controllers/headless-pdf-to-image'
|
|
9
8
|
|
|
10
9
|
@Resolver(Project)
|
|
11
10
|
export class ProjectMutation {
|
|
@@ -51,43 +50,11 @@ export class ProjectMutation {
|
|
|
51
50
|
// 2. 단지 정보 수정
|
|
52
51
|
await buildingComplexRepo.save({ ...buildingComplex, updater: user })
|
|
53
52
|
|
|
54
|
-
// 2-1. 프로젝트 메인 이미지 첨부파일 나머지 삭제 후 저장
|
|
55
|
-
|
|
56
|
-
await deleteAttachmentsByRef(null, { refBys: [project.id] }, context)
|
|
57
|
-
|
|
58
|
-
if (project.mainPhotoUpload) {
|
|
59
|
-
await createAttachment(
|
|
60
|
-
null,
|
|
61
|
-
{
|
|
62
|
-
attachment: {
|
|
63
|
-
file: project.mainPhotoUpload,
|
|
64
|
-
refType: Project.name,
|
|
65
|
-
refBy: project.id
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
context
|
|
69
|
-
)
|
|
70
|
-
}
|
|
71
|
-
}
|
|
53
|
+
// 2-1. 프로젝트 메인 이미지 첨부파일 나머지 삭제 후 저장
|
|
54
|
+
await createAttachmentAfterDelete(context, project?.mainPhotoUpload, project.id, Project.name)
|
|
72
55
|
|
|
73
|
-
// 2-2. 단지 BIM 이미지 첨부파일 나머지 삭제 후 저장
|
|
74
|
-
|
|
75
|
-
await deleteAttachmentsByRef(null, { refBys: [buildingComplex.id] }, context)
|
|
76
|
-
|
|
77
|
-
if (buildingComplex.drawingUpload) {
|
|
78
|
-
await createAttachment(
|
|
79
|
-
null,
|
|
80
|
-
{
|
|
81
|
-
attachment: {
|
|
82
|
-
file: buildingComplex.drawingUpload,
|
|
83
|
-
refType: BuildingComplex.name,
|
|
84
|
-
refBy: buildingComplex.id
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
context
|
|
88
|
-
)
|
|
89
|
-
}
|
|
90
|
-
}
|
|
56
|
+
// 2-2. 단지 BIM 이미지 첨부파일 나머지 삭제 후 저장
|
|
57
|
+
await createAttachmentAfterDelete(context, buildingComplex?.drawingUpload, buildingComplex.id, BuildingComplex.name)
|
|
91
58
|
|
|
92
59
|
// 3. 동의 층 정보가 바뀌었으면 층 초기화 후 다시 생성
|
|
93
60
|
const originBuilding = await buildingRepo.findBy({ buildingComplex: { id: buildingComplex.id } }) // 이전 동 정보 가져오기
|
|
@@ -105,8 +72,9 @@ export class ProjectMutation {
|
|
|
105
72
|
await buildingRepo.softDelete({ id: In(buildingIds) })
|
|
106
73
|
await deleteAttachmentsByRef(null, { refBys: [...buildingIds, ...buildingLevelIds] }, context)
|
|
107
74
|
|
|
108
|
-
|
|
109
|
-
|
|
75
|
+
// 3-2. 단지 내 동 정보들 생성
|
|
76
|
+
for (let buildingKey in buildings) {
|
|
77
|
+
const building = buildings[buildingKey]
|
|
110
78
|
const newBuilding = await buildingRepo.save({
|
|
111
79
|
buildingComplex: buildingComplex,
|
|
112
80
|
name: building.name,
|
|
@@ -118,7 +86,7 @@ export class ProjectMutation {
|
|
|
118
86
|
for (let i = 1; i <= building.floorCount; i++) {
|
|
119
87
|
await buildingLevelRepo.save({ building: newBuilding, floor: i, creator: user })
|
|
120
88
|
}
|
|
121
|
-
}
|
|
89
|
+
}
|
|
122
90
|
}
|
|
123
91
|
|
|
124
92
|
return projectResult
|
|
@@ -127,11 +95,13 @@ export class ProjectMutation {
|
|
|
127
95
|
@Directive('@transaction')
|
|
128
96
|
@Mutation(returns => Project, { description: '프로젝트 도면 업데이트' })
|
|
129
97
|
async updateProjectPlan(@Arg('project') project: ProjectPatch, @Ctx() context: ResolverContext): Promise<Project> {
|
|
130
|
-
const { user, tx } = context.state
|
|
98
|
+
const { user, tx, domain } = context.state
|
|
131
99
|
const projectRepo = tx.getRepository(Project)
|
|
132
100
|
const buildingComplexRepo = tx.getRepository(BuildingComplex)
|
|
101
|
+
const buildingRepo = tx.getRepository(Building)
|
|
102
|
+
const buildingLevelRepo = tx.getRepository(BuildingLevel)
|
|
133
103
|
const buildingComplex = project.buildingComplex
|
|
134
|
-
const buildings
|
|
104
|
+
const buildings = project.buildingComplex?.buildings || []
|
|
135
105
|
|
|
136
106
|
// 1. 프로젝트 수정 시간 업데이트
|
|
137
107
|
const projectResult = await projectRepo.save({ ...project, updater: user })
|
|
@@ -145,44 +115,79 @@ export class ProjectMutation {
|
|
|
145
115
|
for (let buildingLevelKey in building.buildingLevels) {
|
|
146
116
|
const buildingLevel = building.buildingLevels[buildingLevelKey]
|
|
147
117
|
|
|
148
|
-
// 3. 층별 도면 이미지 저장
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
118
|
+
// 3. 층별 도면 이미지 저장
|
|
119
|
+
const mainDrawingAttatchment = await createAttachmentAfterDelete(
|
|
120
|
+
context,
|
|
121
|
+
buildingLevel.mainDrawingUpload,
|
|
122
|
+
buildingLevel.id,
|
|
123
|
+
BuildingLevel.name + '_mainDrawing'
|
|
124
|
+
)
|
|
125
|
+
// 첨부된 PDF가 있으면 PDF 파일대로 썸네일 생성
|
|
126
|
+
if (mainDrawingAttatchment) {
|
|
127
|
+
const mainDrawingUpload = await buildingLevel.mainDrawingUpload
|
|
128
|
+
const pdfPath = `/${ATTACHMENT_PATH}/${mainDrawingAttatchment.path}`
|
|
129
|
+
const fileName = mainDrawingUpload.filename.replace('.pdf', '')
|
|
130
|
+
const pngFile = await pdfToImage({ pdfPath, fileName })
|
|
131
|
+
await createAttachmentAfterDelete(context, pngFile, buildingLevel.id, BuildingLevel.name + '_mainDrawing_image')
|
|
132
|
+
|
|
133
|
+
const pngThumbnailFile = await pdfToImage({ pdfPath, fileName, defaultViewport: { width: 300, height: 200 } })
|
|
134
|
+
await createAttachmentAfterDelete(
|
|
135
|
+
context,
|
|
136
|
+
pngThumbnailFile,
|
|
137
|
+
buildingLevel.id,
|
|
138
|
+
BuildingLevel.name + '_mainDrawing_thumbnail'
|
|
139
|
+
)
|
|
165
140
|
}
|
|
166
|
-
}
|
|
167
141
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
142
|
+
// 3-1. 입면도 파일 저장
|
|
143
|
+
const elevationDrawingAttatchment = await createAttachmentAfterDelete(
|
|
144
|
+
context,
|
|
145
|
+
buildingLevel.elevationDrawingUpload,
|
|
146
|
+
buildingLevel.id,
|
|
147
|
+
BuildingLevel.name + '_elevationDrawing'
|
|
148
|
+
)
|
|
149
|
+
if (elevationDrawingAttatchment) {
|
|
150
|
+
const elevationDrawingUpload = await buildingLevel.elevationDrawingUpload
|
|
151
|
+
const pdfPath = `/${ATTACHMENT_PATH}/${elevationDrawingAttatchment.path}`
|
|
152
|
+
const fileName = elevationDrawingUpload.filename.replace('.pdf', '')
|
|
153
|
+
const pngThumbnailFile = await pdfToImage({ pdfPath, fileName, defaultViewport: { width: 300, height: 200 } })
|
|
154
|
+
await createAttachmentAfterDelete(
|
|
155
|
+
context,
|
|
156
|
+
pngThumbnailFile,
|
|
157
|
+
buildingLevel.id,
|
|
158
|
+
BuildingLevel.name + '_elevationDrawing_thumbnail'
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// 3-2. 철근배분도 파일 저장
|
|
163
|
+
const rebarDistributionDrawingAttatchment = await createAttachmentAfterDelete(
|
|
164
|
+
context,
|
|
165
|
+
buildingLevel.rebarDistributionDrawingUpload,
|
|
166
|
+
buildingLevel.id,
|
|
167
|
+
BuildingLevel.name + '_rebarDistributionDrawing'
|
|
168
|
+
)
|
|
169
|
+
if (rebarDistributionDrawingAttatchment) {
|
|
170
|
+
const rebarDistributionDrawingUpload = await buildingLevel.rebarDistributionDrawingUpload
|
|
171
|
+
const pdfPath = `/${ATTACHMENT_PATH}/${rebarDistributionDrawingAttatchment.path}`
|
|
172
|
+
const fileName = rebarDistributionDrawingUpload.filename.replace('.pdf', '')
|
|
173
|
+
const pngThumbnailFile = await pdfToImage({ pdfPath, fileName, defaultViewport: { width: 300, height: 200 } })
|
|
174
|
+
await createAttachmentAfterDelete(
|
|
175
|
+
context,
|
|
176
|
+
pngThumbnailFile,
|
|
177
|
+
buildingLevel.id,
|
|
178
|
+
BuildingLevel.name + '_rebarDistributionDrawing_thumbnail'
|
|
183
179
|
)
|
|
184
180
|
}
|
|
181
|
+
|
|
182
|
+
// 3-3. 층 업데이트 시간 갱신
|
|
183
|
+
await buildingLevelRepo.save({ ...buildingLevel, updater: user })
|
|
185
184
|
}
|
|
185
|
+
|
|
186
|
+
// 4. 동별 도면 이미지 저장
|
|
187
|
+
await createAttachmentAfterDelete(context, building?.drawingUpload, building.id, Building.name)
|
|
188
|
+
|
|
189
|
+
// 4-1. 동 업데이트 시간 갱신
|
|
190
|
+
await buildingRepo.save({ ...building, updater: user })
|
|
186
191
|
}
|
|
187
192
|
|
|
188
193
|
return projectResult
|
|
@@ -199,3 +204,20 @@ export class ProjectMutation {
|
|
|
199
204
|
return true
|
|
200
205
|
}
|
|
201
206
|
}
|
|
207
|
+
|
|
208
|
+
export async function createAttachmentAfterDelete(context: ResolverContext, file: any, refBy: any, refType: any) {
|
|
209
|
+
let result = null
|
|
210
|
+
|
|
211
|
+
// undefined = 기존 파일 그대로
|
|
212
|
+
if (file === undefined) return result
|
|
213
|
+
|
|
214
|
+
// 기존 첨부 파일이 있으면 삭제
|
|
215
|
+
await deleteAttachmentsByRef(null, { refBys: [refBy], refType }, context)
|
|
216
|
+
|
|
217
|
+
// 파일이 있으면 생성 (null로 들어올 경우 delete까지만)
|
|
218
|
+
if (file) {
|
|
219
|
+
result = await createAttachment(null, { attachment: { file, refType, refBy } }, context)
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
return result
|
|
223
|
+
}
|