@things-factory/tax-invoice 6.2.84

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 (151) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/assets/images/hatiolab-logo.png +0 -0
  3. package/client/bootstrap.ts +0 -0
  4. package/client/index.ts +0 -0
  5. package/client/pages/main.ts +25 -0
  6. package/client/pages/tax-audit-result/tax-audit-result-importer.ts +97 -0
  7. package/client/pages/tax-audit-result/tax-audit-result-list-page.ts +355 -0
  8. package/client/pages/tax-invoice/tax-invoice-detail-popup.ts +424 -0
  9. package/client/pages/tax-invoice/tax-invoice-list-page.ts +517 -0
  10. package/client/pages/tax-invoice-api/tax-invoice-api-page.ts +428 -0
  11. package/client/pages/tax-invoice-company/tax-invoice-company-importer.ts +175 -0
  12. package/client/pages/tax-invoice-company/tax-invoice-company-list-page.ts +496 -0
  13. package/client/route.ts +23 -0
  14. package/client/tsconfig.json +11 -0
  15. package/dist-client/bootstrap.d.ts +0 -0
  16. package/dist-client/bootstrap.js +2 -0
  17. package/dist-client/bootstrap.js.map +1 -0
  18. package/dist-client/index.d.ts +0 -0
  19. package/dist-client/index.js +2 -0
  20. package/dist-client/index.js.map +1 -0
  21. package/dist-client/pages/main.d.ts +1 -0
  22. package/dist-client/pages/main.js +27 -0
  23. package/dist-client/pages/main.js.map +1 -0
  24. package/dist-client/pages/tax-audit-result/tax-audit-result-importer.d.ts +22 -0
  25. package/dist-client/pages/tax-audit-result/tax-audit-result-importer.js +100 -0
  26. package/dist-client/pages/tax-audit-result/tax-audit-result-importer.js.map +1 -0
  27. package/dist-client/pages/tax-audit-result/tax-audit-result-list-page.d.ts +62 -0
  28. package/dist-client/pages/tax-audit-result/tax-audit-result-list-page.js +331 -0
  29. package/dist-client/pages/tax-audit-result/tax-audit-result-list-page.js.map +1 -0
  30. package/dist-client/pages/tax-invoice/tax-invoice-detail-popup.d.ts +14 -0
  31. package/dist-client/pages/tax-invoice/tax-invoice-detail-popup.js +430 -0
  32. package/dist-client/pages/tax-invoice/tax-invoice-detail-popup.js.map +1 -0
  33. package/dist-client/pages/tax-invoice/tax-invoice-list-page.d.ts +70 -0
  34. package/dist-client/pages/tax-invoice/tax-invoice-list-page.js +500 -0
  35. package/dist-client/pages/tax-invoice/tax-invoice-list-page.js.map +1 -0
  36. package/dist-client/pages/tax-invoice-api/tax-invoice-api-page.d.ts +36 -0
  37. package/dist-client/pages/tax-invoice-api/tax-invoice-api-page.js +419 -0
  38. package/dist-client/pages/tax-invoice-api/tax-invoice-api-page.js.map +1 -0
  39. package/dist-client/pages/tax-invoice-company/tax-invoice-company-importer.d.ts +31 -0
  40. package/dist-client/pages/tax-invoice-company/tax-invoice-company-importer.js +182 -0
  41. package/dist-client/pages/tax-invoice-company/tax-invoice-company-importer.js.map +1 -0
  42. package/dist-client/pages/tax-invoice-company/tax-invoice-company-list-page.d.ts +57 -0
  43. package/dist-client/pages/tax-invoice-company/tax-invoice-company-list-page.js +477 -0
  44. package/dist-client/pages/tax-invoice-company/tax-invoice-company-list-page.js.map +1 -0
  45. package/dist-client/route.d.ts +1 -0
  46. package/dist-client/route.js +20 -0
  47. package/dist-client/route.js.map +1 -0
  48. package/dist-client/tsconfig.tsbuildinfo +1 -0
  49. package/dist-server/index.js +6 -0
  50. package/dist-server/index.js.map +1 -0
  51. package/dist-server/routes.js +25 -0
  52. package/dist-server/routes.js.map +1 -0
  53. package/dist-server/service/index.js +37 -0
  54. package/dist-server/service/index.js.map +1 -0
  55. package/dist-server/service/tax-audit-result/event-subscriber.js +21 -0
  56. package/dist-server/service/tax-audit-result/event-subscriber.js.map +1 -0
  57. package/dist-server/service/tax-audit-result/index.js +12 -0
  58. package/dist-server/service/tax-audit-result/index.js.map +1 -0
  59. package/dist-server/service/tax-audit-result/tax-audit-result-history.js +123 -0
  60. package/dist-server/service/tax-audit-result/tax-audit-result-history.js.map +1 -0
  61. package/dist-server/service/tax-audit-result/tax-audit-result-mutation.js +168 -0
  62. package/dist-server/service/tax-audit-result/tax-audit-result-mutation.js.map +1 -0
  63. package/dist-server/service/tax-audit-result/tax-audit-result-query.js +97 -0
  64. package/dist-server/service/tax-audit-result/tax-audit-result-query.js.map +1 -0
  65. package/dist-server/service/tax-audit-result/tax-audit-result-type.js +86 -0
  66. package/dist-server/service/tax-audit-result/tax-audit-result-type.js.map +1 -0
  67. package/dist-server/service/tax-audit-result/tax-audit-result.js +110 -0
  68. package/dist-server/service/tax-audit-result/tax-audit-result.js.map +1 -0
  69. package/dist-server/service/tax-invoice/index.js +9 -0
  70. package/dist-server/service/tax-invoice/index.js.map +1 -0
  71. package/dist-server/service/tax-invoice/tax-invoice-mutation.js +127 -0
  72. package/dist-server/service/tax-invoice/tax-invoice-mutation.js.map +1 -0
  73. package/dist-server/service/tax-invoice/tax-invoice-query.js +90 -0
  74. package/dist-server/service/tax-invoice/tax-invoice-query.js.map +1 -0
  75. package/dist-server/service/tax-invoice/tax-invoice-type.js +553 -0
  76. package/dist-server/service/tax-invoice/tax-invoice-type.js.map +1 -0
  77. package/dist-server/service/tax-invoice/tax-invoice.js +465 -0
  78. package/dist-server/service/tax-invoice/tax-invoice.js.map +1 -0
  79. package/dist-server/service/tax-invoice-api/index.js +9 -0
  80. package/dist-server/service/tax-invoice-api/index.js.map +1 -0
  81. package/dist-server/service/tax-invoice-api/tax-invoice-api-mutation.js +64 -0
  82. package/dist-server/service/tax-invoice-api/tax-invoice-api-mutation.js.map +1 -0
  83. package/dist-server/service/tax-invoice-api/tax-invoice-api-query.js +79 -0
  84. package/dist-server/service/tax-invoice-api/tax-invoice-api-query.js.map +1 -0
  85. package/dist-server/service/tax-invoice-api/tax-invoice-api-type.js +103 -0
  86. package/dist-server/service/tax-invoice-api/tax-invoice-api-type.js.map +1 -0
  87. package/dist-server/service/tax-invoice-api/tax-invoice-api.js +163 -0
  88. package/dist-server/service/tax-invoice-api/tax-invoice-api.js.map +1 -0
  89. package/dist-server/service/tax-invoice-company/index.js +9 -0
  90. package/dist-server/service/tax-invoice-company/index.js.map +1 -0
  91. package/dist-server/service/tax-invoice-company/tax-invoice-company-mutation.js +80 -0
  92. package/dist-server/service/tax-invoice-company/tax-invoice-company-mutation.js.map +1 -0
  93. package/dist-server/service/tax-invoice-company/tax-invoice-company-query.js +89 -0
  94. package/dist-server/service/tax-invoice-company/tax-invoice-company-query.js.map +1 -0
  95. package/dist-server/service/tax-invoice-company/tax-invoice-company-type.js +100 -0
  96. package/dist-server/service/tax-invoice-company/tax-invoice-company-type.js.map +1 -0
  97. package/dist-server/service/tax-invoice-company/tax-invoice-company.js +166 -0
  98. package/dist-server/service/tax-invoice-company/tax-invoice-company.js.map +1 -0
  99. package/dist-server/service/tax-invoice-item/index.js +9 -0
  100. package/dist-server/service/tax-invoice-item/index.js.map +1 -0
  101. package/dist-server/service/tax-invoice-item/tax-invoice-item-mutation.js +127 -0
  102. package/dist-server/service/tax-invoice-item/tax-invoice-item-mutation.js.map +1 -0
  103. package/dist-server/service/tax-invoice-item/tax-invoice-item-query.js +87 -0
  104. package/dist-server/service/tax-invoice-item/tax-invoice-item-query.js.map +1 -0
  105. package/dist-server/service/tax-invoice-item/tax-invoice-item-type.js +121 -0
  106. package/dist-server/service/tax-invoice-item/tax-invoice-item-type.js.map +1 -0
  107. package/dist-server/service/tax-invoice-item/tax-invoice-item.js +115 -0
  108. package/dist-server/service/tax-invoice-item/tax-invoice-item.js.map +1 -0
  109. package/dist-server/tsconfig.tsbuildinfo +1 -0
  110. package/helps/tax-invoice/tax-audit-result.md +160 -0
  111. package/helps/tax-invoice/tax-invoice-api.md +160 -0
  112. package/helps/tax-invoice/tax-invoice-send.md +160 -0
  113. package/helps/tax-invoice/tax-invoice.md +160 -0
  114. package/package.json +37 -0
  115. package/server/index.ts +2 -0
  116. package/server/routes.ts +28 -0
  117. package/server/service/index.ts +36 -0
  118. package/server/service/tax-audit-result/event-subscriber.ts +17 -0
  119. package/server/service/tax-audit-result/index.ts +9 -0
  120. package/server/service/tax-audit-result/tax-audit-result-history.ts +110 -0
  121. package/server/service/tax-audit-result/tax-audit-result-mutation.ts +198 -0
  122. package/server/service/tax-audit-result/tax-audit-result-query.ts +62 -0
  123. package/server/service/tax-audit-result/tax-audit-result-type.ts +61 -0
  124. package/server/service/tax-audit-result/tax-audit-result.ts +95 -0
  125. package/server/service/tax-invoice/index.ts +6 -0
  126. package/server/service/tax-invoice/tax-invoice-mutation.ts +122 -0
  127. package/server/service/tax-invoice/tax-invoice-query.ts +54 -0
  128. package/server/service/tax-invoice/tax-invoice-type.ts +411 -0
  129. package/server/service/tax-invoice/tax-invoice.ts +389 -0
  130. package/server/service/tax-invoice-api/index.ts +6 -0
  131. package/server/service/tax-invoice-api/tax-invoice-api-mutation.ts +67 -0
  132. package/server/service/tax-invoice-api/tax-invoice-api-query.ts +48 -0
  133. package/server/service/tax-invoice-api/tax-invoice-api-type.ts +71 -0
  134. package/server/service/tax-invoice-api/tax-invoice-api.ts +137 -0
  135. package/server/service/tax-invoice-company/index.ts +6 -0
  136. package/server/service/tax-invoice-company/tax-invoice-company-mutation.ts +84 -0
  137. package/server/service/tax-invoice-company/tax-invoice-company-query.ts +53 -0
  138. package/server/service/tax-invoice-company/tax-invoice-company-type.ts +69 -0
  139. package/server/service/tax-invoice-company/tax-invoice-company.ts +142 -0
  140. package/server/service/tax-invoice-item/index.ts +6 -0
  141. package/server/service/tax-invoice-item/tax-invoice-item-mutation.ts +128 -0
  142. package/server/service/tax-invoice-item/tax-invoice-item-query.ts +57 -0
  143. package/server/service/tax-invoice-item/tax-invoice-item-type.ts +86 -0
  144. package/server/service/tax-invoice-item/tax-invoice-item.ts +85 -0
  145. package/server/tsconfig.json +10 -0
  146. package/things-factory.config.js +23 -0
  147. package/translations/en.json +1 -0
  148. package/translations/ja.json +1 -0
  149. package/translations/ko.json +71 -0
  150. package/translations/ms.json +1 -0
  151. package/translations/zh.json +1 -0
