@dssp/project 1.0.0-alpha.0 → 1.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/dist-client/tsconfig.tsbuildinfo +1 -1
  2. package/dist-server/tsconfig.tsbuildinfo +1 -1
  3. package/package.json +11 -11
  4. package/client/bootstrap.ts +0 -0
  5. package/client/index.ts +0 -0
  6. package/client/pages/lib/select2-component.ts +0 -175
  7. package/client/pages/lib/waether.ts +0 -159
  8. package/client/pages/project/component/project-update-header.ts +0 -88
  9. package/client/pages/project/popup/popup-plan-upload.ts +0 -138
  10. package/client/pages/project/popup/popup-project-create.ts +0 -147
  11. package/client/pages/project/popup/popup-schedule-upload.ts +0 -102
  12. package/client/pages/project/project-completed-list.ts +0 -281
  13. package/client/pages/project/project-detail.ts +0 -738
  14. package/client/pages/project/project-list.ts +0 -418
  15. package/client/pages/project/project-plan-management.ts +0 -476
  16. package/client/pages/project/project-schedule-list.ts +0 -294
  17. package/client/pages/project/project-schedule.ts +0 -393
  18. package/client/pages/project/project-setting-list.ts +0 -393
  19. package/client/pages/project/project-update.ts +0 -876
  20. package/client/pages/resource/construction-detail-type-popup.ts +0 -201
  21. package/client/pages/resource/construction-type-management.ts +0 -212
  22. package/client/pages/resource/inspection-drawing-type-management.ts +0 -245
  23. package/client/pages/resource/inspection-part-popup.ts +0 -201
  24. package/client/pages/resource/resource-importer.ts +0 -97
  25. package/client/pages/resource/resource-list-page.ts +0 -356
  26. package/client/pages/resource/worker-type-management.ts +0 -192
  27. package/client/pages/task/task-importer.ts +0 -94
  28. package/client/pages/task/task-list-page.ts +0 -340
  29. package/client/pages/task-resource/task-resource-importer.ts +0 -97
  30. package/client/pages/task-resource/task-resource-list-page.ts +0 -356
  31. package/client/route.ts +0 -55
  32. package/client/tsconfig.json +0 -11
  33. package/server/controllers/export-tasks.ts +0 -40
  34. package/server/controllers/import-task.ts +0 -134
  35. package/server/controllers/index.ts +0 -0
  36. package/server/controllers/parse-excel.ts +0 -86
  37. package/server/controllers/types.ts +0 -20
  38. package/server/index.ts +0 -4
  39. package/server/middlewares/index.ts +0 -3
  40. package/server/migrations/1723861466413-seed-roles.ts +0 -128
  41. package/server/migrations/1723861466414-seed-codes.ts +0 -157
  42. package/server/migrations/1723861476419-seed-resources.ts +0 -62
  43. package/server/migrations/1723861478420-seed-/bsample-project.ts +0 -87
  44. package/server/migrations/1723861478421-seed-/bsample-tasks.ts +0 -194
  45. package/server/migrations/index.ts +0 -9
  46. package/server/routes.ts +0 -108
  47. package/server/service/construction-detail-type/construction-detail-type-mutation.ts +0 -57
  48. package/server/service/construction-detail-type/construction-detail-type-query.ts +0 -31
  49. package/server/service/construction-detail-type/construction-detail-type-type.ts +0 -26
  50. package/server/service/construction-detail-type/construction-detail-type.ts +0 -52
  51. package/server/service/construction-detail-type/index.ts +0 -6
  52. package/server/service/construction-type/construction-type-mutation.ts +0 -66
  53. package/server/service/construction-type/construction-type-query.ts +0 -56
  54. package/server/service/construction-type/construction-type-type.ts +0 -26
  55. package/server/service/construction-type/construction-type.ts +0 -74
  56. package/server/service/construction-type/index.ts +0 -6
  57. package/server/service/index.ts +0 -56
  58. package/server/service/inspection-drawing-type/index.ts +0 -6
  59. package/server/service/inspection-drawing-type/inspection-drawing-type-mutation.ts +0 -69
  60. package/server/service/inspection-drawing-type/inspection-drawing-type-query.ts +0 -55
  61. package/server/service/inspection-drawing-type/inspection-drawing-type-type.ts +0 -23
  62. package/server/service/inspection-drawing-type/inspection-drawing-type.ts +0 -68
  63. package/server/service/inspection-part/index.ts +0 -6
  64. package/server/service/inspection-part/inspection-part-mutation.ts +0 -52
  65. package/server/service/inspection-part/inspection-part-query.ts +0 -41
  66. package/server/service/inspection-part/inspection-part-type.ts +0 -26
  67. package/server/service/inspection-part/inspection-part.ts +0 -51
  68. package/server/service/manager/index.ts +0 -6
  69. package/server/service/manager/manager-mutation.ts +0 -42
  70. package/server/service/manager/manager-query.ts +0 -28
  71. package/server/service/manager/manager-type.ts +0 -40
  72. package/server/service/manager/manager.ts +0 -29
  73. package/server/service/project/index.ts +0 -6
  74. package/server/service/project/project-mutation.ts +0 -255
  75. package/server/service/project/project-query.ts +0 -105
  76. package/server/service/project/project-type.ts +0 -72
  77. package/server/service/project/project.ts +0 -134
  78. package/server/service/resource/index.ts +0 -7
  79. package/server/service/resource/resource-mutation.ts +0 -137
  80. package/server/service/resource/resource-query.ts +0 -50
  81. package/server/service/resource/resource-type.ts +0 -41
  82. package/server/service/resource/resource.ts +0 -82
  83. package/server/service/task/index.ts +0 -6
  84. package/server/service/task/task-mutation.ts +0 -135
  85. package/server/service/task/task-query.ts +0 -169
  86. package/server/service/task/task-type.ts +0 -75
  87. package/server/service/task/task.ts +0 -130
  88. package/server/service/task-resource/index.ts +0 -7
  89. package/server/service/task-resource/task-resource-mutation.ts +0 -140
  90. package/server/service/task-resource/task-resource-query.ts +0 -36
  91. package/server/service/task-resource/task-resource-type.ts +0 -41
  92. package/server/service/task-resource/task-resource.ts +0 -51
  93. package/server/service/worker-type/index.ts +0 -6
  94. package/server/service/worker-type/worker-type-mutation.ts +0 -66
  95. package/server/service/worker-type/worker-type-query.ts +0 -47
  96. package/server/service/worker-type/worker-type-type.ts +0 -26
  97. package/server/service/worker-type/worker-type.ts +0 -68
  98. package/server/tsconfig.json +0 -10
