@things-factory/rack-base 8.0.5 → 9.0.0-beta.12

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 (44) hide show
  1. package/dist-client/bootstrap.d.ts +1 -0
  2. package/dist-client/bootstrap.js +2 -0
  3. package/dist-client/bootstrap.js.map +1 -0
  4. package/dist-client/index.js +2 -0
  5. package/dist-client/index.js.map +1 -0
  6. package/dist-client/pages/cell/cell-importer.d.ts +23 -0
  7. package/dist-client/pages/cell/cell-importer.js +94 -0
  8. package/dist-client/pages/cell/cell-importer.js.map +1 -0
  9. package/dist-client/pages/cell/cell-list-page.d.ts +54 -0
  10. package/dist-client/pages/cell/cell-list-page.js +290 -0
  11. package/dist-client/pages/cell/cell-list-page.js.map +1 -0
  12. package/dist-client/pages/rack/rack-importer.d.ts +23 -0
  13. package/dist-client/pages/rack/rack-importer.js +94 -0
  14. package/dist-client/pages/rack/rack-importer.js.map +1 -0
  15. package/dist-client/pages/rack/rack-list-page.d.ts +54 -0
  16. package/dist-client/pages/rack/rack-list-page.js +294 -0
  17. package/dist-client/pages/rack/rack-list-page.js.map +1 -0
  18. package/dist-client/route.d.ts +1 -0
  19. package/dist-client/route.js +11 -0
  20. package/dist-client/route.js.map +1 -0
  21. package/dist-client/tsconfig.tsbuildinfo +1 -0
  22. package/dist-server/tsconfig.tsbuildinfo +1 -1
  23. package/package.json +5 -8
  24. package/client/bootstrap.ts +0 -1
  25. package/client/pages/cell/cell-importer.ts +0 -87
  26. package/client/pages/cell/cell-list-page.ts +0 -308
  27. package/client/pages/rack/rack-importer.ts +0 -87
  28. package/client/pages/rack/rack-list-page.ts +0 -312
  29. package/client/route.ts +0 -11
  30. package/server/index.ts +0 -1
  31. package/server/migrations/index.ts +0 -9
  32. package/server/routes.ts +0 -26
  33. package/server/service/cell/cell-mutation.ts +0 -133
  34. package/server/service/cell/cell-query.ts +0 -50
  35. package/server/service/cell/cell-type.ts +0 -96
  36. package/server/service/cell/cell.ts +0 -112
  37. package/server/service/cell/index.ts +0 -6
  38. package/server/service/index.ts +0 -22
  39. package/server/service/rack/index.ts +0 -6
  40. package/server/service/rack/rack-mutation.ts +0 -133
  41. package/server/service/rack/rack-query.ts +0 -64
  42. package/server/service/rack/rack-type.ts +0 -54
  43. package/server/service/rack/rack.ts +0 -76
  44. /package/{client/index.ts → dist-client/index.d.ts} +0 -0