@@ -0,0 +1,36 @@
1
+ /* EXPORT ENTITY TYPES */
2
+ export * from './tax-audit-result/tax-audit-result'
3
+ export * from './tax-invoice-item/tax-invoice-item'
4
+ export * from './tax-invoice/tax-invoice'
5
+
6
+ /* IMPORT ENTITIES AND RESOLVERS */
7
+ import { entities as TaxAuditResultEntities, resolvers as TaxAuditResultResolvers, subscribers as TaxAuditResultSubscribers } from './tax-audit-result'
8
+ import { entities as TaxInvoiceEntities, resolvers as TaxInvoiceResolvers } from './tax-invoice'
9
+ import { entities as TaxInvoiceItemEntities, resolvers as TaxInvoiceItemResolvers } from './tax-invoice-item'
10
+ import { entities as TaxInvoiceCompanyEntities, resolvers as TaxInvoiceCompanyResolvers } from './tax-invoice-company'
11
+ import { entities as TaxInvoiceApiEntities, resolvers as TaxInvoiceApiResolvers } from './tax-invoice-api'
12
+
13
+ export const entities = [
14
+ /* ENTITIES */
15
+ ...TaxAuditResultEntities,
16
+ ...TaxInvoiceEntities,
17
+ ...TaxInvoiceItemEntities,
18
+ ...TaxInvoiceCompanyEntities,
19
+ ...TaxInvoiceApiEntities
20
+ ]
21
+
22
+ export const subscribers = [
23
+ /* SUBSCRIBERS */
24
+ ...TaxAuditResultSubscribers
25
+ ]
26
+
27
+ export const schema = {
28
+ resolverClasses: [
29
+ /* RESOLVER CLASSES */
30
+ ...TaxAuditResultResolvers,
31
+ ...TaxInvoiceResolvers,
32
+ ...TaxInvoiceItemResolvers,
33
+ ...TaxInvoiceCompanyResolvers,
34
+ ...TaxInvoiceApiResolvers
35
+ ]
36
+ }
@@ -0,0 +1,17 @@
1
+ import { EventSubscriber } from 'typeorm'
2
+
3
+ import { HistoryEntitySubscriber } from '@operato/typeorm-history'
4
+
5
+ import { TaxAuditResult } from './tax-audit-result'
6
+ import { TaxAuditResultHistory } from './tax-audit-result-history'
7
+
8
+ @EventSubscriber()
9
+ export class TaxAuditResultHistoryEntitySubscriber extends HistoryEntitySubscriber<TaxAuditResult, TaxAuditResultHistory> {
10
+ public get entity() {
11
+ return TaxAuditResult
12
+ }
13
+
14
+ public get historyEntity() {
15
+ return TaxAuditResultHistory
16
+ }
17
+ }
@@ -0,0 +1,9 @@
1
+ import { TaxAuditResult } from './tax-audit-result'
2
+ import { TaxAuditResultHistory } from './tax-audit-result-history'
3
+ import { TaxAuditResultQuery } from './tax-audit-result-query'
4
+ import { TaxAuditResultMutation } from './tax-audit-result-mutation'
5
+ import { TaxAuditResultHistoryEntitySubscriber } from './event-subscriber'
6
+
7
+ export const entities = [TaxAuditResult, TaxAuditResultHistory]
8
+ export const resolvers = [TaxAuditResultQuery, TaxAuditResultMutation]
9
+ export const subscribers = [TaxAuditResultHistoryEntitySubscriber]
@@ -0,0 +1,110 @@
1
+ import { Field, ID, ObjectType } from 'type-graphql'
2
+ import { Column, Entity, Index, ManyToOne, PrimaryGeneratedColumn, RelationId } from 'typeorm'
3
+
4
+ import {
5
+ HistoryActionColumn,
6
+ HistoryActionType,
7
+ HistoryEntityInterface,
8
+ HistoryOriginalIdColumn
9
+ } from '@operato/typeorm-history'
10
+ import { Role, User } from '@things-factory/auth-base'
11
+ import { config } from '@things-factory/env'
12
+ import { Domain } from '@things-factory/shell'
13
+
14
+ import { TaxAuditResult, TaxAuditResultStatus } from './tax-audit-result'
15
+
16
+ const ORMCONFIG = config.get('ormconfig', {})
17
+ const DATABASE_TYPE = ORMCONFIG.type
18
+
19
+ @Entity()
20
+ @Index(
21
+ 'ix_tax-audit-result_history_0',
22
+ (taxAuditResultHistory: TaxAuditResultHistory) => [taxAuditResultHistory.originalId, taxAuditResultHistory.version],
23
+ { unique: true }
24
+ )
25
+ @Index(
26
+ 'ix_tax-audit-result_history_1',
27
+ (taxAuditResultHistory: TaxAuditResultHistory) => [taxAuditResultHistory.domain, taxAuditResultHistory.originalId, taxAuditResultHistory.version],
28
+ { unique: true }
29
+ )
30
+ @ObjectType({ description: 'History Entity of TaxAuditResult' })
31
+ export class TaxAuditResultHistory implements HistoryEntityInterface<TaxAuditResult> {
32
+ @PrimaryGeneratedColumn('uuid')
33
+ @Field(type => ID)
34
+ readonly id: string
35
+
36
+ @Column({ nullable: true, default: 1 })
37
+ @Field({ nullable: true })
38
+ version?: number = 1
39
+
40
+ @ManyToOne(type => Domain)
41
+ @Field({ nullable: true })
42
+ domain?: Domain
43
+
44
+ @RelationId((taxAuditResult: TaxAuditResult) => taxAuditResult.domain)
45
+ domainId?: string
46
+
47
+ @Column()
48
+ @Field()
49
+ name: string
50
+
51
+ @Column({ nullable: true })
52
+ @Field({ nullable: true })
53
+ description?: string
54
+
55
+ @Column({ nullable: true })
56
+ @Field({ nullable: true })
57
+ active?: boolean
58
+
59
+ @Column({ nullable: true })
60
+ @Field({ nullable: true })
61
+ state?: TaxAuditResultStatus
62
+
63
+ @Column({ nullable: true })
64
+ @Field({ nullable: true })
65
+ params?: string
66
+
67
+ @Column({ nullable: true })
68
+ @Field({ nullable: true })
69
+ createdAt?: Date
70
+
71
+ @Column({ nullable: true })
72
+ @Field({ nullable: true })
73
+ updatedAt?: Date
74
+
75
+ @Column({ nullable: true })
76
+ @Field({ nullable: true })
77
+ deletedAt?: Date
78
+
79
+ @ManyToOne(type => User, { nullable: true })
80
+ @Field({ nullable: true })
81
+ creator?: User
82
+
83
+ @RelationId((taxAuditResult: TaxAuditResult) => taxAuditResult.creator)
84
+ creatorId?: string
85
+
86
+ @ManyToOne(type => User, { nullable: true })
87
+ @Field({ nullable: true })
88
+ updater?: User
89
+
90
+ @RelationId((taxAuditResult: TaxAuditResult) => taxAuditResult.updater)
91
+ updaterId?: string
92
+
93
+ @Field(type => String, { nullable: true })
94
+ thumbnail?: string
95
+
96
+ @HistoryOriginalIdColumn()
97
+ public originalId!: string
98
+
99
+ @HistoryActionColumn({
100
+ nullable: false,
101
+ type:
102
+ DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
103
+ ? 'enum'
104
+ : DATABASE_TYPE == 'oracle'
105
+ ? 'varchar2'
106
+ : 'smallint',
107
+ enum: HistoryActionType
108
+ })
109
+ public action!: HistoryActionType
110
+ }
@@ -0,0 +1,198 @@
1
+ import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
2
+ import { In } from 'typeorm'
3
+
4
+ import { createAttachment, deleteAttachmentsByRef } from '@things-factory/attachment-base'
5
+
6
+ import { TaxAuditResult } from './tax-audit-result'
7
+ import { NewTaxAuditResult, TaxAuditResultPatch } from './tax-audit-result-type'
8
+
9
+ @Resolver(TaxAuditResult)
10
+ export class TaxAuditResultMutation {
11
+ @Directive('@transaction')
12
+ @Mutation(returns => TaxAuditResult, { description: 'To create new TaxAuditResult' })
13
+ async createTaxAuditResult(@Arg('taxAuditResult') taxAuditResult: NewTaxAuditResult, @Ctx() context: ResolverContext): Promise<TaxAuditResult> {
14
+ const { domain, user, tx } = context.state
15
+
16
+ const result = await tx.getRepository(TaxAuditResult).save({
17
+ ...taxAuditResult,
18
+ domain,
19
+ creator: user,
20
+ updater: user
21
+ })
22
+
23
+ if (taxAuditResult.thumbnail) {
24
+ await createAttachment(
25
+ null,
26
+ {
27
+ attachment: {
28
+ file: taxAuditResult.thumbnail,
29
+ refType: TaxAuditResult.name,
30
+ refBy: result.id
31
+ }
32
+ },
33
+ context
34
+ )
35
+ }
36
+
37
+ return result
38
+ }
39
+
40
+ @Directive('@transaction')
41
+ @Mutation(returns => TaxAuditResult, { description: 'To modify TaxAuditResult information' })
42
+ async updateTaxAuditResult(
43
+ @Arg('id') id: string,
44
+ @Arg('patch') patch: TaxAuditResultPatch,
45
+ @Ctx() context: ResolverContext
46
+ ): Promise<TaxAuditResult> {
47
+ const { domain, user, tx } = context.state
48
+
49
+ const repository = tx.getRepository(TaxAuditResult)
50
+ const taxAuditResult = await repository.findOne({
51
+ where: { domain: { id: domain.id }, id }
52
+ })
53
+
54
+ const result = await repository.save({
55
+ ...taxAuditResult,
56
+ ...patch,
57
+ updater: user
58
+ })
59
+
60
+ if (patch.thumbnail) {
61
+ await deleteAttachmentsByRef(null, { refBys: [result.id] }, context)
62
+ await createAttachment(
63
+ null,
64
+ {
65
+ attachment: {
66
+ file: patch.thumbnail,
67
+ refType: TaxAuditResult.name,
68
+ refBy: result.id
69
+ }
70
+ },
71
+ context
72
+ )
73
+ }
74
+
75
+ return result
76
+ }
77
+
78
+ @Directive('@transaction')
79
+ @Mutation(returns => [TaxAuditResult], { description: "To modify multiple TaxAuditResults' information" })
80
+ async updateMultipleTaxAuditResult(
81
+ @Arg('patches', type => [TaxAuditResultPatch]) patches: TaxAuditResultPatch[],
82
+ @Ctx() context: ResolverContext
83
+ ): Promise<TaxAuditResult[]> {
84
+ const { domain, user, tx } = context.state
85
+
86
+ let results = []
87
+ const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
88
+ const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
89
+ const taxAuditResultRepo = tx.getRepository(TaxAuditResult)
90
+
91
+ if (_createRecords.length > 0) {
92
+ for (let i = 0; i < _createRecords.length; i++) {
93
+ const newRecord = _createRecords[i]
94
+
95
+ const result = await taxAuditResultRepo.save({
96
+ ...newRecord,
97
+ domain,
98
+ creator: user,
99
+ updater: user
100
+ })
101
+
102
+ if (newRecord.thumbnail) {
103
+ await createAttachment(
104
+ null,
105
+ {
106
+ attachment: {
107
+ file: newRecord.thumbnail,
108
+ refType: TaxAuditResult.name,
109
+ refBy: result.id
110
+ }
111
+ },
112
+ context
113
+ )
114
+ }
115
+
116
+ results.push({ ...result, cuFlag: '+' })
117
+ }
118
+ }
119
+
120
+ if (_updateRecords.length > 0) {
121
+ for (let i = 0; i < _updateRecords.length; i++) {
122
+ const updateRecord = _updateRecords[i]
123
+ const taxAuditResult = await taxAuditResultRepo.findOneBy({ id: updateRecord.id })
124
+
125
+ const result = await taxAuditResultRepo.save({
126
+ ...taxAuditResult,
127
+ ...updateRecord,
128
+ updater: user
129
+ })
130
+
131
+ if (updateRecord.thumbnail) {
132
+ await deleteAttachmentsByRef(null, { refBys: [result.id] }, context)
133
+ await createAttachment(
134
+ null,
135
+ {
136
+ attachment: {
137
+ file: updateRecord.thumbnail,
138
+ refType: TaxAuditResult.name,
139
+ refBy: result.id
140
+ }
141
+ },
142
+ context
143
+ )
144
+ }
145
+
146
+ results.push({ ...result, cuFlag: 'M' })
147
+ }
148
+ }
149
+
150
+ return results
151
+ }
152
+
153
+ @Directive('@transaction')
154
+ @Mutation(returns => Boolean, { description: 'To delete TaxAuditResult' })
155
+ async deleteTaxAuditResult(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
156
+ const { domain, tx } = context.state
157
+
158
+ await tx.getRepository(TaxAuditResult).delete({ domain: { id: domain.id }, id })
159
+ await deleteAttachmentsByRef(null, { refBys: [id] }, context)
160
+
161
+ return true
162
+ }
163
+
164
+ @Directive('@transaction')
165
+ @Mutation(returns => Boolean, { description: 'To delete multiple TaxAuditResults' })
166
+ async deleteTaxAuditResults(
167
+ @Arg('ids', type => [String]) ids: string[],
168
+ @Ctx() context: ResolverContext
169
+ ): Promise<boolean> {
170
+ const { domain, tx } = context.state
171
+
172
+ await tx.getRepository(TaxAuditResult).delete({
173
+ domain: { id: domain.id },
174
+ id: In(ids)
175
+ })
176
+
177
+ await deleteAttachmentsByRef(null, { refBys: ids }, context)
178
+
179
+ return true
180
+ }
181
+
182
+ @Directive('@transaction')
183
+ @Mutation(returns => Boolean, { description: 'To import multiple TaxAuditResults' })
184
+ async importTaxAuditResults(
185
+ @Arg('taxAuditResults', type => [TaxAuditResultPatch]) taxAuditResults: TaxAuditResultPatch[],
186
+ @Ctx() context: ResolverContext
187
+ ): Promise<boolean> {
188
+ const { domain, tx } = context.state
189
+
190
+ await Promise.all(
191
+ taxAuditResults.map(async (taxAuditResult: TaxAuditResultPatch) => {
192
+ const createdTaxAuditResult: TaxAuditResult = await tx.getRepository(TaxAuditResult).save({ domain, ...taxAuditResult })
193
+ })
194
+ )
195
+
196
+ return true
197
+ }
198
+ }
@@ -0,0 +1,62 @@
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 { TaxAuditResult } from './tax-audit-result'
6
+ import { TaxAuditResultList } from './tax-audit-result-type'
7
+
8
+ @Resolver(TaxAuditResult)
9
+ export class TaxAuditResultQuery {
10
+ @Query(returns => TaxAuditResult!, { nullable: true, description: 'To fetch a TaxAuditResult' })
11
+ async taxAuditResult(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<TaxAuditResult> {
12
+ const { domain } = context.state
13
+
14
+ return await getRepository(TaxAuditResult).findOne({
15
+ where: { domain: { id: domain.id }, id }
16
+ })
17
+ }
18
+
19
+ @Query(returns => TaxAuditResultList, { description: 'To fetch multiple TaxAuditResults' })
20
+ async taxAuditResults(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<TaxAuditResultList> {
21
+ const { domain } = context.state
22
+
23
+ const queryBuilder = getQueryBuilderFromListParams({
24
+ domain,
25
+ params,
26
+ repository: await getRepository(TaxAuditResult),
27
+ searchables: ['name', 'description']
28
+ })
29
+
30
+ const [items, total] = await queryBuilder.getManyAndCount()
31
+
32
+ return { items, total }
33
+ }
34
+
35
+ @FieldResolver(type => String)
36
+ async thumbnail(@Root() taxAuditResult: TaxAuditResult): Promise<string | undefined> {
37
+ const attachment: Attachment = await getRepository(Attachment).findOne({
38
+ where: {
39
+ domain: { id: taxAuditResult.domainId },
40
+ refType: TaxAuditResult.name,
41
+ refBy: taxAuditResult.id
42
+ }
43
+ })
44
+
45
+ return attachment?.fullpath
46
+ }
47
+
48
+ @FieldResolver(type => Domain)
49
+ async domain(@Root() taxAuditResult: TaxAuditResult): Promise<Domain> {
50
+ return taxAuditResult.domainId && (await getRepository(Domain).findOneBy({ id: taxAuditResult.domainId }))
51
+ }
52
+
53
+ @FieldResolver(type => User)
54
+ async updater(@Root() taxAuditResult: TaxAuditResult): Promise<User> {
55
+ return taxAuditResult.updaterId && (await getRepository(User).findOneBy({ id: taxAuditResult.updaterId }))
56
+ }
57
+
58
+ @FieldResolver(type => User)
59
+ async creator(@Root() taxAuditResult: TaxAuditResult): Promise<User> {
60
+ return taxAuditResult.creatorId && (await getRepository(User).findOneBy({ id: taxAuditResult.creatorId }))
61
+ }
62
+ }
@@ -0,0 +1,61 @@
1
+ import type { FileUpload } from 'graphql-upload/GraphQLUpload.js'
2
+ import GraphQLUpload from 'graphql-upload/GraphQLUpload.js'
3
+ import { ObjectType, Field, InputType, Int, ID, registerEnumType } from 'type-graphql'
4
+
5
+ import { ObjectRef, ScalarObject } from '@things-factory/shell'
6
+
7
+ import { TaxAuditResult, TaxAuditResultStatus } from './tax-audit-result'
8
+
9
+ @InputType()
10
+ export class NewTaxAuditResult {
11
+ @Field()
12
+ name: string
13
+
14
+ @Field({ nullable: true })
15
+ description?: string
16
+
17
+ @Field(type => TaxAuditResultStatus, { nullable: true })
18
+ state?: TaxAuditResultStatus
19
+
20
+ @Field({ nullable: true })
21
+ active?: boolean
22
+
23
+ @Field({ nullable: true })
24
+ params?: string
25
+
26
+ @Field(type => GraphQLUpload, { nullable: true })
27
+ thumbnail?: FileUpload
28
+ }
29
+
30
+ @InputType()
31
+ export class TaxAuditResultPatch {
32
+ @Field(type => ID, { nullable: true })
33
+ id?: string
34
+
35
+ @Field({ nullable: true })
36
+ name?: string
37
+
38
+ @Field({ nullable: true })
39
+ description?: string
40
+
41
+ @Field(type => TaxAuditResultStatus, { nullable: true })
42
+ state?: TaxAuditResultStatus
43
+
44
+ @Field({ nullable: true })
45
+ active?: boolean
46
+
47
+ @Field(type => GraphQLUpload, { nullable: true })
48
+ thumbnail?: FileUpload
49
+
50
+ @Field({ nullable: true })
51
+ cuFlag?: string
52
+ }
53
+
54
+ @ObjectType()
55
+ export class TaxAuditResultList {
56
+ @Field(type => [TaxAuditResult])
57
+ items: TaxAuditResult[]
58
+
59
+ @Field(type => Int)
60
+ total: number
61
+ }
@@ -0,0 +1,95 @@
1
+ import {
2
+ CreateDateColumn,
3
+ UpdateDateColumn,
4
+ DeleteDateColumn,
5
+ Entity,
6
+ Index,
7
+ Column,
8
+ RelationId,
9
+ ManyToOne,
10
+ PrimaryGeneratedColumn,
11
+ VersionColumn
12
+ } from 'typeorm'
13
+ import { ObjectType, Field, Int, ID, registerEnumType } from 'type-graphql'
14
+
15
+ import { Domain } from '@things-factory/shell'
16
+ import { User } from '@things-factory/auth-base'
17
+
18
+ export enum TaxAuditResultStatus {
19
+ STATUS_A = 'STATUS_A',
20
+ STATUS_B = 'STATUS_B'
21
+ }
22
+
23
+ registerEnumType(TaxAuditResultStatus, {
24
+ name: 'TaxAuditResultStatus',
25
+ description: 'state enumeration of a taxAuditResult'
26
+ })
27
+
28
+ @Entity()
29
+ @Index('ix_tax_audit_result_0', (taxAuditResult: TaxAuditResult) => [taxAuditResult.domain, taxAuditResult.name, taxAuditResult.deletedAt], { unique: true })
30
+ @ObjectType({ description: 'Entity for TaxAuditResult' })
31
+ export class TaxAuditResult {
32
+ @PrimaryGeneratedColumn('uuid')
33
+ @Field(type => ID)
34
+ readonly id: string
35
+
36
+ @VersionColumn()
37
+ @Field({ nullable: true })
38
+ version?: number = 1
39
+
40
+ @ManyToOne(type => Domain)
41
+ @Field({ nullable: true })
42
+ domain?: Domain
43
+
44
+ @RelationId((taxAuditResult: TaxAuditResult) => taxAuditResult.domain)
45
+ domainId?: string
46
+
47
+ @Column()
48
+ @Field({ nullable: true })
49
+ name?: string
50
+
51
+ @Column({ nullable: true })
52
+ @Field({ nullable: true })
53
+ description?: string
54
+
55
+ @Column({ nullable: true })
56
+ @Field({ nullable: true })
57
+ active?: boolean
58
+
59
+ @Column({ nullable: true })
60
+ @Field({ nullable: true })
61
+ state?: TaxAuditResultStatus
62
+
63
+ @Column({ nullable: true })
64
+ @Field({ nullable: true })
65
+ params?: string
66
+
67
+ @CreateDateColumn()
68
+ @Field({ nullable: true })
69
+ createdAt?: Date
70
+
71
+ @UpdateDateColumn()
72
+ @Field({ nullable: true })
73
+ updatedAt?: Date
74
+
75
+ @DeleteDateColumn()
76
+ @Field({ nullable: true })
77
+ deletedAt?: Date
78
+
79
+ @ManyToOne(type => User, { nullable: true })
80
+ @Field(type => User, { nullable: true })
81
+ creator?: User
82
+
83
+ @RelationId((taxAuditResult: TaxAuditResult) => taxAuditResult.creator)
84
+ creatorId?: string
85
+
86
+ @ManyToOne(type => User, { nullable: true })
87
+ @Field(type => User, { nullable: true })
88
+ updater?: User
89
+
90
+ @RelationId((taxAuditResult: TaxAuditResult) => taxAuditResult.updater)
91
+ updaterId?: string
92
+
93
+ @Field(type => String, { nullable: true })
94
+ thumbnail?: string
95
+ }
@@ -0,0 +1,6 @@
1
+ import { TaxInvoice } from './tax-invoice'
2
+ import { TaxInvoiceQuery } from './tax-invoice-query'
3
+ import { TaxInvoiceMutation } from './tax-invoice-mutation'
4
+
5
+ export const entities = [TaxInvoice]
6
+ export const resolvers = [TaxInvoiceQuery, TaxInvoiceMutation]