@dssp/project 1.0.0-alpha.0 → 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.
Files changed (97) hide show
  1. package/dist-client/tsconfig.tsbuildinfo +1 -1
  2. package/package.json +3 -3
  3. package/client/bootstrap.ts +0 -0
  4. package/client/index.ts +0 -0
  5. package/client/pages/lib/select2-component.ts +0 -175
  6. package/client/pages/lib/waether.ts +0 -159
  7. package/client/pages/project/component/project-update-header.ts +0 -88
  8. package/client/pages/project/popup/popup-plan-upload.ts +0 -138
  9. package/client/pages/project/popup/popup-project-create.ts +0 -147
  10. package/client/pages/project/popup/popup-schedule-upload.ts +0 -102
  11. package/client/pages/project/project-completed-list.ts +0 -281
  12. package/client/pages/project/project-detail.ts +0 -738
  13. package/client/pages/project/project-list.ts +0 -418
  14. package/client/pages/project/project-plan-management.ts +0 -476
  15. package/client/pages/project/project-schedule-list.ts +0 -294
  16. package/client/pages/project/project-schedule.ts +0 -393
  17. package/client/pages/project/project-setting-list.ts +0 -393
  18. package/client/pages/project/project-update.ts +0 -876
  19. package/client/pages/resource/construction-detail-type-popup.ts +0 -201
  20. package/client/pages/resource/construction-type-management.ts +0 -212
  21. package/client/pages/resource/inspection-drawing-type-management.ts +0 -245
  22. package/client/pages/resource/inspection-part-popup.ts +0 -201
  23. package/client/pages/resource/resource-importer.ts +0 -97
  24. package/client/pages/resource/resource-list-page.ts +0 -356
  25. package/client/pages/resource/worker-type-management.ts +0 -192
  26. package/client/pages/task/task-importer.ts +0 -94
  27. package/client/pages/task/task-list-page.ts +0 -340
  28. package/client/pages/task-resource/task-resource-importer.ts +0 -97
  29. package/client/pages/task-resource/task-resource-list-page.ts +0 -356
  30. package/client/route.ts +0 -55
  31. package/client/tsconfig.json +0 -11
  32. package/server/controllers/export-tasks.ts +0 -40
  33. package/server/controllers/import-task.ts +0 -134
  34. package/server/controllers/index.ts +0 -0
  35. package/server/controllers/parse-excel.ts +0 -86
  36. package/server/controllers/types.ts +0 -20
  37. package/server/index.ts +0 -4
  38. package/server/middlewares/index.ts +0 -3
  39. package/server/migrations/1723861466413-seed-roles.ts +0 -128
  40. package/server/migrations/1723861466414-seed-codes.ts +0 -157
  41. package/server/migrations/1723861476419-seed-resources.ts +0 -62
  42. package/server/migrations/1723861478420-seed-/bsample-project.ts +0 -87
  43. package/server/migrations/1723861478421-seed-/bsample-tasks.ts +0 -194
  44. package/server/migrations/index.ts +0 -9
  45. package/server/routes.ts +0 -108
  46. package/server/service/construction-detail-type/construction-detail-type-mutation.ts +0 -57
  47. package/server/service/construction-detail-type/construction-detail-type-query.ts +0 -31
  48. package/server/service/construction-detail-type/construction-detail-type-type.ts +0 -26
  49. package/server/service/construction-detail-type/construction-detail-type.ts +0 -52
  50. package/server/service/construction-detail-type/index.ts +0 -6
  51. package/server/service/construction-type/construction-type-mutation.ts +0 -66
  52. package/server/service/construction-type/construction-type-query.ts +0 -56
  53. package/server/service/construction-type/construction-type-type.ts +0 -26
  54. package/server/service/construction-type/construction-type.ts +0 -74
  55. package/server/service/construction-type/index.ts +0 -6
  56. package/server/service/index.ts +0 -56
  57. package/server/service/inspection-drawing-type/index.ts +0 -6
  58. package/server/service/inspection-drawing-type/inspection-drawing-type-mutation.ts +0 -69
  59. package/server/service/inspection-drawing-type/inspection-drawing-type-query.ts +0 -55
  60. package/server/service/inspection-drawing-type/inspection-drawing-type-type.ts +0 -23
  61. package/server/service/inspection-drawing-type/inspection-drawing-type.ts +0 -68
  62. package/server/service/inspection-part/index.ts +0 -6
  63. package/server/service/inspection-part/inspection-part-mutation.ts +0 -52
  64. package/server/service/inspection-part/inspection-part-query.ts +0 -41
  65. package/server/service/inspection-part/inspection-part-type.ts +0 -26
  66. package/server/service/inspection-part/inspection-part.ts +0 -51
  67. package/server/service/manager/index.ts +0 -6
  68. package/server/service/manager/manager-mutation.ts +0 -42
  69. package/server/service/manager/manager-query.ts +0 -28
  70. package/server/service/manager/manager-type.ts +0 -40
  71. package/server/service/manager/manager.ts +0 -29
  72. package/server/service/project/index.ts +0 -6
  73. package/server/service/project/project-mutation.ts +0 -255
  74. package/server/service/project/project-query.ts +0 -105
  75. package/server/service/project/project-type.ts +0 -72
  76. package/server/service/project/project.ts +0 -134
  77. package/server/service/resource/index.ts +0 -7
  78. package/server/service/resource/resource-mutation.ts +0 -137
  79. package/server/service/resource/resource-query.ts +0 -50
  80. package/server/service/resource/resource-type.ts +0 -41
  81. package/server/service/resource/resource.ts +0 -82
  82. package/server/service/task/index.ts +0 -6
  83. package/server/service/task/task-mutation.ts +0 -135
  84. package/server/service/task/task-query.ts +0 -169
  85. package/server/service/task/task-type.ts +0 -75
  86. package/server/service/task/task.ts +0 -130
  87. package/server/service/task-resource/index.ts +0 -7
  88. package/server/service/task-resource/task-resource-mutation.ts +0 -140
  89. package/server/service/task-resource/task-resource-query.ts +0 -36
  90. package/server/service/task-resource/task-resource-type.ts +0 -41
  91. package/server/service/task-resource/task-resource.ts +0 -51
  92. package/server/service/worker-type/index.ts +0 -6
  93. package/server/service/worker-type/worker-type-mutation.ts +0 -66
  94. package/server/service/worker-type/worker-type-query.ts +0 -47
  95. package/server/service/worker-type/worker-type-type.ts +0 -26
  96. package/server/service/worker-type/worker-type.ts +0 -68
  97. package/server/tsconfig.json +0 -10
