@things-factory/accounting 8.0.0-beta.0 → 8.0.0-beta.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. package/package.json +5 -5
  2. package/client/activities/activity-book-edit.ts +0 -88
  3. package/client/activities/activity-book-view.ts +0 -88
  4. package/client/activities/activity-expense-edit.ts +0 -88
  5. package/client/activities/activity-expense-view.ts +0 -88
  6. package/client/bootstrap.ts +0 -10
  7. package/client/components/accounting-category-selector.ts +0 -136
  8. package/client/components/accounting-category-view.ts +0 -75
  9. package/client/grist-editors/grist-editor-accounting-category-object.ts +0 -83
  10. package/client/grist-editors/grist-renderer-accounting-category-object.ts +0 -13
  11. package/client/index.ts +0 -0
  12. package/client/pages/account/account-importer.ts +0 -97
  13. package/client/pages/account/account-list-page.ts +0 -364
  14. package/client/pages/accounting-category/accounting-category-importer.ts +0 -97
  15. package/client/pages/accounting-category/accounting-category-list-page.ts +0 -368
  16. package/client/pages/accounting-category/accounting-category-tree-page.ts +0 -338
  17. package/client/pages/accounting-document/accounting-document-importer.ts +0 -90
  18. package/client/pages/accounting-document/accounting-document-list-page.ts +0 -398
  19. package/client/pages/bank/bank-importer.ts +0 -90
  20. package/client/pages/bank/bank-list-page.ts +0 -398
  21. package/client/pages/bank-account/bank-account-importer.ts +0 -90
  22. package/client/pages/bank-account/bank-account-list-page.ts +0 -398
  23. package/client/pages/financial-institution/financial-institution-importer.ts +0 -90
  24. package/client/pages/financial-institution/financial-institution-list-page.ts +0 -398
  25. package/client/pages/financial-statement/financial-statement-importer.ts +0 -97
  26. package/client/pages/financial-statement/financial-statement-list-page.ts +0 -338
  27. package/client/pages/fiscal-month/fiscal-month-importer.ts +0 -90
  28. package/client/pages/fiscal-month/fiscal-month-list-page.ts +0 -398
  29. package/client/pages/fiscal-quarter/fiscal-quarter-importer.ts +0 -90
  30. package/client/pages/fiscal-quarter/fiscal-quarter-list-page.ts +0 -398
  31. package/client/pages/fiscal-year/fiscal-year-importer.ts +0 -90
  32. package/client/pages/fiscal-year/fiscal-year-list-page.ts +0 -398
  33. package/client/pages/income-statement/income-statement-importer.ts +0 -97
  34. package/client/pages/income-statement/income-statement-list-page.ts +0 -338
  35. package/client/pages/payment/payment-importer.ts +0 -90
  36. package/client/pages/payment/payment-list-page.ts +0 -398
  37. package/client/pages/transaction/transaction-importer.ts +0 -97
  38. package/client/pages/transaction/transaction-list-page.ts +0 -338
  39. package/client/route.ts +0 -35
  40. package/client/tsconfig.json +0 -13
  41. package/client/types/accounting-category.ts +0 -23
  42. package/client/types/index.ts +0 -1
  43. package/server/activities/activity-book.ts +0 -172
  44. package/server/activities/activity-expense.ts +0 -149
  45. package/server/activities/index.ts +0 -18
  46. package/server/controllers/index.ts +0 -1
  47. package/server/controllers/summary-statements.ts +0 -166
  48. package/server/index.ts +0 -6
  49. package/server/middlewares/index.ts +0 -3
  50. package/server/migrations/1725200507196-seed-fiscal-entities.ts +0 -106
  51. package/server/migrations/1725201467183-seed-accounts.ts +0 -339
  52. package/server/migrations/1725201567284-seed-country-codes.ts +0 -261
  53. package/server/migrations/1725201667385-seed-financial-institutions.ts +0 -348
  54. package/server/migrations/index.ts +0 -9
  55. package/server/routes.ts +0 -26
  56. package/server/service/account/account-history.ts +0 -117
  57. package/server/service/account/account-mutation.ts +0 -140
  58. package/server/service/account/account-query.ts +0 -51
  59. package/server/service/account/account-type.ts +0 -44
  60. package/server/service/account/account.ts +0 -97
  61. package/server/service/account/event-subscriber.ts +0 -17
  62. package/server/service/account/index.ts +0 -9
  63. package/server/service/accounting-category/accounting-category-history.ts +0 -129
  64. package/server/service/accounting-category/accounting-category-mutation.ts +0 -148
  65. package/server/service/accounting-category/accounting-category-query.ts +0 -74
  66. package/server/service/accounting-category/accounting-category-type.ts +0 -48
  67. package/server/service/accounting-category/accounting-category.ts +0 -100
  68. package/server/service/accounting-category/event-subscriber.ts +0 -20
  69. package/server/service/accounting-category/index.ts +0 -9
  70. package/server/service/accounting-document/accounting-document-history.ts +0 -123
  71. package/server/service/accounting-document/accounting-document-mutation.ts +0 -137
  72. package/server/service/accounting-document/accounting-document-query.ts +0 -48
  73. package/server/service/accounting-document/accounting-document-type.ts +0 -52
  74. package/server/service/accounting-document/accounting-document.ts +0 -93
  75. package/server/service/accounting-document/event-subscriber.ts +0 -17
  76. package/server/service/accounting-document/index.ts +0 -9
  77. package/server/service/bank-account/bank-account-history.ts +0 -149
  78. package/server/service/bank-account/bank-account-mutation.ts +0 -137
  79. package/server/service/bank-account/bank-account-query.ts +0 -48
  80. package/server/service/bank-account/bank-account-type.ts +0 -112
  81. package/server/service/bank-account/bank-account.ts +0 -142
  82. package/server/service/bank-account/event-subscriber.ts +0 -17
  83. package/server/service/bank-account/index.ts +0 -9
  84. package/server/service/common-type.ts +0 -12
  85. package/server/service/financial-institution/financial-institution-mutation.ts +0 -198
  86. package/server/service/financial-institution/financial-institution-query.ts +0 -62
  87. package/server/service/financial-institution/financial-institution-type.ts +0 -91
  88. package/server/service/financial-institution/financial-institution.ts +0 -122
  89. package/server/service/financial-institution/index.ts +0 -7
  90. package/server/service/financial-statement/event-subscriber.ts +0 -17
  91. package/server/service/financial-statement/financial-statement-history.ts +0 -129
  92. package/server/service/financial-statement/financial-statement-line-item.ts +0 -82
  93. package/server/service/financial-statement/financial-statement-mutation.ts +0 -148
  94. package/server/service/financial-statement/financial-statement-query.ts +0 -53
  95. package/server/service/financial-statement/financial-statement-type.ts +0 -51
  96. package/server/service/financial-statement/financial-statement.ts +0 -116
  97. package/server/service/financial-statement/index.ts +0 -10
  98. package/server/service/fiscal-month/fiscal-month-mutation.ts +0 -145
  99. package/server/service/fiscal-month/fiscal-month-query.ts +0 -58
  100. package/server/service/fiscal-month/fiscal-month-type.ts +0 -66
  101. package/server/service/fiscal-month/fiscal-month.ts +0 -84
  102. package/server/service/fiscal-month/index.ts +0 -7
  103. package/server/service/fiscal-quarter/fiscal-quarter-mutation.ts +0 -148
  104. package/server/service/fiscal-quarter/fiscal-quarter-query.ts +0 -60
  105. package/server/service/fiscal-quarter/fiscal-quarter-type.ts +0 -60
  106. package/server/service/fiscal-quarter/fiscal-quarter.ts +0 -80
  107. package/server/service/fiscal-quarter/index.ts +0 -7
  108. package/server/service/fiscal-year/fiscal-year-mutation.ts +0 -145
  109. package/server/service/fiscal-year/fiscal-year-query.ts +0 -53
  110. package/server/service/fiscal-year/fiscal-year-type.ts +0 -54
  111. package/server/service/fiscal-year/fiscal-year.ts +0 -76
  112. package/server/service/fiscal-year/index.ts +0 -7
  113. package/server/service/income-statement/event-subscriber.ts +0 -17
  114. package/server/service/income-statement/income-statement-history.ts +0 -133
  115. package/server/service/income-statement/income-statement-line-item.ts +0 -84
  116. package/server/service/income-statement/income-statement-mutation.ts +0 -147
  117. package/server/service/income-statement/income-statement-query.ts +0 -50
  118. package/server/service/income-statement/income-statement-type.ts +0 -51
  119. package/server/service/income-statement/income-statement.ts +0 -120
  120. package/server/service/income-statement/index.ts +0 -10
  121. package/server/service/index.ts +0 -108
  122. package/server/service/payment/event-subscriber.ts +0 -17
  123. package/server/service/payment/index.ts +0 -9
  124. package/server/service/payment/payment-history.ts +0 -155
  125. package/server/service/payment/payment-mutation.ts +0 -139
  126. package/server/service/payment/payment-query.ts +0 -50
  127. package/server/service/payment/payment-type.ts +0 -82
  128. package/server/service/payment/payment.ts +0 -154
  129. package/server/service/transaction/event-subscriber.ts +0 -17
  130. package/server/service/transaction/index.ts +0 -9
  131. package/server/service/transaction/transaction-history.ts +0 -161
  132. package/server/service/transaction/transaction-mutation.ts +0 -146
  133. package/server/service/transaction/transaction-query.ts +0 -50
  134. package/server/service/transaction/transaction-type.ts +0 -48
  135. package/server/service/transaction/transaction.ts +0 -230
  136. package/server/tsconfig.json +0 -10