package/server/routes.ts DELETED
@@ -1,108 +0,0 @@
1
- import contentDisposition from 'content-disposition'
2
-
3
- import { Task, generateExcel } from './controllers/export-tasks'
4
-
5
- // const debug = require('debug')('dssp:project:routes')
6
-
7
- process.on('bootstrap-module-global-public-route' as any, (app, globalPublicRouter) => {
8
- /*
9
- * can add global public routes to application (auth not required, tenancy not required)
10
- *
11
- * ex) routes.get('/path', async(context, next) => {})
12
- * ex) routes.post('/path', async(context, next) => {})
13
- */
14
- globalPublicRouter.get('/export-project', async (context, next) => {
15
- const tasks: Task[] = [
16
- {
17
- name: '1 Task',
18
- startDate: new Date('2024-03-01'),
19
- endDate: new Date('2024-03-05'),
20
- subtasks: [
21
- {
22
- name: '1.1 Subtask',
23
- startDate: new Date('2024-03-02'),
24
- endDate: new Date('2024-03-03'),
25
- subtasks: [
26
- {
27
- name: '1.1.1 Subtask',
28
- startDate: new Date('2024-03-02'),
29
- endDate: new Date('2024-03-02')
30
- },
31
- {
32
- name: '1.1.2 Subtask',
33
- startDate: new Date('2024-03-02'),
34
- endDate: new Date('2024-03-03')
35
- },
36
- {
37
- name: '1.1.2 Subtask',
38
- startDate: new Date('2024-03-03'),
39
- endDate: new Date('2024-03-03')
40
- },
41
- {
42
- name: '1.1.2 Subtask',
43
- startDate: new Date('2024-03-03'),
44
- endDate: new Date('2024-03-03')
45
- }
46
- ]
47
- },
48
- {
49
- name: '1.2 Subtask',
50
- startDate: new Date('2024-03-04'),
51
- endDate: new Date('2024-03-05')
52
- }
53
- ]
54
- },
55
- {
56
- name: '2 Task',
57
- startDate: new Date('2024-03-06'),
58
- endDate: new Date('2024-03-10'),
59
- subtasks: [
60
- {
61
- name: '2.1 Subtask',
62
- startDate: new Date('2024-03-06'),
63
- endDate: new Date('2024-03-07')
64
- },
65
- {
66
- name: '2.2 Subtask',
67
- startDate: new Date('2024-03-08'),
68
- endDate: new Date('2024-03-10'),
69
- subtasks: [
70
- {
71
- name: '2.2.1 Subtask',
72
- startDate: new Date('2024-03-08'),
73
- endDate: new Date('2024-03-09')
74
- },
75
- {
76
- name: '2.2.2 Subtask',
77
- startDate: new Date('2024-03-10'),
78
- endDate: new Date('2024-03-10')
79
- }
80
- ]
81
- }
82
- ]
83
- }
84
- ]
85
-
86
- context.type = 'application/xlsx'
87
- context.set('Content-Disposition', contentDisposition(`project.xlsx`))
88
- context.body = await generateExcel(tasks)
89
- })
90
- })
91
-
92
- process.on('bootstrap-module-global-private-route' as any, (app, globalPrivateRouter) => {
93
- /*
94
- * can add global private routes to application (auth required, tenancy not required)
95
- */
96
- })
97
-
98
- process.on('bootstrap-module-domain-public-route' as any, (app, domainPublicRouter) => {
99
- /*
100
- * can add domain public routes to application (auth not required, tenancy required)
101
- */
102
- })
103
-
104
- process.on('bootstrap-module-domain-private-route' as any, (app, domainPrivateRouter) => {
105
- /*
106
- * can add domain private routes to application (auth required, tenancy required)
107
- */
108
- })
@@ -1,57 +0,0 @@
1
- import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
2
- import { In } from 'typeorm'
3
- import { deleteAttachmentsByRef } from '@things-factory/attachment-base'
4
- import { ConstructionDetailType } from './construction-detail-type'
5
- import { ConstructionDetailTypePatch } from './construction-detail-type-type'
6
- import { ConstructionType } from '../construction-type/construction-type'
7
-
8
- @Resolver(ConstructionDetailType)
9
- export class ConstructionDetailTypeMutation {
10
- @Directive('@transaction')
11
- @Mutation(returns => [ConstructionDetailType], { description: "To modify multiple ConstructionDetailTypes' information" })
12
- async updateMultipleConstructionDetailType(
13
- @Arg('patches', type => [ConstructionDetailTypePatch]) patches: ConstructionDetailTypePatch[],
14
- @Arg('constructionTypeId') constructionTypeId: string,
15
- @Ctx() context: ResolverContext
16
- ): Promise<ConstructionDetailType[]> {
17
- const { domain, user, tx } = context.state
18
-
19
- let results = []
20
-
21
- const constructionDetailTypeRepo = tx.getRepository(ConstructionDetailType)
22
- const constructionType = await tx.getRepository(ConstructionType).findOneBy({ id: constructionTypeId })
23
-
24
- await constructionDetailTypeRepo.delete({ constructionType: { id: constructionTypeId } })
25
-
26
- for (let i = 0; i < patches.length; i++) {
27
- const result = await constructionDetailTypeRepo.save({
28
- ...patches[i],
29
- sequence: i,
30
- constructionType,
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 ConstructionDetailTypes' })
43
- async deleteConstructionDetailTypes(
44
- @Arg('ids', type => [String]) ids: string[],
45
- @Ctx() context: ResolverContext
46
- ): Promise<boolean> {
47
- const { domain, tx } = context.state
48
-
49
- await tx.getRepository(ConstructionDetailType).delete({
50
- id: In(ids)
51
- })
52
-
53
- await deleteAttachmentsByRef(null, { refBys: ids }, context)
54
-
55
- return true
56
- }
57
- }
@@ -1,31 +0,0 @@
1
- import { Resolver, Query, FieldResolver, Root, Args, Ctx } from 'type-graphql'
2
- import { getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
3
- import { User } from '@things-factory/auth-base'
4
- import { ConstructionDetailType } from './construction-detail-type'
5
- import { ConstructionDetailTypeList } from './construction-detail-type-type'
6
-
7
- @Resolver(ConstructionDetailType)
8
- export class ConstructionDetailTypeQuery {
9
- @Query(returns => ConstructionDetailTypeList, { description: 'To fetch multiple ConstructionDetailTypes' })
10
- async constructionDetailTypes(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<ConstructionDetailTypeList> {
11
- const queryBuilder = getQueryBuilderFromListParams({
12
- params,
13
- repository: await getRepository(ConstructionDetailType),
14
- searchables: ['name']
15
- })
16
-
17
- const [items, total] = await queryBuilder.getManyAndCount()
18
-
19
- return { items, total }
20
- }
21
-
22
- @FieldResolver(type => User)
23
- async updater(@Root() constructionDetailType: ConstructionDetailType): Promise<User> {
24
- return await getRepository(User).findOneBy({ id: constructionDetailType.updaterId })
25
- }
26
-
27
- @FieldResolver(type => User)
28
- async creator(@Root() constructionDetailType: ConstructionDetailType): Promise<User> {
29
- return await getRepository(User).findOneBy({ id: constructionDetailType.creatorId })
30
- }
31
- }
@@ -1,26 +0,0 @@
1
- import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'
2
- import { ConstructionDetailType } from './construction-detail-type'
3
-
4
- @InputType()
5
- export class ConstructionDetailTypePatch {
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 ConstructionDetailTypeList {
21
- @Field(type => [ConstructionDetailType])
22
- items: ConstructionDetailType[]
23
-
24
- @Field(type => Int)
25
- total: number
26
- }
@@ -1,52 +0,0 @@
1
- import { CreateDateColumn, UpdateDateColumn, Entity, Index, Column, RelationId, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'
2
- import { ObjectType, Field, ID, Int } from 'type-graphql'
3
-
4
- import { User } from '@things-factory/auth-base'
5
- import { ConstructionType } from '../construction-type/construction-type'
6
-
7
- @Entity()
8
- @Index('ix_construction_detail_type_0', (constructionDetailType: ConstructionDetailType) => [constructionDetailType.sequence])
9
- @ObjectType({ description: '세부 공종 타입' })
10
- export class ConstructionDetailType {
11
- @PrimaryGeneratedColumn('uuid')
12
- @Field(type => ID)
13
- readonly id: string
14
-
15
- @Column({ nullable: false, comment: '세부 공종 이름' })
16
- @Field({ nullable: true })
17
- name?: string
18
-
19
- @Column({ nullable: true, comment: '시퀀스' })
20
- @Field(type => Int, { nullable: true })
21
- sequence?: number
22
-
23
- // 공종 타입 (상위 테이블 참조)
24
- @ManyToOne(type => ConstructionType)
25
- @Field({ nullable: true })
26
- constructionType?: ConstructionType
27
-
28
- @RelationId((constructionDetailType: ConstructionDetailType) => constructionDetailType.constructionType)
29
- constructionTypeId?: string
30
-
31
- @CreateDateColumn()
32
- @Field({ nullable: true })
33
- createdAt?: Date
34
-
35
- @UpdateDateColumn()
36
- @Field({ nullable: true })
37
- updatedAt?: Date
38
-
39
- @ManyToOne(type => User, { nullable: true })
40
- @Field(type => User, { nullable: true })
41
- creator?: User
42
-
43
- @RelationId((constructionDetailType: ConstructionDetailType) => constructionDetailType.creator)
44
- creatorId?: string
45
-
46
- @ManyToOne(type => User, { nullable: true })
47
- @Field(type => User, { nullable: true })
48
- updater?: User
49
-
50
- @RelationId((constructionDetailType: ConstructionDetailType) => constructionDetailType.updater)
51
- updaterId?: string
52
- }
@@ -1,6 +0,0 @@
1
- import { ConstructionDetailType } from './construction-detail-type'
2
- import { ConstructionDetailTypeQuery } from './construction-detail-type-query'
3
- import { ConstructionDetailTypeMutation } from './construction-detail-type-mutation'
4
-
5
- export const entities = [ConstructionDetailType]
6
- export const resolvers = [ConstructionDetailTypeQuery, ConstructionDetailTypeMutation]
@@ -1,66 +0,0 @@
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
- }
@@ -1,56 +0,0 @@
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
- import { ConstructionDetailType } from '../construction-detail-type/construction-detail-type'
7
-
8
- @Resolver(ConstructionType)
9
- export class ConstructionTypeQuery {
10
- @Query(returns => ConstructionType!, { nullable: true, description: 'To fetch a ConstructionType' })
11
- async constructionType(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<ConstructionType> {
12
- const { domain } = context.state
13
-
14
- return await getRepository(ConstructionType).findOne({
15
- where: { domain: { id: domain.id }, id }
16
- })
17
- }
18
-
19
- @Query(returns => ConstructionTypeList, { description: 'To fetch multiple ConstructionTypes' })
20
- async constructionTypes(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<ConstructionTypeList> {
21
- const { domain } = context.state
22
-
23
- const queryBuilder = getQueryBuilderFromListParams({
24
- domain,
25
- params,
26
- repository: await getRepository(ConstructionType)
27
- })
28
-
29
- const [items, total] = await queryBuilder.getManyAndCount()
30
-
31
- return { items, total }
32
- }
33
-
34
- @FieldResolver(type => [ConstructionDetailType])
35
- async constructionDetailTypes(@Root() constructionType: ConstructionType): Promise<ConstructionDetailType[]> {
36
- return await getRepository(ConstructionDetailType).find({
37
- where: { constructionType: { id: constructionType.id } },
38
- order: { sequence: 'ASC' }
39
- })
40
- }
41
-
42
- @FieldResolver(type => Domain)
43
- async domain(@Root() constructionType: ConstructionType): Promise<Domain> {
44
- return await getRepository(Domain).findOneBy({ id: constructionType.domainId })
45
- }
46
-
47
- @FieldResolver(type => User)
48
- async updater(@Root() constructionType: ConstructionType): Promise<User> {
49
- return await getRepository(User).findOneBy({ id: constructionType.updaterId })
50
- }
51
-
52
- @FieldResolver(type => User)
53
- async creator(@Root() constructionType: ConstructionType): Promise<User> {
54
- return await getRepository(User).findOneBy({ id: constructionType.creatorId })
55
- }
56
- }
@@ -1,26 +0,0 @@
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
- }
@@ -1,74 +0,0 @@
1
- import {
2
- CreateDateColumn,
3
- UpdateDateColumn,
4
- DeleteDateColumn,
5
- Entity,
6
- Index,
7
- Column,
8
- RelationId,
9
- ManyToOne,
10
- PrimaryGeneratedColumn,
11
- OneToMany
12
- } from 'typeorm'
13
- import { ObjectType, Field, ID } from 'type-graphql'
14
- import { Domain } from '@things-factory/shell'
15
- import { User } from '@things-factory/auth-base'
16
- import { ConstructionDetailType } from '../construction-detail-type/construction-detail-type'
17
-
18
- @Entity()
19
- @Index('ix_construction_type_0', (constructionType: ConstructionType) => [constructionType.domain, constructionType.name], {
20
- unique: true,
21
- where: '"deleted_at" IS NULL'
22
- })
23
- @ObjectType({ description: '공종 타입' })
24
- export class ConstructionType {
25
- @PrimaryGeneratedColumn('uuid')
26
- @Field(type => ID)
27
- readonly id: string
28
-
29
- @ManyToOne(type => Domain)
30
- @Field({ nullable: true })
31
- domain?: Domain
32
-
33
- @RelationId((constructionType: ConstructionType) => constructionType.domain)
34
- domainId?: string
35
-
36
- @Column()
37
- @Field({ nullable: true })
38
- name?: string
39
-
40
- @Column({ nullable: true })
41
- @Field({ nullable: true })
42
- description?: string
43
-
44
- // 상세 공종 정보 (하위 테이블 참조)
45
- @Field(() => [ConstructionDetailType], { nullable: true })
46
- @OneToMany(() => ConstructionDetailType, constructionDetailType => constructionDetailType.constructionType)
47
- constructionDetailTypes?: ConstructionDetailType[]
48
-
49
- @CreateDateColumn()
50
- @Field({ nullable: true })
51
- createdAt?: Date
52
-
53
- @UpdateDateColumn()
54
- @Field({ nullable: true })
55
- updatedAt?: Date
56
-
57
- @DeleteDateColumn()
58
- @Field({ nullable: true })
59
- deletedAt?: Date
60
-
61
- @ManyToOne(type => User, { nullable: true })
62
- @Field(type => User, { nullable: true })
63
- creator?: User
64
-
65
- @RelationId((constructionType: ConstructionType) => constructionType.creator)
66
- creatorId?: string
67
-
68
- @ManyToOne(type => User, { nullable: true })
69
- @Field(type => User, { nullable: true })
70
- updater?: User
71
-
72
- @RelationId((constructionType: ConstructionType) => constructionType.updater)
73
- updaterId?: string
74
- }
@@ -1,6 +0,0 @@
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]
@@ -1,56 +0,0 @@
1
- /* EXPORT ENTITY TYPES */
2
- export * from './task-resource/task-resource'
3
- export * from './resource/resource'
4
- export * from './construction-detail-type/construction-detail-type'
5
- export * from './construction-type/construction-type'
6
- export * from './inspection-drawing-type/inspection-drawing-type'
7
- export * from './inspection-part/inspection-part'
8
- export * from './worker-type/worker-type'
9
- export * from './manager/manager'
10
- export * from './task/task'
11
- export * from './project/project'
12
-
13
- /* IMPORT ENTITIES AND RESOLVERS */
14
- import { entities as TaskResourceEntities, resolvers as TaskResourceResolvers } from './task-resource'
15
- import { entities as ResourceEntities, resolvers as ResourceResolvers } from './resource'
16
- import {
17
- entities as ConstructionDetailTypeEntities,
18
- resolvers as ConstructionDetailTypeResolvers
19
- } from './construction-detail-type'
20
- import { entities as ConstructionTypeEntities, resolvers as ConstructionTypeResolvers } from './construction-type'
21
- import { entities as InspectionDrawingTypeEntities, resolvers as InspectionDrawingTypeResolvers } from './inspection-drawing-type'
22
- import { entities as InspectionPartEntities, resolvers as InspectionPartResolvers } from './inspection-part'
23
- import { entities as WorkerTypeEntities, resolvers as WorkerTypeResolvers } from './worker-type'
24
- import { entities as ManagerEntities, resolvers as ManagerResolvers } from './manager'
25
- import { entities as TaskEntities, resolvers as TaskResolvers } from './task'
26
- import { entities as ProjectEntities, resolvers as ProjectResolvers } from './project'
27
-
28
- export const entities = [
29
- /* ENTITIES */
30
- ...TaskResourceEntities,
31
- ...ResourceEntities,
32
- ...ConstructionDetailTypeEntities,
33
- ...ConstructionTypeEntities,
34
- ...InspectionDrawingTypeEntities,
35
- ...InspectionPartEntities,
36
- ...WorkerTypeEntities,
37
- ...ManagerEntities,
38
- ...TaskEntities,
39
- ...ProjectEntities
40
- ]
41
-
42
- export const schema = {
43
- resolverClasses: [
44
- /* RESOLVER CLASSES */
45
- ...TaskResourceResolvers,
46
- ...ResourceResolvers,
47
- ...ConstructionDetailTypeResolvers,
48
- ...ConstructionTypeResolvers,
49
- ...InspectionDrawingTypeResolvers,
50
- ...InspectionPartResolvers,
51
- ...WorkerTypeResolvers,
52
- ...ManagerResolvers,
53
- ...TaskResolvers,
54
- ...ProjectResolvers
55
- ]
56
- }
@@ -1,6 +0,0 @@
1
- import { InspectionDrawingType } from './inspection-drawing-type'
2
- import { InspectionDrawingTypeQuery } from './inspection-drawing-type-query'
3
- import { InspectionDrawingTypeMutation } from './inspection-drawing-type-mutation'
4
-
5
- export const entities = [InspectionDrawingType]
6
- export const resolvers = [InspectionDrawingTypeQuery, InspectionDrawingTypeMutation]
@@ -1,69 +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 { InspectionDrawingType } from './inspection-drawing-type'
5
- import { InspectionDrawingTypePatch } from './inspection-drawing-type-type'
6
-
7
- @Resolver(InspectionDrawingType)
8
- export class InspectionDrawingTypeMutation {
9
- @Directive('@transaction')
10
- @Mutation(returns => [InspectionDrawingType], { description: "To modify multiple InspectionDrawingTypes' information" })
11
- async updateMultipleInspectionDrawingType(
12
- @Arg('patches', type => [InspectionDrawingTypePatch]) patches: InspectionDrawingTypePatch[],
13
- @Ctx() context: ResolverContext
14
- ): Promise<InspectionDrawingType[]> {
15
- const { domain, user, tx } = context.state
16
-
17
- let results = []
18
- const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
19
- const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
20
- const inspectionDrawingTypeRepo = getRepository(InspectionDrawingType, tx)
21
-
22
- if (_createRecords.length > 0) {
23
- for (let i = 0; i < _createRecords.length; i++) {
24
- const newRecord = _createRecords[i]
25
-
26
- const result = await inspectionDrawingTypeRepo.save({
27
- ...newRecord,
28
- domain,
29
- creator: user,
30
- updater: user
31
- })
32
-
33
- results.push({ ...result, cuFlag: '+' })
34
- }
35
- }
36
-
37
- if (_updateRecords.length > 0) {
38
- for (let i = 0; i < _updateRecords.length; i++) {
39
- const updateRecord = _updateRecords[i]
40
- const inspectionDrawingType = await inspectionDrawingTypeRepo.findOneBy({ id: updateRecord.id })
41
-
42
- const result = await inspectionDrawingTypeRepo.save({
43
- ...inspectionDrawingType,
44
- ...updateRecord,
45
- updater: user
46
- })
47
-
48
- results.push({ ...result, cuFlag: 'M' })
49
- }
50
- }
51
-
52
- return results
53
- }
54
-
55
- @Directive('@transaction')
56
- @Mutation(returns => Boolean, { description: 'To delete multiple InspectionDrawingTypes' })
57
- async deleteInspectionDrawingTypes(
58
- @Arg('ids', type => [String]) ids: string[],
59
- @Ctx() context: ResolverContext
60
- ): Promise<boolean> {
61
- const { domain, tx } = context.state
62
-
63
- await getRepository(InspectionDrawingType, tx).delete({
64
- id: In(ids)
65
- })
66
-
67
- return true
68
- }
69
- }