@@ -1,112 +0,0 @@
1
- import { Field, ID, ObjectType } from 'type-graphql'
2
- import {
3
- Column,
4
- CreateDateColumn,
5
- Entity,
6
- Index,
7
- ManyToOne,
8
- PrimaryGeneratedColumn,
9
- RelationId,
10
- UpdateDateColumn
11
- } from 'typeorm'
12
-
13
- import { User } from '@things-factory/auth-base'
14
- import { Domain } from '@things-factory/shell'
15
-
16
- @Entity()
17
- @Index('ix_cell_0', (cell: Cell) => [cell.domain, cell.cellCd], { unique: true })
18
- @ObjectType({ description: 'Entity for Cell' })
19
- export class Cell {
20
- @PrimaryGeneratedColumn('uuid')
21
- @Field(type => ID)
22
- readonly id: string
23
-
24
- @ManyToOne(type => Domain)
25
- @Field(type => Domain)
26
- domain?: Domain
27
-
28
- @RelationId((cell: Cell) => cell.domain)
29
- domainId?: string
30
-
31
- @Column({ nullable: true, length: 30 })
32
- @Field({ nullable: true })
33
- stationCd: string
34
-
35
- @Column({ length: 30 })
36
- @Field()
37
- equipCd: string
38
-
39
- @Column({ length: 30 })
40
- @Field()
41
- cellCd: string
42
-
43
- @Column({ length: 30 })
44
- @Field()
45
- indCd: string
46
-
47
- @Column({ length: 40 })
48
- @Field()
49
- channelNo: string
50
-
51
- @Column({ length: 40 })
52
- @Field()
53
- panNo: string
54
-
55
- @Column({ nullable: true, length: 30 })
56
- @Field({ nullable: true })
57
- equipZone?: string
58
-
59
- @Column({ nullable: true, length: 30 })
60
- @Field({ nullable: true })
61
- sideCd?: string
62
-
63
- @Column({ nullable: true, width: 10 })
64
- @Field({ nullable: true })
65
- cellSeq?: number
66
-
67
- @Column({ nullable: true, length: 30 })
68
- @Field({ nullable: true })
69
- printerCd?: string
70
-
71
- @Column({
72
- nullable: true
73
- })
74
- @Field({ nullable: true })
75
- activeFlag?: boolean
76
-
77
- @Column({ nullable: true, width: 10 })
78
- @Field({ nullable: true })
79
- status?: string
80
-
81
- @Column({
82
- nullable: true
83
- })
84
- @Field({ nullable: true })
85
- params?: string
86
-
87
- @CreateDateColumn()
88
- @Field({ nullable: true })
89
- createdAt?: Date
90
-
91
- @UpdateDateColumn()
92
- @Field({ nullable: true })
93
- updatedAt?: Date
94
-
95
- @ManyToOne(type => User, {
96
- nullable: true
97
- })
98
- @Field(type => User, { nullable: true })
99
- creator?: User
100
-
101
- @RelationId((cell: Cell) => cell.creator)
102
- creatorId?: string
103
-
104
- @ManyToOne(type => User, {
105
- nullable: true
106
- })
107
- @Field(type => User, { nullable: true })
108
- updater?: User
109
-
110
- @RelationId((cell: Cell) => cell.updater)
111
- updaterId?: string
112
- }
@@ -1,6 +0,0 @@
1
- import { Cell } from './cell'
2
- import { CellQuery } from './cell-query'
3
- import { CellMutation } from './cell-mutation'
4
-
5
- export const entities = [Cell]
6
- export const resolvers = [CellQuery, CellMutation]
@@ -1,22 +0,0 @@
1
- /* EXPORT ENTITY TYPES */
2
- export * from './rack/rack'
3
- export * from './cell/cell'
4
-
5
- /* IMPORT ENTITIES AND RESOLVERS */
6
- import { entities as RackEntities, resolvers as RackResolvers } from './rack'
7
- import { entities as CellEntities, resolvers as CellResolvers } from './cell'
8
-
9
- export const entities = [
10
- /* ENTITIES */
11
- ...RackEntities,
12
- ...CellEntities,
13
- ]
14
-
15
-
16
- export const schema = {
17
- resolverClasses: [
18
- /* RESOLVER CLASSES */
19
- ...RackResolvers,
20
- ...CellResolvers,
21
- ]
22
- }
@@ -1,6 +0,0 @@
1
- import { Rack } from './rack'
2
- import { RackQuery } from './rack-query'
3
- import { RackMutation } from './rack-mutation'
4
-
5
- export const entities = [Rack]
6
- export const resolvers = [RackQuery, RackMutation]
@@ -1,133 +0,0 @@
1
- import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'
2
- import { In } from 'typeorm'
3
-
4
- import { deleteAttachmentsByRef } from '@things-factory/attachment-base'
5
-
6
- import { Rack } from './rack'
7
- import { NewRack, RackPatch } from './rack-type'
8
-
9
- @Resolver(Rack)
10
- export class RackMutation {
11
- @Directive('@transaction')
12
- @Mutation(returns => Rack, { description: 'To create new Rack' })
13
- async createRack(@Arg('rack') rack: NewRack, @Ctx() context: ResolverContext): Promise<Rack> {
14
- const { domain, user, tx } = context.state
15
-
16
- return await tx.getRepository(Rack).save({
17
- ...rack,
18
- domain,
19
- creator: user,
20
- updater: user
21
- })
22
- }
23
-
24
- @Directive('@transaction')
25
- @Mutation(returns => Rack, { description: 'To modify Rack information' })
26
- async updateRack(
27
- @Arg('id') id: string,
28
- @Arg('patch') patch: RackPatch,
29
- @Ctx() context: ResolverContext
30
- ): Promise<Rack> {
31
- const { domain, user, tx } = context.state
32
-
33
- const repository = tx.getRepository(Rack)
34
- const rack = await repository.findOne({
35
- where: { domain: { id: domain.id }, id }
36
- })
37
-
38
- return await repository.save({
39
- ...rack,
40
- ...patch,
41
- updater: user
42
- })
43
- }
44
-
45
- @Directive('@transaction')
46
- @Mutation(returns => [Rack], { description: "To modify multiple Racks' information" })
47
- async updateMultipleRack(
48
- @Arg('patches', type => [RackPatch]) patches: RackPatch[],
49
- @Ctx() context: ResolverContext
50
- ): Promise<Rack[]> {
51
- const { domain, user, tx } = context.state
52
-
53
- let results = []
54
- const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
55
- const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
56
- const rackRepo = tx.getRepository(Rack)
57
-
58
- if (_createRecords.length > 0) {
59
- for (let i = 0; i < _createRecords.length; i++) {
60
- const newRecord = _createRecords[i]
61
-
62
- const result = await rackRepo.save({
63
- ...newRecord,
64
- domain,
65
- creator: user,
66
- updater: user
67
- })
68
-
69
- results.push({ ...result, cuFlag: '+' })
70
- }
71
- }
72
-
73
- if (_updateRecords.length > 0) {
74
- for (let i = 0; i < _updateRecords.length; i++) {
75
- const updateRecord = _updateRecords[i]
76
- const rack = await rackRepo.findOneBy({ id: updateRecord.id })
77
-
78
- const result = await rackRepo.save({
79
- ...rack,
80
- ...updateRecord,
81
- updater: user
82
- })
83
-
84
- results.push({ ...result, cuFlag: 'M' })
85
- }
86
- }
87
-
88
- return results
89
- }
90
-
91
- @Directive('@transaction')
92
- @Mutation(returns => Boolean, { description: 'To delete Rack' })
93
- async deleteRack(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
94
- const { domain, tx } = context.state
95
-
96
- await tx.getRepository(Rack).delete({ domain: { id: domain.id }, id })
97
- await deleteAttachmentsByRef(null, { refBys: [id] }, context)
98
-
99
- return true
100
- }
101
-
102
- @Directive('@transaction')
103
- @Mutation(returns => Boolean, { description: 'To delete multiple Racks' })
104
- async deleteRacks(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {
105
- const { domain, tx } = context.state
106
-
107
- await tx.getRepository(Rack).delete({
108
- domain: { id: domain.id },
109
- id: In(ids)
110
- })
111
-
112
- await deleteAttachmentsByRef(null, { refBys: ids }, context)
113
-
114
- return true
115
- }
116
-
117
- @Directive('@transaction')
118
- @Mutation(returns => Boolean, { description: 'To import multiple Racks' })
119
- async importRacks(
120
- @Arg('racks', type => [RackPatch]) racks: RackPatch[],
121
- @Ctx() context: ResolverContext
122
- ): Promise<boolean> {
123
- const { domain, tx } = context.state
124
-
125
- await Promise.all(
126
- racks.map(async (rack: RackPatch) => {
127
- const createdRack: Rack = await tx.getRepository(Rack).save({ domain, ...rack })
128
- })
129
- )
130
-
131
- return true
132
- }
133
- }
@@ -1,64 +0,0 @@
1
- import { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'
2
-
3
- import { Attachment } from '@things-factory/attachment-base'
4
- import { User } from '@things-factory/auth-base'
5
- import { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
6
-
7
- import { Rack } from './rack'
8
- import { RackList } from './rack-type'
9
-
10
- @Resolver(Rack)
11
- export class RackQuery {
12
- @Query(returns => Rack!, { nullable: true, description: 'To fetch a Rack' })
13
- async rack(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Rack> {
14
- const { domain } = context.state
15
-
16
- return await getRepository(Rack).findOne({
17
- where: { domain: { id: domain.id }, id }
18
- })
19
- }
20
-
21
- @Query(returns => RackList, { description: 'To fetch multiple Racks' })
22
- async racks(@Args(type => ListParam) params: ListParam, @Ctx() context: ResolverContext): Promise<RackList> {
23
- const { domain } = context.state
24
-
25
- const queryBuilder = getQueryBuilderFromListParams({
26
- domain,
27
- params,
28
- repository: await getRepository(Rack),
29
- searchables: ['name', 'description']
30
- })
31
-
32
- const [items, total] = await queryBuilder.getManyAndCount()
33
-
34
- return { items, total }
35
- }
36
-
37
- @FieldResolver(type => String)
38
- async thumbnail(@Root() rack: Rack): Promise<string | undefined> {
39
- const attachment: Attachment = await getRepository(Attachment).findOne({
40
- where: {
41
- domain: { id: rack.domainId },
42
- refType: Rack.name,
43
- refBy: rack.id
44
- }
45
- })
46
-
47
- return attachment?.fullpath
48
- }
49
-
50
- @FieldResolver(type => Domain)
51
- async domain(@Root() rack: Rack): Promise<Domain> {
52
- return await getRepository(Domain).findOneBy({ id: rack.domainId })
53
- }
54
-
55
- @FieldResolver(type => User)
56
- async updater(@Root() rack: Rack): Promise<User> {
57
- return await getRepository(User).findOneBy({ id: rack.updaterId })
58
- }
59
-
60
- @FieldResolver(type => User)
61
- async creator(@Root() rack: Rack): Promise<User> {
62
- return await getRepository(User).findOneBy({ id: rack.creatorId })
63
- }
64
- }
@@ -1,54 +0,0 @@
1
- import { Field, ID, InputType, Int, ObjectType } from 'type-graphql'
2
-
3
- import { Rack } from './rack'
4
-
5
- @InputType()
6
- export class NewRack {
7
- @Field()
8
- rackCd: string
9
-
10
- @Field()
11
- rackNm: string
12
-
13
- @Field({ nullable: true })
14
- jobGroupCd?: string
15
-
16
- @Field({ nullable: true })
17
- status?: string
18
-
19
- @Field({ nullable: true })
20
- activeFlag?: boolean
21
- }
22
-
23
- @InputType()
24
- export class RackPatch {
25
- @Field(type => ID, { nullable: true })
26
- id?: string
27
-
28
- @Field({ nullable: true })
29
- rackCd?: string
30
-
31
- @Field({ nullable: true })
32
- rackNm?: string
33
-
34
- @Field({ nullable: true })
35
- jobGroupCd?: string
36
-
37
- @Field({ nullable: true })
38
- status?: string
39
-
40
- @Field({ nullable: true })
41
- activeFlag?: boolean
42
-
43
- @Field({ nullable: true })
44
- cuFlag?: string
45
- }
46
-
47
- @ObjectType()
48
- export class RackList {
49
- @Field(type => [Rack])
50
- items: Rack[]
51
-
52
- @Field(type => Int)
53
- total: number
54
- }
@@ -1,76 +0,0 @@
1
- import { Field, ID, ObjectType } from 'type-graphql'
2
- import {
3
- Column,
4
- CreateDateColumn,
5
- Entity,
6
- Index,
7
- ManyToOne,
8
- PrimaryGeneratedColumn,
9
- RelationId,
10
- UpdateDateColumn
11
- } from 'typeorm'
12
-
13
- import { User } from '@things-factory/auth-base'
14
- import { Domain } from '@things-factory/shell'
15
-
16
- @Entity()
17
- @Index('ix_rack_0', (rack: Rack) => [rack.domain, rack.rackCd], { unique: true })
18
- @ObjectType({ description: 'Entity for Rack' })
19
- export class Rack {
20
- @PrimaryGeneratedColumn('uuid')
21
- @Field(type => ID)
22
- readonly id: string
23
-
24
- @ManyToOne(type => Domain)
25
- @Field(type => Domain)
26
- domain?: Domain
27
-
28
- @RelationId((rack: Rack) => rack.domain)
29
- domainId?: string
30
-
31
- @Column({ length: 30 })
32
- @Field()
33
- rackCd: string
34
-
35
- @Column({ length: 100 })
36
- @Field()
37
- rackNm: string
38
-
39
- @Column({ nullable: true, length: 30 })
40
- @Field({ nullable: true })
41
- jobGroupCd?: string
42
-
43
- @Column({ nullable: true, length: 10 })
44
- @Field({ nullable: true })
45
- status?: string
46
-
47
- @Column({ nullable: true })
48
- @Field({ nullable: true })
49
- activeFlag?: boolean
50
-
51
- @CreateDateColumn()
52
- @Field({ nullable: true })
53
- createdAt?: Date
54
-
55
- @UpdateDateColumn()
56
- @Field({ nullable: true })
57
- updatedAt?: Date
58
-
59
- @ManyToOne(type => User, {
60
- nullable: true
61
- })
62
- @Field(type => User, { nullable: true })
63
- creator?: User
64
-
65
- @RelationId((rack: Rack) => rack.creator)
66
- creatorId?: string
67
-
68
- @ManyToOne(type => User, {
69
- nullable: true
70
- })
71
- @Field(type => User, { nullable: true })
72
- updater?: User
73
-
74
- @RelationId((rack: Rack) => rack.updater)
75
- updaterId?: string
76
- }
File without changes