@@ -1,130 +0,0 @@
1
- import {
2
- CreateDateColumn,
3
- UpdateDateColumn,
4
- DeleteDateColumn,
5
- Entity,
6
- Index,
7
- Column,
8
- RelationId,
9
- ManyToOne,
10
- OneToMany,
11
- PrimaryGeneratedColumn
12
- } from 'typeorm'
13
- import { ObjectType, Field, ID, registerEnumType } from 'type-graphql'
14
-
15
- import { ScalarObject } from '@things-factory/shell'
16
- import { User } from '@things-factory/auth-base'
17
- import { Project } from '../project/project'
18
- // import { Checklist } from '@dssp/supervisor'
19
- import { TaskResource } from '../task-resource/task-resource'
20
-
21
- export enum TaskType {
22
- GROUP = 'group',
23
- TASK = 'task'
24
- }
25
-
26
- registerEnumType(TaskType, {
27
- name: 'TaskType',
28
- description: '작업 타입'
29
- })
30
-
31
- @Entity()
32
- @Index('ix_task_project_code', (task: Task) => [task.project, task.code], { unique: true, where: '"deleted_at" IS NULL' })
33
- @ObjectType({ description: '공정표 작업 정보' })
34
- export class Task {
35
- @PrimaryGeneratedColumn('uuid')
36
- @Field(type => ID)
37
- readonly id: string
38
-
39
- @Column({ nullable: false, comment: '프로젝트 내에서 유니크한 작업 코드' })
40
- @Field({ nullable: false })
41
- code: string
42
-
43
- @Column({ nullable: true, comment: '작업 명' })
44
- @Field({ nullable: true })
45
- name?: string
46
-
47
- @Column({ nullable: true, comment: '테스크 타입 (group: 공종, task: 세부 공종)' })
48
- @Field({ nullable: true })
49
- type?: TaskType
50
-
51
- @ManyToOne(type => Task, task => task.children, { nullable: true })
52
- @Field({ nullable: true })
53
- parent: Task
54
-
55
- @RelationId((task: Task) => task.parent)
56
- parentId?: string
57
-
58
- @OneToMany(type => Task, task => task.parent, { nullable: true })
59
- @Field(type => [Task], { nullable: true })
60
- children?: Task[]
61
-
62
- @Column({ nullable: true, comment: '시작일' })
63
- @Field({ nullable: true })
64
- startDate?: Date
65
-
66
- @Column({ nullable: true, comment: '종료일' })
67
- @Field({ nullable: true })
68
- endDate?: Date
69
-
70
- @Column({ nullable: true, comment: '기간' })
71
- @Field({ nullable: true })
72
- duration?: number
73
-
74
- @Column({ nullable: true, comment: '선행 태스크 코드' })
75
- @Field({ nullable: true })
76
- dependsOn?: string
77
-
78
- @ManyToOne(type => Project, project => project.tasks)
79
- @Field(type => Project)
80
- project?: Project
81
-
82
- @RelationId((task: Task) => task.project)
83
- projectId?: string
84
-
85
- @Column('simple-json', { nullable: true, default: null })
86
- @Field(type => ScalarObject, { nullable: true })
87
- tags?: string[]
88
-
89
- @Column({ nullable: true, comment: '진행율' })
90
- @Field({ nullable: true })
91
- progress?: number
92
-
93
- @Column({ nullable: true, comment: '스타일' })
94
- @Field({ nullable: true })
95
- style?: string
96
-
97
- // @OneToMany(type => Checklist, checklist => checklist.task, { nullable: true })
98
- // @Field(type => [Checklist], { nullable: true })
99
- // checklists?: Checklist[]
100
-
101
- @OneToMany(type => TaskResource, taskResource => taskResource.task, { cascade: true })
102
- @Field(type => [TaskResource], { nullable: true })
103
- taskResources?: TaskResource[]
104
-
105
- @CreateDateColumn()
106
- @Field({ nullable: true })
107
- createdAt?: Date
108
-
109
- @UpdateDateColumn()
110
- @Field({ nullable: true })
111
- updatedAt?: Date
112
-
113
- @DeleteDateColumn()
114
- @Field({ nullable: true })
115
- deletedAt?: Date
116
-
117
- @ManyToOne(type => User, { nullable: true })
118
- @Field(type => User, { nullable: true })
119
- creator?: User
120
-
121
- @RelationId((task: Task) => task.creator)
122
- creatorId?: string
123
-
124
- @ManyToOne(type => User, { nullable: true })
125
- @Field(type => User, { nullable: true })
126
- updater?: User
127
-
128
- @RelationId((task: Task) => task.updater)
129
- updaterId?: string
130
- }
@@ -1,7 +0,0 @@
1
- import { TaskResource } from './task-resource'
2
- import { TaskResourceQuery } from './task-resource-query'
3
- import { TaskResourceMutation } from './task-resource-mutation'
4
-
5
- export const entities = [TaskResource]
6
- export const resolvers = [TaskResourceQuery, TaskResourceMutation]
7
- export const subscribers = []
@@ -1,140 +0,0 @@
1
- import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
2
- import { In } from 'typeorm'
3
-
4
- import { TaskResource } from './task-resource'
5
- import { NewTaskResource, TaskResourcePatch } from './task-resource-type'
6
-
7
- @Resolver(TaskResource)
8
- export class TaskResourceMutation {
9
- @Directive('@transaction')
10
- @Directive('@privilege(category: "project", privilege: "mutation", domainOwnerGranted: true)')
11
- @Mutation(returns => TaskResource, { description: 'To create new TaskResource' })
12
- async createTaskResource(
13
- @Arg('taskResource') taskResource: NewTaskResource,
14
- @Ctx() context: ResolverContext
15
- ): Promise<TaskResource> {
16
- const { domain, user, tx } = context.state
17
-
18
- const result = await tx.getRepository(TaskResource).save({
19
- ...taskResource,
20
- domain,
21
- creator: user,
22
- updater: user
23
- })
24
-
25
- return result
26
- }
27
-
28
- @Directive('@transaction')
29
- @Directive('@privilege(category: "project", privilege: "mutation", domainOwnerGranted: true)')
30
- @Mutation(returns => TaskResource, { description: 'To modify TaskResource information' })
31
- async updateTaskResource(
32
- @Arg('id') id: string,
33
- @Arg('patch') patch: TaskResourcePatch,
34
- @Ctx() context: ResolverContext
35
- ): Promise<TaskResource> {
36
- const { domain, user, tx } = context.state
37
-
38
- const repository = tx.getRepository(TaskResource)
39
- const taskResource = await repository.findOne({
40
- where: { id }
41
- })
42
-
43
- const result = await repository.save({
44
- ...taskResource,
45
- ...patch,
46
- updater: user
47
- })
48
-
49
- return result
50
- }
51
-
52
- @Directive('@transaction')
53
- @Directive('@privilege(category: "project", privilege: "mutation", domainOwnerGranted: true)')
54
- @Mutation(returns => [TaskResource], { description: "To modify multiple TaskResources' information" })
55
- async updateMultipleTaskResource(
56
- @Arg('patches', type => [TaskResourcePatch]) patches: TaskResourcePatch[],
57
- @Ctx() context: ResolverContext
58
- ): Promise<TaskResource[]> {
59
- const { domain, user, tx } = context.state
60
-
61
- let results = []
62
- const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
63
- const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
64
- const taskResourceRepo = tx.getRepository(TaskResource)
65
-
66
- if (_createRecords.length > 0) {
67
- for (let i = 0; i < _createRecords.length; i++) {
68
- const newRecord = _createRecords[i]
69
-
70
- const result = await taskResourceRepo.save({
71
- ...newRecord,
72
- domain,
73
- creator: user,
74
- updater: user
75
- })
76
-
77
- results.push({ ...result, cuFlag: '+' })
78
- }
79
- }
80
-
81
- if (_updateRecords.length > 0) {
82
- for (let i = 0; i < _updateRecords.length; i++) {
83
- const updateRecord = _updateRecords[i]
84
- const taskResource = await taskResourceRepo.findOneBy({ id: updateRecord.id })
85
-
86
- const result = await taskResourceRepo.save({
87
- ...taskResource,
88
- ...updateRecord,
89
- updater: user
90
- })
91
-
92
- results.push({ ...result, cuFlag: 'M' })
93
- }
94
- }
95
-
96
- return results
97
- }
98
-
99
- @Directive('@transaction')
100
- @Directive('@privilege(category: "project", privilege: "mutation", domainOwnerGranted: true)')
101
- @Mutation(returns => Boolean, { description: 'To delete TaskResource' })
102
- async deleteTaskResource(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
103
- const { domain, tx } = context.state
104
-
105
- await tx.getRepository(TaskResource).delete({ id })
106
-
107
- return true
108
- }
109
-
110
- @Directive('@transaction')
111
- @Directive('@privilege(category: "project", privilege: "mutation", domainOwnerGranted: true)')
112
- @Mutation(returns => Boolean, { description: 'To delete multiple TaskResources' })
113
- async deleteTaskResources(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {
114
- const { domain, tx } = context.state
115
-
116
- await tx.getRepository(TaskResource).delete({
117
- id: In(ids)
118
- })
119
-
120
- return true
121
- }
122
-
123
- @Directive('@transaction')
124
- @Directive('@privilege(category: "project", privilege: "mutation", domainOwnerGranted: true)')
125
- @Mutation(returns => Boolean, { description: 'To import multiple TaskResources' })
126
- async importTaskResources(
127
- @Arg('taskResources', type => [TaskResourcePatch]) taskResources: TaskResourcePatch[],
128
- @Ctx() context: ResolverContext
129
- ): Promise<boolean> {
130
- const { domain, tx } = context.state
131
-
132
- await Promise.all(
133
- taskResources.map(async (taskResource: TaskResourcePatch) => {
134
- const createdTaskResource: TaskResource = await tx.getRepository(TaskResource).save({ domain, ...taskResource })
135
- })
136
- )
137
-
138
- return true
139
- }
140
- }
@@ -1,36 +0,0 @@
1
- import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'
2
- import { Attachment } from '@things-factory/attachment-base'
3
- import { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
4
- import { User } from '@things-factory/auth-base'
5
- import { TaskResource } from './task-resource'
6
- import { TaskResourceList } from './task-resource-type'
7
-
8
- @Resolver(TaskResource)
9
- export class TaskResourceQuery {
10
- @Directive('@privilege(category: "project", privilege: "query", domainOwnerGranted: true)')
11
- @Query(returns => TaskResource!, { nullable: true, description: 'To fetch a TaskResource' })
12
- async taskResource(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<TaskResource> {
13
- const { domain } = context.state
14
-
15
- return await getRepository(TaskResource).findOne({
16
- where: { id }
17
- })
18
- }
19
-
20
- @Directive('@privilege(category: "project", privilege: "query", domainOwnerGranted: true)')
21
- @Query(returns => TaskResourceList, { description: 'To fetch multiple TaskResources' })
22
- async taskResources(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<TaskResourceList> {
23
- const { domain } = context.state
24
-
25
- const queryBuilder = getQueryBuilderFromListParams({
26
- domain,
27
- params,
28
- repository: await getRepository(TaskResource),
29
- searchables: ['name', 'description']
30
- })
31
-
32
- const [items, total] = await queryBuilder.getManyAndCount()
33
-
34
- return { items, total }
35
- }
36
- }
@@ -1,41 +0,0 @@
1
- import { InputType, Field, ID, ObjectType, Int } from 'type-graphql'
2
- import { TaskResource } from './task-resource'
3
-
4
- @InputType()
5
- export class NewTaskResource {
6
- @Field(type => ID)
7
- taskId: string
8
-
9
- @Field(type => ID)
10
- resourceId: string
11
-
12
- @Field()
13
- quantity: number
14
- }
15
-
16
- @InputType()
17
- export class TaskResourcePatch {
18
- @Field(type => ID, { nullable: true })
19
- id?: string
20
-
21
- @Field(type => ID, { nullable: true })
22
- taskId?: string
23
-
24
- @Field(type => ID, { nullable: true })
25
- resourceId?: string
26
-
27
- @Field({ nullable: true })
28
- quantity?: number
29
-
30
- @Field({ nullable: true })
31
- cuFlag?: string
32
- }
33
-
34
- @ObjectType()
35
- export class TaskResourceList {
36
- @Field(type => [TaskResource])
37
- items: TaskResource[]
38
-
39
- @Field(type => Int)
40
- total: number
41
- }
@@ -1,51 +0,0 @@
1
- import {
2
- Entity,
3
- PrimaryGeneratedColumn,
4
- RelationId,
5
- ManyToOne,
6
- Column,
7
- CreateDateColumn,
8
- UpdateDateColumn,
9
- DeleteDateColumn
10
- } from 'typeorm'
11
- import { ObjectType, Field, ID } from 'type-graphql'
12
- import { Task } from '../task/task'
13
- import { Resource } from '../resource/resource'
14
-
15
- @Entity()
16
- @ObjectType({ description: '작업에 소요되는 자원' })
17
- export class TaskResource {
18
- @PrimaryGeneratedColumn('uuid')
19
- @Field(type => ID)
20
- readonly id: string
21
-
22
- @ManyToOne(() => Task, task => task.taskResources, { nullable: false })
23
- @Field(type => Task)
24
- task: Task
25
-
26
- @RelationId((taskResource: TaskResource) => taskResource.task)
27
- taskId: string
28
-
29
- @ManyToOne(() => Resource, resource => resource.taskResources, { nullable: false })
30
- @Field(type => Resource)
31
- resource: Resource
32
-
33
- @RelationId((taskResource: TaskResource) => taskResource.resource)
34
- resourceId: string
35
-
36
- @Column({ type: 'float', nullable: false, comment: '소요량 (예: 8, 5 등)' })
37
- @Field({ nullable: false })
38
- quantity: number
39
-
40
- @CreateDateColumn()
41
- @Field({ nullable: true })
42
- createdAt?: Date
43
-
44
- @UpdateDateColumn()
45
- @Field({ nullable: true })
46
- updatedAt?: Date
47
-
48
- @DeleteDateColumn()
49
- @Field({ nullable: true })
50
- deletedAt?: Date
51
- }
@@ -1,6 +0,0 @@
1
- import { WorkerType } from './worker-type'
2
- import { WorkerTypeQuery } from './worker-type-query'
3
- import { WorkerTypeMutation } from './worker-type-mutation'
4
-
5
- export const entities = [WorkerType]
6
- export const resolvers = [WorkerTypeQuery, WorkerTypeMutation]
@@ -1,66 +0,0 @@
1
- import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
2
- import { In } from 'typeorm'
3
- import { WorkerType } from './worker-type'
4
- import { WorkerTypePatch } from './worker-type-type'
5
-
6
- @Resolver(WorkerType)
7
- export class WorkerTypeMutation {
8
- @Directive('@transaction')
9
- @Mutation(returns => [WorkerType], { description: "To modify multiple WorkerTypes' information" })
10
- async updateMultipleWorkerType(
11
- @Arg('patches', type => [WorkerTypePatch]) patches: WorkerTypePatch[],
12
- @Ctx() context: ResolverContext
13
- ): Promise<WorkerType[]> {
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 workerTypeRepo = tx.getRepository(WorkerType)
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 workerTypeRepo.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 workerType = await workerTypeRepo.findOneBy({ id: updateRecord.id })
40
-
41
- const result = await workerTypeRepo.save({
42
- ...workerType,
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 WorkerTypes' })
56
- async deleteWorkerTypes(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {
57
- const { domain, tx } = context.state
58
-
59
- await tx.getRepository(WorkerType).softDelete({
60
- domain: { id: domain.id },
61
- id: In(ids)
62
- })
63
-
64
- return true
65
- }
66
- }
@@ -1,47 +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 { WorkerType } from './worker-type'
5
- import { WorkerTypeList } from './worker-type-type'
6
-
7
- @Resolver(WorkerType)
8
- export class WorkerTypeQuery {
9
- @Query(returns => WorkerType!, { nullable: true, description: 'To fetch a WorkerType' })
10
- async workerType(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<WorkerType> {
11
- const { domain } = context.state
12
-
13
- return await getRepository(WorkerType).findOne({
14
- where: { domain: { id: domain.id }, id }
15
- })
16
- }
17
-
18
- @Query(returns => WorkerTypeList, { description: 'To fetch multiple WorkerTypes' })
19
- async workerTypes(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<WorkerTypeList> {
20
- const { domain } = context.state
21
-
22
- const queryBuilder = getQueryBuilderFromListParams({
23
- domain,
24
- params,
25
- repository: await getRepository(WorkerType)
26
- })
27
-
28
- const [items, total] = await queryBuilder.getManyAndCount()
29
-
30
- return { items, total }
31
- }
32
-
33
- @FieldResolver(type => Domain)
34
- async domain(@Root() workerType: WorkerType): Promise<Domain> {
35
- return await getRepository(Domain).findOneBy({ id: workerType.domainId })
36
- }
37
-
38
- @FieldResolver(type => User)
39
- async updater(@Root() workerType: WorkerType): Promise<User> {
40
- return await getRepository(User).findOneBy({ id: workerType.updaterId })
41
- }
42
-
43
- @FieldResolver(type => User)
44
- async creator(@Root() workerType: WorkerType): Promise<User> {
45
- return await getRepository(User).findOneBy({ id: workerType.creatorId })
46
- }
47
- }
@@ -1,26 +0,0 @@
1
- import { ObjectType, Field, InputType, Int, ID } from 'type-graphql'
2
- import { WorkerType } from './worker-type'
3
-
4
- @InputType()
5
- export class WorkerTypePatch {
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()
16
- cuFlag: string
17
- }
18
-
19
- @ObjectType()
20
- export class WorkerTypeList {
21
- @Field(type => [WorkerType])
22
- items: WorkerType[]
23
-
24
- @Field(type => Int)
25
- total: number
26
- }
@@ -1,68 +0,0 @@
1
- import {
2
- CreateDateColumn,
3
- UpdateDateColumn,
4
- DeleteDateColumn,
5
- Entity,
6
- Index,
7
- Column,
8
- RelationId,
9
- ManyToOne,
10
- PrimaryGeneratedColumn
11
- } from 'typeorm'
12
- import { ObjectType, Field, ID } from 'type-graphql'
13
-
14
- import { Domain } from '@things-factory/shell'
15
- import { User } from '@things-factory/auth-base'
16
-
17
- @Entity()
18
- @Index('ix_worker_type_0', (workerType: WorkerType) => [workerType.domain, workerType.name], {
19
- unique: true,
20
- where: '"deleted_at" IS NULL'
21
- })
22
- @ObjectType({ description: '작업자 타입' })
23
- export class WorkerType {
24
- @PrimaryGeneratedColumn('uuid')
25
- @Field(type => ID)
26
- readonly id: string
27
-
28
- @ManyToOne(type => Domain)
29
- @Field({ nullable: true })
30
- domain?: Domain
31
-
32
- @RelationId((workerType: WorkerType) => workerType.domain)
33
- domainId?: string
34
-
35
- @Column({ nullable: false, comment: '타입 이름' })
36
- @Field({ nullable: false })
37
- name: string
38
-
39
- @Column({ nullable: true, comment: '설명' })
40
- @Field({ nullable: true })
41
- description?: string
42
-
43
- @CreateDateColumn()
44
- @Field({ nullable: true })
45
- createdAt?: Date
46
-
47
- @UpdateDateColumn()
48
- @Field({ nullable: true })
49
- updatedAt?: Date
50
-
51
- @DeleteDateColumn()
52
- @Field({ nullable: true })
53
- deletedAt?: Date
54
-
55
- @ManyToOne(type => User, { nullable: true })
56
- @Field(type => User, { nullable: true })
57
- creator?: User
58
-
59
- @RelationId((workerType: WorkerType) => workerType.creator)
60
- creatorId?: string
61
-
62
- @ManyToOne(type => User, { nullable: true })
63
- @Field(type => User, { nullable: true })
64
- updater?: User
65
-
66
- @RelationId((workerType: WorkerType) => workerType.updater)
67
- updaterId?: string
68
- }
@@ -1,10 +0,0 @@
1
- {
2
- "extends": "../../tsconfig-base.json",
3
- "compilerOptions": {
4
- "strict": false,
5
- "module": "commonjs",
6
- "outDir": "../dist-server",
7
- "baseUrl": "./"
8
- },
9
- "include": ["./**/*"]
10
- }