@@ -1,53 +0,0 @@
1
- import { Resolver, Query, FieldResolver, Root, Args, Arg, Ctx, Directive } from 'type-graphql'
2
- import { Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
3
- import { User } from '@things-factory/auth-base'
4
- import { FinancialStatement } from './financial-statement'
5
- import { FinancialStatementList } from './financial-statement-type'
6
-
7
- @Resolver(FinancialStatement)
8
- export class FinancialStatementQuery {
9
- @Directive('@privilege(category: "accounting", privilege: "query")')
10
- @Query(returns => FinancialStatement!, { nullable: true, description: 'To fetch a FinancialStatement' })
11
- async financialStatement(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<FinancialStatement> {
12
- const { domain } = context.state
13
-
14
- return await getRepository(FinancialStatement).findOne({
15
- where: { domain: { id: domain.id }, id }
16
- })
17
- }
18
-
19
- @Directive('@privilege(category: "accounting", privilege: "query")')
20
- @Query(returns => FinancialStatementList, { description: 'To fetch multiple FinancialStatements' })
21
- async financialStatements(
22
- @Args() params: ListParam,
23
- @Ctx() context: ResolverContext
24
- ): Promise<FinancialStatementList> {
25
- const { domain } = context.state
26
-
27
- const queryBuilder = getQueryBuilderFromListParams({
28
- domain,
29
- params,
30
- repository: await getRepository(FinancialStatement),
31
- searchables: ['name', 'description']
32
- })
33
-
34
- const [items, total] = await queryBuilder.getManyAndCount()
35
-
36
- return { items, total }
37
- }
38
-
39
- @FieldResolver(type => Domain)
40
- async domain(@Root() financialStatement: FinancialStatement): Promise<Domain> {
41
- return await getRepository(Domain).findOneBy({ id: financialStatement.domainId })
42
- }
43
-
44
- @FieldResolver(type => User)
45
- async updater(@Root() financialStatement: FinancialStatement): Promise<User> {
46
- return await getRepository(User).findOneBy({ id: financialStatement.updaterId })
47
- }
48
-
49
- @FieldResolver(type => User)
50
- async creator(@Root() financialStatement: FinancialStatement): Promise<User> {
51
- return await getRepository(User).findOneBy({ id: financialStatement.creatorId })
52
- }
53
- }
@@ -1,51 +0,0 @@
1
- import { ObjectType, Field, InputType, Int, ID, registerEnumType } from 'type-graphql'
2
-
3
- import { FinancialStatement, FinancialStatementStatus } from './financial-statement'
4
-
5
- @InputType()
6
- export class NewFinancialStatement {
7
- @Field()
8
- name: string
9
-
10
- @Field({ nullable: true })
11
- description?: string
12
-
13
- @Field(type => FinancialStatementStatus, { nullable: true })
14
- state?: FinancialStatementStatus
15
-
16
- @Field({ nullable: true })
17
- active?: boolean
18
-
19
- @Field({ nullable: true })
20
- params?: string
21
- }
22
-
23
- @InputType()
24
- export class FinancialStatementPatch {
25
- @Field(type => ID, { nullable: true })
26
- id?: string
27
-
28
- @Field({ nullable: true })
29
- name?: string
30
-
31
- @Field({ nullable: true })
32
- description?: string
33
-
34
- @Field(type => FinancialStatementStatus, { nullable: true })
35
- state?: FinancialStatementStatus
36
-
37
- @Field({ nullable: true })
38
- active?: boolean
39
-
40
- @Field({ nullable: true })
41
- cuFlag?: string
42
- }
43
-
44
- @ObjectType()
45
- export class FinancialStatementList {
46
- @Field(type => [FinancialStatement])
47
- items: FinancialStatement[]
48
-
49
- @Field(type => Int)
50
- total: number
51
- }
@@ -1,116 +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
- VersionColumn
13
- } from 'typeorm'
14
- import { ObjectType, Field, ID, registerEnumType } from 'type-graphql'
15
-
16
- import { Domain } from '@things-factory/shell'
17
- import { User } from '@things-factory/auth-base'
18
-
19
- import { FinancialStatementLineItem } from './financial-statement-line-item'
20
-
21
- export enum FinancialStatementStatus {
22
- STATUS_A = 'STATUS_A',
23
- STATUS_B = 'STATUS_B'
24
- }
25
-
26
- registerEnumType(FinancialStatementStatus, {
27
- name: 'FinancialStatementStatus',
28
- description: 'State enumeration of a financial statement' // 재무제표 상태 열거형
29
- })
30
-
31
- // 재무제표 (Financial Statement)
32
- @Entity()
33
- @Index(
34
- 'ix_financial_statement_0',
35
- (financialStatement: FinancialStatement) => [
36
- financialStatement.domain,
37
- financialStatement.year,
38
- financialStatement.quarter,
39
- financialStatement.month
40
- ],
41
- {
42
- unique: true,
43
- where: '"deleted_at" IS NULL' // 삭제되지 않은 경우에만 유니크
44
- }
45
- )
46
- @ObjectType({ description: 'Entity for FinancialStatement, representing the financial position of an entity' }) // 엔티티 설명 추가
47
- export class FinancialStatement {
48
- @PrimaryGeneratedColumn('uuid')
49
- @Field(type => ID, { description: 'Unique identifier for the financial statement' })
50
- readonly id: string // 고유 식별자 (UUID)
51
-
52
- @VersionColumn()
53
- @Field({ nullable: true, description: 'Version number for optimistic locking' })
54
- version?: number = 1 // 낙관적 잠금을 위한 버전 관리 필드
55
-
56
- @ManyToOne(type => Domain)
57
- @Field({ nullable: true, description: 'The domain to which this financial statement belongs' })
58
- domain?: Domain // 이 재무제표가 속한 도메인
59
-
60
- @RelationId((financialStatement: FinancialStatement) => financialStatement.domain)
61
- domainId?: string // 도메인의 ID
62
-
63
- @Column({ nullable: true })
64
- @Field({ nullable: true, description: 'Fiscal year of the financial statement' })
65
- year?: number // 회계 연도
66
-
67
- @Column({ nullable: true })
68
- @Field({ nullable: true, description: 'Fiscal quarter of the financial statement' })
69
- quarter?: number // 회계 분기
70
-
71
- @Column({ nullable: true })
72
- @Field({ nullable: true, description: 'Fiscal month of the financial statement' })
73
- month?: number // 회계 월
74
-
75
- @Column({ nullable: true })
76
- @Field({ nullable: true, description: 'Total assets recorded in the financial statement' })
77
- asset?: number // 재무제표에 기록된 총자산
78
-
79
- @Column({ nullable: true })
80
- @Field({ nullable: true, description: 'Total liabilities recorded in the financial statement' })
81
- liability?: number // 재무제표에 기록된 총부채
82
-
83
- @Column({ nullable: true })
84
- @Field({ nullable: true, description: 'Total equity recorded in the financial statement' })
85
- equity?: number // 재무제표에 기록된 총자본
86
-
87
- @OneToMany(type => FinancialStatementLineItem, lineItem => lineItem.statement)
88
- @Field(type => [FinancialStatementLineItem], { nullable: true })
89
- lineItems?: FinancialStatementLineItem[] // 계정별 브레이크다운
90
-
91
- @CreateDateColumn()
92
- @Field({ nullable: true, description: 'The date and time when the financial statement was created' })
93
- createdAt?: Date // 재무제표가 생성된 날짜 및 시간
94
-
95
- @UpdateDateColumn()
96
- @Field({ nullable: true, description: 'The date and time when the financial statement was last updated' })
97
- updatedAt?: Date // 재무제표가 마지막으로 업데이트된 날짜 및 시간
98
-
99
- @DeleteDateColumn()
100
- @Field({ nullable: true, description: 'The date and time when the financial statement was deleted' })
101
- deletedAt?: Date // 재무제표가 삭제된 날짜 및 시간
102
-
103
- @ManyToOne(type => User, { nullable: true })
104
- @Field(type => User, { nullable: true, description: 'The user who created the financial statement' })
105
- creator?: User // 재무제표를 생성한 사용자
106
-
107
- @RelationId((financialStatement: FinancialStatement) => financialStatement.creator)
108
- creatorId?: string // 재무제표를 생성한 사용자의 ID
109
-
110
- @ManyToOne(type => User, { nullable: true })
111
- @Field(type => User, { nullable: true, description: 'The user who last updated the financial statement' })
112
- updater?: User // 재무제표를 마지막으로 업데이트한 사용자
113
-
114
- @RelationId((financialStatement: FinancialStatement) => financialStatement.updater)
115
- updaterId?: string // 재무제표를 업데이트한 사용자의 ID
116
- }
@@ -1,10 +0,0 @@
1
- import { FinancialStatement } from './financial-statement'
2
- import { FinancialStatementLineItem } from './financial-statement-line-item'
3
- import { FinancialStatementHistory } from './financial-statement-history'
4
- import { FinancialStatementQuery } from './financial-statement-query'
5
- import { FinancialStatementMutation } from './financial-statement-mutation'
6
- import { FinancialStatementHistoryEntitySubscriber } from './event-subscriber'
7
-
8
- export const entities = [FinancialStatement, FinancialStatementLineItem, FinancialStatementHistory]
9
- export const resolvers = [FinancialStatementQuery, FinancialStatementMutation]
10
- export const subscribers = [FinancialStatementHistoryEntitySubscriber]
@@ -1,145 +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
-
5
- import { FiscalMonth } from './fiscal-month'
6
- import { NewFiscalMonth, FiscalMonthPatch } from './fiscal-month-type'
7
-
8
- @Resolver(FiscalMonth)
9
- export class FiscalMonthMutation {
10
- @Directive('@transaction')
11
- @Directive('@privilege(category: "accounting", privilege: "mutation")')
12
- @Mutation(returns => FiscalMonth, { description: 'To create new FiscalMonth' })
13
- async createFiscalMonth(
14
- @Arg('fiscalMonth') fiscalMonth: NewFiscalMonth,
15
- @Ctx() context: ResolverContext
16
- ): Promise<FiscalMonth> {
17
- const { domain, user, tx } = context.state
18
-
19
- const result = await getRepository(FiscalMonth, tx).save({
20
- ...fiscalMonth,
21
- domain,
22
- creator: user,
23
- updater: user
24
- })
25
-
26
- return result
27
- }
28
-
29
- @Directive('@transaction')
30
- @Directive('@privilege(category: "accounting", privilege: "mutation")')
31
- @Mutation(returns => FiscalMonth, { description: 'To modify FiscalMonth information' })
32
- async updateFiscalMonth(
33
- @Arg('id') id: string,
34
- @Arg('patch') patch: FiscalMonthPatch,
35
- @Ctx() context: ResolverContext
36
- ): Promise<FiscalMonth> {
37
- const { domain, user, tx } = context.state
38
-
39
- const repository = getRepository(FiscalMonth, tx)
40
- const fiscalMonth = await repository.findOne({
41
- where: { domain: { id: domain.id }, id }
42
- })
43
-
44
- const result = await repository.save({
45
- ...fiscalMonth,
46
- ...patch,
47
- updater: user
48
- })
49
-
50
- return result
51
- }
52
-
53
- @Directive('@transaction')
54
- @Directive('@privilege(category: "accounting", privilege: "mutation")')
55
- @Mutation(returns => [FiscalMonth], { description: "To modify multiple FiscalMonths' information" })
56
- async updateMultipleFiscalMonth(
57
- @Arg('patches', type => [FiscalMonthPatch]) patches: FiscalMonthPatch[],
58
- @Ctx() context: ResolverContext
59
- ): Promise<FiscalMonth[]> {
60
- const { domain, user, tx } = context.state
61
-
62
- let results = []
63
- const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
64
- const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
65
- const fiscalMonthRepo = getRepository(FiscalMonth, tx)
66
-
67
- if (_createRecords.length > 0) {
68
- for (let i = 0; i < _createRecords.length; i++) {
69
- const newRecord = _createRecords[i]
70
-
71
- const result = await fiscalMonthRepo.save({
72
- ...newRecord,
73
- domain,
74
- creator: user,
75
- updater: user
76
- })
77
-
78
- results.push({ ...result, cuFlag: '+' })
79
- }
80
- }
81
-
82
- if (_updateRecords.length > 0) {
83
- for (let i = 0; i < _updateRecords.length; i++) {
84
- const updateRecord = _updateRecords[i]
85
- const fiscalMonth = await fiscalMonthRepo.findOneBy({ id: updateRecord.id })
86
-
87
- const result = await fiscalMonthRepo.save({
88
- ...fiscalMonth,
89
- ...updateRecord,
90
- updater: user
91
- })
92
-
93
- results.push({ ...result, cuFlag: 'M' })
94
- }
95
- }
96
-
97
- return results
98
- }
99
-
100
- @Directive('@transaction')
101
- @Directive('@privilege(category: "accounting", privilege: "mutation")')
102
- @Mutation(returns => Boolean, { description: 'To delete FiscalMonth' })
103
- async deleteFiscalMonth(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
104
- const { domain, tx } = context.state
105
-
106
- await getRepository(FiscalMonth, tx).delete({ domain: { id: domain.id }, id })
107
-
108
- return true
109
- }
110
-
111
- @Directive('@transaction')
112
- @Directive('@privilege(category: "accounting", privilege: "mutation")')
113
- @Mutation(returns => Boolean, { description: 'To delete multiple FiscalMonths' })
114
- async deleteFiscalMonths(
115
- @Arg('ids', type => [String]) ids: string[],
116
- @Ctx() context: ResolverContext
117
- ): Promise<boolean> {
118
- const { domain, tx } = context.state
119
-
120
- await getRepository(FiscalMonth, tx).delete({
121
- domain: { id: domain.id },
122
- id: In(ids)
123
- })
124
-
125
- return true
126
- }
127
-
128
- @Directive('@transaction')
129
- @Directive('@privilege(category: "accounting", privilege: "mutation")')
130
- @Mutation(returns => Boolean, { description: 'To import multiple FiscalMonths' })
131
- async importFiscalMonths(
132
- @Arg('fiscalMonths', type => [FiscalMonthPatch]) fiscalMonths: FiscalMonthPatch[],
133
- @Ctx() context: ResolverContext
134
- ): Promise<boolean> {
135
- const { domain, tx } = context.state
136
-
137
- await Promise.all(
138
- fiscalMonths.map(async (fiscalMonth: FiscalMonthPatch) => {
139
- const createdFiscalMonth: FiscalMonth = await getRepository(FiscalMonth, tx).save({ domain, ...fiscalMonth })
140
- })
141
- )
142
-
143
- return true
144
- }
145
- }
@@ -1,58 +0,0 @@
1
- import { Directive, 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 { FiscalMonth } from './fiscal-month'
5
- import { FiscalMonthList } from './fiscal-month-type'
6
-
7
- @Resolver(FiscalMonth)
8
- export class FiscalMonthQuery {
9
- @Directive('@privilege(category: "accounting", privilege: "query")')
10
- @Query(returns => FiscalMonth!, { nullable: true, description: 'To fetch a FiscalMonth by year, quarter, and month' })
11
- async fiscalMonth(
12
- @Arg('year') year: number,
13
- @Arg('quarter') quarter: number,
14
- @Arg('month') month: number,
15
- @Ctx() context: ResolverContext
16
- ): Promise<FiscalMonth | undefined> {
17
- const { domain } = context.state
18
-
19
- return await getRepository(FiscalMonth).findOne({
20
- where: { domain: { id: domain.id }, year, quarter, month }
21
- })
22
- }
23
-
24
- @Directive('@privilege(category: "accounting", privilege: "query")')
25
- @Query(returns => FiscalMonthList, { description: 'To fetch multiple FiscalMonths' })
26
- async fiscalMonths(
27
- @Args(type => ListParam) params: ListParam,
28
- @Ctx() context: ResolverContext
29
- ): Promise<FiscalMonthList> {
30
- const { domain } = context.state
31
-
32
- const queryBuilder = getQueryBuilderFromListParams({
33
- domain,
34
- params,
35
- repository: await getRepository(FiscalMonth),
36
- searchables: []
37
- })
38
-
39
- const [items, total] = await queryBuilder.getManyAndCount()
40
-
41
- return { items, total }
42
- }
43
-
44
- @FieldResolver(type => Domain)
45
- async domain(@Root() fiscalMonth: FiscalMonth): Promise<Domain> {
46
- return fiscalMonth.domainId && (await getRepository(Domain).findOneBy({ id: fiscalMonth.domainId }))
47
- }
48
-
49
- @FieldResolver(type => User)
50
- async updater(@Root() fiscalMonth: FiscalMonth): Promise<User> {
51
- return fiscalMonth.updaterId && (await getRepository(User).findOneBy({ id: fiscalMonth.updaterId }))
52
- }
53
-
54
- @FieldResolver(type => User)
55
- async creator(@Root() fiscalMonth: FiscalMonth): Promise<User> {
56
- return fiscalMonth.creatorId && (await getRepository(User).findOneBy({ id: fiscalMonth.creatorId }))
57
- }
58
- }
@@ -1,66 +0,0 @@
1
- import { InputType, Field, Int, ID, ObjectType } from 'type-graphql'
2
- import { FiscalStatus } from '../common-type'
3
- import { FiscalMonth } from './fiscal-month'
4
-
5
- @InputType()
6
- export class NewFiscalMonth {
7
- @Field(type => Int)
8
- year: number // 회계연도 (예: 2023)
9
-
10
- @Field(type => Int)
11
- quarter: number // 1, 2, 3, 4 분기
12
-
13
- @Field(type => Int)
14
- month: number // 1 ~ 12월
15
-
16
- @Field(type => String, { description: 'The start date of the fiscal month in YYYY-MM-DD format' })
17
- startDate: string // 월의 시작일
18
-
19
- @Field(type => String, { description: 'The end date of the fiscal month in YYYY-MM-DD format' })
20
- endDate: string // 월의 종료일
21
-
22
- @Field(type => FiscalStatus, { nullable: true })
23
- status?: FiscalStatus // 월의 상태 (OPEN, CLOSED, FINALIZED)
24
-
25
- @Field({ nullable: true })
26
- notes?: string // 월에 대한 설명이나 주석
27
- }
28
-
29
- @InputType()
30
- export class FiscalMonthPatch {
31
- @Field(type => ID, { nullable: true })
32
- id?: string
33
-
34
- @Field(type => Int, { nullable: true })
35
- year?: number // 회계연도 (예: 2023)
36
-
37
- @Field(type => Int, { nullable: true })
38
- quarter?: number // 1, 2, 3, 4 분기
39
-
40
- @Field(type => Int, { nullable: true })
41
- month?: number // 1 ~ 12월
42
-
43
- @Field(type => String, { description: 'The start date of the fiscal month in YYYY-MM-DD format' })
44
- startDate: string // 월의 시작일
45
-
46
- @Field(type => String, { description: 'The end date of the fiscal month in YYYY-MM-DD format' })
47
- endDate: string // 월의 종료일
48
-
49
- @Field(type => FiscalStatus, { nullable: true })
50
- status?: FiscalStatus // 월의 상태 (OPEN, CLOSED, FINALIZED)
51
-
52
- @Field({ nullable: true })
53
- notes?: string // 월에 대한 설명이나 주석
54
-
55
- @Field({ nullable: true })
56
- cuFlag?: string // Create/Update Flag
57
- }
58
-
59
- @ObjectType()
60
- export class FiscalMonthList {
61
- @Field(type => [FiscalMonth])
62
- items: FiscalMonth[]
63
-
64
- @Field(type => Int)
65
- total: number
66
- }
@@ -1,84 +0,0 @@
1
- import {
2
- CreateDateColumn,
3
- DeleteDateColumn,
4
- UpdateDateColumn,
5
- Entity,
6
- Index,
7
- Column,
8
- ManyToOne,
9
- RelationId,
10
- PrimaryGeneratedColumn
11
- } from 'typeorm'
12
- import { ObjectType, Field, Int, ID } from 'type-graphql'
13
- import { Domain } from '@things-factory/shell'
14
- import { User } from '@things-factory/auth-base'
15
- import { FiscalStatus } from '../common-type'
16
-
17
- @ObjectType({ description: 'Entity representing a fiscal month' })
18
- @Entity()
19
- export class FiscalMonth {
20
- @PrimaryGeneratedColumn('uuid')
21
- @Field(type => ID)
22
- readonly id: string
23
-
24
- @ManyToOne(type => Domain)
25
- @Field({ nullable: true })
26
- domain?: Domain
27
-
28
- @RelationId((fiscalMonth: FiscalMonth) => fiscalMonth.domain)
29
- domainId?: string
30
-
31
- @Column()
32
- @Field(type => Int, { description: 'The fiscal year (e.g., 2023)' })
33
- year: number // 회계연도 (예: 2023)
34
-
35
- @Column()
36
- @Field(type => Int, { description: 'The quarter number (1, 2, 3, or 4)' })
37
- quarter: number // 1, 2, 3, 4 분기
38
-
39
- @Column()
40
- @Field(type => Int, { description: 'The month number (1 to 12)' })
41
- month: number // 1 ~ 12월
42
-
43
- @Column()
44
- @Field(type => String, { description: 'The start date of the fiscal month in YYYY-MM-DD format' })
45
- startDate: string // 월의 시작일
46
-
47
- @Column()
48
- @Field(type => String, { description: 'The end date of the fiscal month in YYYY-MM-DD format' })
49
- endDate: string // 월의 종료일
50
-
51
- @Column({ default: FiscalStatus.OPEN })
52
- @Field(type => FiscalStatus, { description: 'The status of the fiscal month (OPEN, CLOSED, FINALIZED)' })
53
- status: FiscalStatus // 월의 상태 (OPEN, CLOSED, FINALIZED)
54
-
55
- @Column({ nullable: true })
56
- @Field({ nullable: true, description: 'Notes or comments about the fiscal month' })
57
- notes?: string // 월에 대한 설명이나 주석
58
-
59
- @CreateDateColumn()
60
- @Field({ nullable: true })
61
- createdAt?: Date
62
-
63
- @UpdateDateColumn()
64
- @Field({ nullable: true })
65
- updatedAt?: Date
66
-
67
- @DeleteDateColumn()
68
- @Field({ nullable: true })
69
- deletedAt?: Date
70
-
71
- @ManyToOne(type => User, { nullable: true })
72
- @Field(type => User, { nullable: true })
73
- creator?: User
74
-
75
- @RelationId((fiscalMonth: FiscalMonth) => fiscalMonth.creator)
76
- creatorId?: string
77
-
78
- @ManyToOne(type => User, { nullable: true })
79
- @Field(type => User, { nullable: true })
80
- updater?: User
81
-
82
- @RelationId((fiscalMonth: FiscalMonth) => fiscalMonth.updater)
83
- updaterId?: string
84
- }
@@ -1,7 +0,0 @@
1
- import { FiscalMonth } from './fiscal-month'
2
- import { FiscalMonthQuery } from './fiscal-month-query'
3
- import { FiscalMonthMutation } from './fiscal-month-mutation'
4
-
5
- export const entities = [FiscalMonth]
6
- export const resolvers = [FiscalMonthQuery, FiscalMonthMutation]
7
- export const subscribers = []