@things-factory/accounting 8.0.6 → 9.0.0-beta.12
Sign up to get free protection for your applications and to get access to all the features.
- package/dist-client/pages/accounting-category/accounting-category-tree-page.js +1 -1
- package/dist-client/pages/accounting-category/accounting-category-tree-page.js.map +1 -1
- package/dist-client/pages/bank/bank-importer.d.ts +23 -0
- package/dist-client/pages/bank/bank-importer.js +93 -0
- package/dist-client/pages/bank/bank-importer.js.map +1 -0
- package/dist-client/pages/bank/bank-list-page.d.ts +66 -0
- package/dist-client/pages/bank/bank-list-page.js +370 -0
- package/dist-client/pages/bank/bank-list-page.js.map +1 -0
- package/dist-client/pages/bank-account/bank-account-importer.d.ts +23 -0
- package/dist-client/pages/bank-account/bank-account-importer.js +93 -0
- package/dist-client/pages/bank-account/bank-account-importer.js.map +1 -0
- package/dist-client/pages/bank-account/bank-account-list-page.d.ts +66 -0
- package/dist-client/pages/bank-account/bank-account-list-page.js +370 -0
- package/dist-client/pages/bank-account/bank-account-list-page.js.map +1 -0
- package/dist-client/pages/financial-institution/financial-institution-importer.d.ts +23 -0
- package/dist-client/pages/financial-institution/financial-institution-importer.js +93 -0
- package/dist-client/pages/financial-institution/financial-institution-importer.js.map +1 -0
- package/dist-client/pages/financial-institution/financial-institution-list-page.d.ts +66 -0
- package/dist-client/pages/financial-institution/financial-institution-list-page.js +370 -0
- package/dist-client/pages/financial-institution/financial-institution-list-page.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/migrations/1725201567284-seed-country-codes.d.ts +5 -0
- package/dist-server/migrations/1725201567284-seed-country-codes.js +248 -0
- package/dist-server/migrations/1725201567284-seed-country-codes.js.map +1 -0
- package/dist-server/migrations/1725201667385-seed-financial-institutions.d.ts +5 -0
- package/dist-server/migrations/1725201667385-seed-financial-institutions.js +348 -0
- package/dist-server/migrations/1725201667385-seed-financial-institutions.js.map +1 -0
- package/dist-server/service/bank-account/bank-account-history.d.ts +34 -0
- package/dist-server/service/bank-account/bank-account-history.js +172 -0
- package/dist-server/service/bank-account/bank-account-history.js.map +1 -0
- package/dist-server/service/bank-account/bank-account-mutation.d.ts +10 -0
- package/dist-server/service/bank-account/bank-account-mutation.js +128 -0
- package/dist-server/service/bank-account/bank-account-mutation.js.map +1 -0
- package/dist-server/service/bank-account/bank-account-query.d.ts +11 -0
- package/dist-server/service/bank-account/bank-account-query.js +79 -0
- package/dist-server/service/bank-account/bank-account-query.js.map +1 -0
- package/dist-server/service/bank-account/bank-account-type.d.ts +39 -0
- package/dist-server/service/bank-account/bank-account-type.js +153 -0
- package/dist-server/service/bank-account/bank-account-type.js.map +1 -0
- package/dist-server/service/bank-account/bank-account.d.ts +38 -0
- package/dist-server/service/bank-account/bank-account.js +164 -0
- package/dist-server/service/bank-account/bank-account.js.map +1 -0
- package/dist-server/service/bank-account/event-subscriber.d.ts +7 -0
- package/dist-server/service/bank-account/event-subscriber.js +21 -0
- package/dist-server/service/bank-account/event-subscriber.js.map +1 -0
- package/dist-server/service/bank-account/index.d.ts +7 -0
- package/dist-server/service/bank-account/index.js +12 -0
- package/dist-server/service/bank-account/index.js.map +1 -0
- package/dist-server/service/financial-institution/financial-institution-mutation.d.ts +10 -0
- package/dist-server/service/financial-institution/financial-institution-mutation.js +169 -0
- package/dist-server/service/financial-institution/financial-institution-mutation.js.map +1 -0
- package/dist-server/service/financial-institution/financial-institution-query.d.ts +12 -0
- package/dist-server/service/financial-institution/financial-institution-query.js +97 -0
- package/dist-server/service/financial-institution/financial-institution-query.js.map +1 -0
- package/dist-server/service/financial-institution/financial-institution-type.d.ts +32 -0
- package/dist-server/service/financial-institution/financial-institution-type.js +126 -0
- package/dist-server/service/financial-institution/financial-institution-type.js.map +1 -0
- package/dist-server/service/financial-institution/financial-institution.d.ts +34 -0
- package/dist-server/service/financial-institution/financial-institution.js +137 -0
- package/dist-server/service/financial-institution/financial-institution.js.map +1 -0
- package/dist-server/service/financial-institution/index.d.ts +6 -0
- package/dist-server/service/financial-institution/index.js +10 -0
- package/dist-server/service/financial-institution/index.js.map +1 -0
- package/dist-server/service/index.d.ts +3 -2
- package/dist-server/service/index.js +5 -0
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/payment/index.d.ts +1 -2
- package/dist-server/service/payment/payment-history.d.ts +8 -1
- package/dist-server/service/payment/payment-history.js +41 -10
- package/dist-server/service/payment/payment-history.js.map +1 -1
- package/dist-server/service/payment/payment-type.d.ts +7 -1
- package/dist-server/service/payment/payment-type.js +24 -0
- package/dist-server/service/payment/payment-type.js.map +1 -1
- package/dist-server/service/payment/payment.d.ts +12 -0
- package/dist-server/service/payment/payment.js +36 -1
- package/dist-server/service/payment/payment.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/helps/accounting/bank-account.md +160 -0
- package/helps/accounting/bank.md +160 -0
- package/helps/accounting/financial-institution.md +160 -0
- package/package.json +7 -7
- package/client/activities/activity-book-edit.ts +0 -88
- package/client/activities/activity-book-view.ts +0 -88
- package/client/activities/activity-expense-edit.ts +0 -88
- package/client/activities/activity-expense-view.ts +0 -88
- package/client/bootstrap.ts +0 -10
- package/client/components/accounting-category-selector.ts +0 -136
- package/client/components/accounting-category-view.ts +0 -75
- package/client/grist-editors/grist-editor-accounting-category-object.ts +0 -83
- package/client/grist-editors/grist-renderer-accounting-category-object.ts +0 -13
- package/client/index.ts +0 -0
- package/client/pages/account/account-importer.ts +0 -97
- package/client/pages/account/account-list-page.ts +0 -364
- package/client/pages/accounting-category/accounting-category-importer.ts +0 -97
- package/client/pages/accounting-category/accounting-category-list-page.ts +0 -368
- package/client/pages/accounting-category/accounting-category-tree-page.ts +0 -338
- package/client/pages/accounting-document/accounting-document-importer.ts +0 -90
- package/client/pages/accounting-document/accounting-document-list-page.ts +0 -398
- package/client/pages/financial-statement/financial-statement-importer.ts +0 -97
- package/client/pages/financial-statement/financial-statement-list-page.ts +0 -338
- package/client/pages/fiscal-month/fiscal-month-importer.ts +0 -90
- package/client/pages/fiscal-month/fiscal-month-list-page.ts +0 -398
- package/client/pages/fiscal-quarter/fiscal-quarter-importer.ts +0 -90
- package/client/pages/fiscal-quarter/fiscal-quarter-list-page.ts +0 -398
- package/client/pages/fiscal-year/fiscal-year-importer.ts +0 -90
- package/client/pages/fiscal-year/fiscal-year-list-page.ts +0 -398
- package/client/pages/income-statement/income-statement-importer.ts +0 -97
- package/client/pages/income-statement/income-statement-list-page.ts +0 -338
- package/client/pages/payment/payment-importer.ts +0 -90
- package/client/pages/payment/payment-list-page.ts +0 -398
- package/client/pages/transaction/transaction-importer.ts +0 -97
- package/client/pages/transaction/transaction-list-page.ts +0 -338
- package/client/route.ts +0 -35
- package/client/tsconfig.json +0 -13
- package/client/types/accounting-category.ts +0 -23
- package/client/types/index.ts +0 -1
- package/server/activities/activity-book.ts +0 -172
- package/server/activities/activity-expense.ts +0 -149
- package/server/activities/index.ts +0 -18
- package/server/controllers/index.ts +0 -1
- package/server/controllers/summary-statements.ts +0 -166
- package/server/index.ts +0 -6
- package/server/middlewares/index.ts +0 -3
- package/server/migrations/1725200507196-seed-fiscal-entities.ts +0 -106
- package/server/migrations/1725201467183-seed-accounts.ts +0 -339
- package/server/migrations/index.ts +0 -9
- package/server/routes.ts +0 -26
- package/server/service/account/account-history.ts +0 -117
- package/server/service/account/account-mutation.ts +0 -140
- package/server/service/account/account-query.ts +0 -51
- package/server/service/account/account-type.ts +0 -44
- package/server/service/account/account.ts +0 -97
- package/server/service/account/event-subscriber.ts +0 -17
- package/server/service/account/index.ts +0 -9
- package/server/service/accounting-category/accounting-category-history.ts +0 -129
- package/server/service/accounting-category/accounting-category-mutation.ts +0 -148
- package/server/service/accounting-category/accounting-category-query.ts +0 -74
- package/server/service/accounting-category/accounting-category-type.ts +0 -48
- package/server/service/accounting-category/accounting-category.ts +0 -100
- package/server/service/accounting-category/event-subscriber.ts +0 -20
- package/server/service/accounting-category/index.ts +0 -9
- package/server/service/accounting-document/accounting-document-history.ts +0 -123
- package/server/service/accounting-document/accounting-document-mutation.ts +0 -137
- package/server/service/accounting-document/accounting-document-query.ts +0 -48
- package/server/service/accounting-document/accounting-document-type.ts +0 -52
- package/server/service/accounting-document/accounting-document.ts +0 -93
- package/server/service/accounting-document/event-subscriber.ts +0 -17
- package/server/service/accounting-document/index.ts +0 -9
- package/server/service/common-type.ts +0 -12
- package/server/service/financial-statement/event-subscriber.ts +0 -17
- package/server/service/financial-statement/financial-statement-history.ts +0 -129
- package/server/service/financial-statement/financial-statement-line-item.ts +0 -82
- package/server/service/financial-statement/financial-statement-mutation.ts +0 -148
- package/server/service/financial-statement/financial-statement-query.ts +0 -53
- package/server/service/financial-statement/financial-statement-type.ts +0 -51
- package/server/service/financial-statement/financial-statement.ts +0 -116
- package/server/service/financial-statement/index.ts +0 -10
- package/server/service/fiscal-month/fiscal-month-mutation.ts +0 -145
- package/server/service/fiscal-month/fiscal-month-query.ts +0 -58
- package/server/service/fiscal-month/fiscal-month-type.ts +0 -66
- package/server/service/fiscal-month/fiscal-month.ts +0 -84
- package/server/service/fiscal-month/index.ts +0 -7
- package/server/service/fiscal-quarter/fiscal-quarter-mutation.ts +0 -148
- package/server/service/fiscal-quarter/fiscal-quarter-query.ts +0 -60
- package/server/service/fiscal-quarter/fiscal-quarter-type.ts +0 -60
- package/server/service/fiscal-quarter/fiscal-quarter.ts +0 -80
- package/server/service/fiscal-quarter/index.ts +0 -7
- package/server/service/fiscal-year/fiscal-year-mutation.ts +0 -145
- package/server/service/fiscal-year/fiscal-year-query.ts +0 -53
- package/server/service/fiscal-year/fiscal-year-type.ts +0 -54
- package/server/service/fiscal-year/fiscal-year.ts +0 -76
- package/server/service/fiscal-year/index.ts +0 -7
- package/server/service/income-statement/event-subscriber.ts +0 -17
- package/server/service/income-statement/income-statement-history.ts +0 -133
- package/server/service/income-statement/income-statement-line-item.ts +0 -84
- package/server/service/income-statement/income-statement-mutation.ts +0 -147
- package/server/service/income-statement/income-statement-query.ts +0 -50
- package/server/service/income-statement/income-statement-type.ts +0 -51
- package/server/service/income-statement/income-statement.ts +0 -120
- package/server/service/income-statement/index.ts +0 -10
- package/server/service/index.ts +0 -108
- package/server/service/payment/event-subscriber.ts +0 -17
- package/server/service/payment/index.ts +0 -9
- package/server/service/payment/payment-history.ts +0 -132
- package/server/service/payment/payment-mutation.ts +0 -139
- package/server/service/payment/payment-query.ts +0 -50
- package/server/service/payment/payment-type.ts +0 -64
- package/server/service/payment/payment.ts +0 -123
- package/server/service/transaction/event-subscriber.ts +0 -17
- package/server/service/transaction/index.ts +0 -9
- package/server/service/transaction/transaction-history.ts +0 -161
- package/server/service/transaction/transaction-mutation.ts +0 -146
- package/server/service/transaction/transaction-query.ts +0 -50
- package/server/service/transaction/transaction-type.ts +0 -48
- package/server/service/transaction/transaction.ts +0 -230
- package/server/tsconfig.json +0 -10
@@ -1,120 +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 { IncomeStatementLineItem } from './income-statement-line-item'
|
20
|
-
|
21
|
-
export enum IncomeStatementStatus {
|
22
|
-
STATUS_A = 'STATUS_A',
|
23
|
-
STATUS_B = 'STATUS_B'
|
24
|
-
}
|
25
|
-
|
26
|
-
registerEnumType(IncomeStatementStatus, {
|
27
|
-
name: 'IncomeStatementStatus',
|
28
|
-
description: 'State enumeration of an income statement' // 손익계산서의 상태 열거형
|
29
|
-
})
|
30
|
-
|
31
|
-
// 손익계산서 (Income Statement)
|
32
|
-
@Entity()
|
33
|
-
@Index(
|
34
|
-
'ix_income_statement_0',
|
35
|
-
(incomeStatement: IncomeStatement) => [
|
36
|
-
incomeStatement.domain,
|
37
|
-
incomeStatement.year,
|
38
|
-
incomeStatement.quarter,
|
39
|
-
incomeStatement.month
|
40
|
-
],
|
41
|
-
{
|
42
|
-
unique: true,
|
43
|
-
where: '"deleted_at" IS NULL' // 삭제되지 않은 경우에만 유니크
|
44
|
-
}
|
45
|
-
)
|
46
|
-
@ObjectType({ description: 'Entity for IncomeStatement, representing the profit and loss report' }) // 손익계산서 엔티티
|
47
|
-
export class IncomeStatement {
|
48
|
-
@PrimaryGeneratedColumn('uuid')
|
49
|
-
@Field(type => ID, { description: 'Unique identifier for the income 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 income statement belongs' })
|
58
|
-
domain?: Domain // 이 손익계산서가 속한 도메인
|
59
|
-
|
60
|
-
@RelationId((incomeStatement: IncomeStatement) => incomeStatement.domain)
|
61
|
-
domainId?: string // 도메인의 ID
|
62
|
-
|
63
|
-
@Column({ nullable: true })
|
64
|
-
@Field({ nullable: true, description: 'Fiscal year of the income statement' })
|
65
|
-
year?: number // 회계 연도
|
66
|
-
|
67
|
-
@Column({ nullable: true })
|
68
|
-
@Field({ nullable: true, description: 'Fiscal quarter of the income statement' })
|
69
|
-
quarter?: number // 회계 분기
|
70
|
-
|
71
|
-
@Column({ nullable: true })
|
72
|
-
@Field({ nullable: true, description: 'Fiscal month of the income statement' })
|
73
|
-
month?: number // 회계 월
|
74
|
-
|
75
|
-
@Column({ nullable: true })
|
76
|
-
@Field({ nullable: true, description: 'Total revenue recorded in the income statement' })
|
77
|
-
revenue?: number // 손익계산서에 기록된 총수익
|
78
|
-
|
79
|
-
@Column({ nullable: true })
|
80
|
-
@Field({ nullable: true, description: 'Total expenses recorded in the income statement' })
|
81
|
-
expense?: number // 손익계산서에 기록된 총비용
|
82
|
-
|
83
|
-
@Column({ nullable: true })
|
84
|
-
@Field({ nullable: true, description: 'Net income calculated as revenue minus expenses' })
|
85
|
-
netIncome?: number // 총수익에서 총비용을 뺀 순이익
|
86
|
-
|
87
|
-
@Column({ nullable: true })
|
88
|
-
@Field({ nullable: true, description: 'Indicates whether this income statement is active' })
|
89
|
-
active?: boolean // 이 손익계산서가 활성 상태인지 여부
|
90
|
-
|
91
|
-
@OneToMany(type => IncomeStatementLineItem, lineItem => lineItem.statement)
|
92
|
-
@Field(type => [IncomeStatementLineItem], { nullable: true })
|
93
|
-
lineItems?: IncomeStatementLineItem[] // 계정별 브레이크다운
|
94
|
-
|
95
|
-
@CreateDateColumn()
|
96
|
-
@Field({ nullable: true, description: 'The date and time when the income statement was created' })
|
97
|
-
createdAt?: Date // 손익계산서가 생성된 날짜 및 시간
|
98
|
-
|
99
|
-
@UpdateDateColumn()
|
100
|
-
@Field({ nullable: true, description: 'The date and time when the income statement was last updated' })
|
101
|
-
updatedAt?: Date // 손익계산서가 마지막으로 업데이트된 날짜 및 시간
|
102
|
-
|
103
|
-
@DeleteDateColumn()
|
104
|
-
@Field({ nullable: true, description: 'The date and time when the income statement was deleted' })
|
105
|
-
deletedAt?: Date // 손익계산서가 삭제된 날짜 및 시간
|
106
|
-
|
107
|
-
@ManyToOne(type => User, { nullable: true })
|
108
|
-
@Field(type => User, { nullable: true, description: 'The user who created the income statement' })
|
109
|
-
creator?: User // 손익계산서를 생성한 사용자
|
110
|
-
|
111
|
-
@RelationId((incomeStatement: IncomeStatement) => incomeStatement.creator)
|
112
|
-
creatorId?: string // 손익계산서를 생성한 사용자의 ID
|
113
|
-
|
114
|
-
@ManyToOne(type => User, { nullable: true })
|
115
|
-
@Field(type => User, { nullable: true, description: 'The user who last updated the income statement' })
|
116
|
-
updater?: User // 손익계산서를 마지막으로 업데이트한 사용자
|
117
|
-
|
118
|
-
@RelationId((incomeStatement: IncomeStatement) => incomeStatement.updater)
|
119
|
-
updaterId?: string // 손익계산서를 업데이트한 사용자의 ID
|
120
|
-
}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import { IncomeStatement } from './income-statement'
|
2
|
-
import { IncomeStatementLineItem } from './income-statement-line-item'
|
3
|
-
import { IncomeStatementHistory } from './income-statement-history'
|
4
|
-
import { IncomeStatementQuery } from './income-statement-query'
|
5
|
-
import { IncomeStatementMutation } from './income-statement-mutation'
|
6
|
-
import { IncomeStatementHistoryEntitySubscriber } from './event-subscriber'
|
7
|
-
|
8
|
-
export const entities = [IncomeStatement, IncomeStatementLineItem, IncomeStatementHistory]
|
9
|
-
export const resolvers = [IncomeStatementQuery, IncomeStatementMutation]
|
10
|
-
export const subscribers = [IncomeStatementHistoryEntitySubscriber]
|
package/server/service/index.ts
DELETED
@@ -1,108 +0,0 @@
|
|
1
|
-
/* EXPORT ENTITY TYPES */
|
2
|
-
export * from './income-statement/income-statement'
|
3
|
-
export * from './financial-statement/financial-statement'
|
4
|
-
export * from './accounting-category/accounting-category'
|
5
|
-
export * from './transaction/transaction'
|
6
|
-
export * from './payment/payment'
|
7
|
-
export * from './account/account'
|
8
|
-
export * from './accounting-document/accounting-document'
|
9
|
-
export * from './fiscal-month/fiscal-month'
|
10
|
-
export * from './fiscal-quarter/fiscal-quarter'
|
11
|
-
export * from './fiscal-year/fiscal-year'
|
12
|
-
|
13
|
-
/* IMPORT ENTITIES AND RESOLVERS */
|
14
|
-
import {
|
15
|
-
entities as IncomeStatementEntities,
|
16
|
-
resolvers as IncomeStatementResolvers,
|
17
|
-
subscribers as IncomeStatementSubscribers
|
18
|
-
} from './income-statement'
|
19
|
-
import {
|
20
|
-
entities as FinancialStatementEntities,
|
21
|
-
resolvers as FinancialStatementResolvers,
|
22
|
-
subscribers as FinancialStatementSubscribers
|
23
|
-
} from './financial-statement'
|
24
|
-
import {
|
25
|
-
entities as AccountingCategoryEntities,
|
26
|
-
resolvers as AccountingCategoryResolvers,
|
27
|
-
subscribers as AccountingCategorySubscribers
|
28
|
-
} from './accounting-category'
|
29
|
-
import {
|
30
|
-
entities as TransactionEntities,
|
31
|
-
resolvers as TransactionResolvers,
|
32
|
-
subscribers as TransactionSubscribers
|
33
|
-
} from './transaction'
|
34
|
-
import {
|
35
|
-
entities as PaymentEntities,
|
36
|
-
resolvers as PaymentResolvers,
|
37
|
-
subscribers as PaymentSubscribers
|
38
|
-
} from './payment'
|
39
|
-
import {
|
40
|
-
entities as AccountEntities,
|
41
|
-
resolvers as AccountResolvers,
|
42
|
-
subscribers as AccountSubscribers
|
43
|
-
} from './account'
|
44
|
-
import {
|
45
|
-
entities as AccountingDocumentEntities,
|
46
|
-
resolvers as AccountingDocumentResolvers,
|
47
|
-
subscribers as AccountingDocumentSubscribers
|
48
|
-
} from './accounting-document'
|
49
|
-
import {
|
50
|
-
entities as FiscalMonthEntities,
|
51
|
-
resolvers as FiscalMonthResolvers,
|
52
|
-
subscribers as FiscalMonthSubscribers
|
53
|
-
} from './fiscal-month'
|
54
|
-
import {
|
55
|
-
entities as FiscalQuarterEntities,
|
56
|
-
resolvers as FiscalQuarterResolvers,
|
57
|
-
subscribers as FiscalQuarterSubscribers
|
58
|
-
} from './fiscal-quarter'
|
59
|
-
import {
|
60
|
-
entities as FiscalYearEntities,
|
61
|
-
resolvers as FiscalYearResolvers,
|
62
|
-
subscribers as FiscalYearSubscribers
|
63
|
-
} from './fiscal-year'
|
64
|
-
|
65
|
-
export const entities = [
|
66
|
-
/* ENTITIES */
|
67
|
-
...IncomeStatementEntities,
|
68
|
-
...FinancialStatementEntities,
|
69
|
-
...AccountingCategoryEntities,
|
70
|
-
...TransactionEntities,
|
71
|
-
...AccountEntities,
|
72
|
-
...AccountingDocumentEntities,
|
73
|
-
...PaymentEntities,
|
74
|
-
...FiscalMonthEntities,
|
75
|
-
...FiscalQuarterEntities,
|
76
|
-
...FiscalYearEntities
|
77
|
-
]
|
78
|
-
|
79
|
-
export const subscribers = [
|
80
|
-
/* SUBSCRIBERS */
|
81
|
-
...IncomeStatementSubscribers,
|
82
|
-
...FinancialStatementSubscribers,
|
83
|
-
...AccountingCategorySubscribers,
|
84
|
-
...TransactionSubscribers,
|
85
|
-
...PaymentSubscribers,
|
86
|
-
...AccountSubscribers,
|
87
|
-
...AccountingDocumentSubscribers,
|
88
|
-
...FiscalYearSubscribers,
|
89
|
-
...FiscalMonthSubscribers,
|
90
|
-
...FiscalQuarterSubscribers,
|
91
|
-
...FiscalYearSubscribers
|
92
|
-
]
|
93
|
-
|
94
|
-
export const schema = {
|
95
|
-
resolverClasses: [
|
96
|
-
/* RESOLVER CLASSES */
|
97
|
-
...IncomeStatementResolvers,
|
98
|
-
...FinancialStatementResolvers,
|
99
|
-
...AccountingCategoryResolvers,
|
100
|
-
...TransactionResolvers,
|
101
|
-
...PaymentResolvers,
|
102
|
-
...AccountResolvers,
|
103
|
-
...AccountingDocumentResolvers,
|
104
|
-
...FiscalMonthResolvers,
|
105
|
-
...FiscalQuarterResolvers,
|
106
|
-
...FiscalYearResolvers
|
107
|
-
]
|
108
|
-
}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import { EventSubscriber } from 'typeorm'
|
2
|
-
|
3
|
-
import { HistoryEntitySubscriber } from '@operato/typeorm-history'
|
4
|
-
|
5
|
-
import { Payment } from './payment'
|
6
|
-
import { PaymentHistory } from './payment-history'
|
7
|
-
|
8
|
-
@EventSubscriber()
|
9
|
-
export class PaymentHistoryEntitySubscriber extends HistoryEntitySubscriber<Payment, PaymentHistory> {
|
10
|
-
public get entity() {
|
11
|
-
return Payment
|
12
|
-
}
|
13
|
-
|
14
|
-
public get historyEntity() {
|
15
|
-
return PaymentHistory
|
16
|
-
}
|
17
|
-
}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import { Payment } from './payment'
|
2
|
-
import { PaymentHistory } from './payment-history'
|
3
|
-
import { PaymentHistoryEntitySubscriber } from './event-subscriber'
|
4
|
-
import { PaymentQuery } from './payment-query'
|
5
|
-
import { PaymentMutation } from './payment-mutation'
|
6
|
-
|
7
|
-
export const entities = [Payment, PaymentHistory]
|
8
|
-
export const resolvers = [PaymentQuery, PaymentMutation]
|
9
|
-
export const subscribers = [PaymentHistoryEntitySubscriber]
|
@@ -1,132 +0,0 @@
|
|
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 { Transaction } from '../transaction/transaction'
|
15
|
-
import { Payment, PaymentDirection } from './payment'
|
16
|
-
|
17
|
-
const ORMCONFIG = config.get('ormconfig', {})
|
18
|
-
const DATABASE_TYPE = ORMCONFIG.type
|
19
|
-
|
20
|
-
@Entity()
|
21
|
-
@Index(
|
22
|
-
'ix_payment_history_0',
|
23
|
-
(paymentHistory: PaymentHistory) => [paymentHistory.originalId, paymentHistory.version],
|
24
|
-
{ unique: true }
|
25
|
-
)
|
26
|
-
@Index(
|
27
|
-
'ix_payment_history_1',
|
28
|
-
(paymentHistory: PaymentHistory) => [paymentHistory.domain, paymentHistory.originalId, paymentHistory.version],
|
29
|
-
{ unique: true }
|
30
|
-
)
|
31
|
-
@ObjectType({ description: 'History Entity of Payment' })
|
32
|
-
export class PaymentHistory implements HistoryEntityInterface<Payment> {
|
33
|
-
@PrimaryGeneratedColumn('uuid')
|
34
|
-
@Field(type => ID)
|
35
|
-
readonly id: string
|
36
|
-
|
37
|
-
@Column({ nullable: true, default: 1 })
|
38
|
-
@Field({ nullable: true })
|
39
|
-
version?: number = 1
|
40
|
-
|
41
|
-
@ManyToOne(type => Domain)
|
42
|
-
@Field({ nullable: true })
|
43
|
-
domain?: Domain
|
44
|
-
|
45
|
-
@RelationId((payment: Payment) => payment.domain)
|
46
|
-
domainId?: string
|
47
|
-
|
48
|
-
@ManyToOne(type => Transaction, transaction => transaction.payments)
|
49
|
-
@Field(type => Transaction)
|
50
|
-
transaction: Transaction
|
51
|
-
|
52
|
-
@RelationId((payment: Payment) => payment.transaction)
|
53
|
-
transactionId: string
|
54
|
-
|
55
|
-
@Column({ nullable: false })
|
56
|
-
@Field({ nullable: false })
|
57
|
-
amount: number
|
58
|
-
|
59
|
-
@Column({ nullable: true })
|
60
|
-
@Field({ nullable: true, description: 'fiscal year' })
|
61
|
-
year?: number
|
62
|
-
|
63
|
-
@Column({ nullable: true })
|
64
|
-
@Field({ nullable: true, description: 'fiscal quarter' })
|
65
|
-
quarter?: number
|
66
|
-
|
67
|
-
@Column({ nullable: true })
|
68
|
-
@Field({ nullable: true, description: 'fiscal month' })
|
69
|
-
month?: number
|
70
|
-
|
71
|
-
@Column({ nullable: false })
|
72
|
-
@Field({ nullable: false })
|
73
|
-
paidAt: Date
|
74
|
-
|
75
|
-
@Column({ nullable: false })
|
76
|
-
@Field(type => PaymentDirection)
|
77
|
-
direction: PaymentDirection
|
78
|
-
|
79
|
-
@Column({ nullable: true })
|
80
|
-
@Field({ nullable: true })
|
81
|
-
note?: string
|
82
|
-
|
83
|
-
@Column({ nullable: true })
|
84
|
-
@Field({ nullable: true })
|
85
|
-
createdAt?: Date
|
86
|
-
|
87
|
-
@Column({ nullable: true })
|
88
|
-
@Field({ nullable: true })
|
89
|
-
updatedAt?: Date
|
90
|
-
|
91
|
-
@Column({ nullable: true })
|
92
|
-
@Field({ nullable: true })
|
93
|
-
deletedAt?: Date
|
94
|
-
|
95
|
-
@ManyToOne(type => User, { nullable: true })
|
96
|
-
@Field(type => User, { nullable: true })
|
97
|
-
creator?: User
|
98
|
-
|
99
|
-
@RelationId((payment: Payment) => payment.creator)
|
100
|
-
creatorId?: string
|
101
|
-
|
102
|
-
@ManyToOne(type => User, { nullable: true })
|
103
|
-
@Field(type => User, { nullable: true })
|
104
|
-
updater?: User
|
105
|
-
|
106
|
-
@RelationId((payment: Payment) => payment.updater)
|
107
|
-
updaterId?: string
|
108
|
-
|
109
|
-
@Field(type => String, { nullable: true })
|
110
|
-
thumbnail?: string
|
111
|
-
|
112
|
-
@HistoryOriginalIdColumn()
|
113
|
-
public originalId!: string
|
114
|
-
|
115
|
-
@HistoryActionColumn({
|
116
|
-
nullable: false,
|
117
|
-
type:
|
118
|
-
DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
|
119
|
-
? 'enum'
|
120
|
-
: DATABASE_TYPE == 'oracle'
|
121
|
-
? 'varchar2'
|
122
|
-
: DATABASE_TYPE == 'mssql'
|
123
|
-
? 'nvarchar'
|
124
|
-
: 'varchar',
|
125
|
-
enum:
|
126
|
-
DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
|
127
|
-
? HistoryActionType
|
128
|
-
: undefined,
|
129
|
-
length: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb' ? undefined : 10
|
130
|
-
})
|
131
|
-
public action!: HistoryActionType
|
132
|
-
}
|
@@ -1,139 +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 { Payment } from './payment'
|
6
|
-
import { NewPayment, PaymentPatch } from './payment-type'
|
7
|
-
|
8
|
-
@Resolver(Payment)
|
9
|
-
export class PaymentMutation {
|
10
|
-
@Directive('@transaction')
|
11
|
-
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
12
|
-
@Mutation(returns => Payment, { description: 'To create new Payment' })
|
13
|
-
async createPayment(@Arg('payment') payment: NewPayment, @Ctx() context: ResolverContext): Promise<Payment> {
|
14
|
-
const { domain, user, tx } = context.state
|
15
|
-
|
16
|
-
const result = await getRepository(Payment, tx).save({
|
17
|
-
...payment,
|
18
|
-
domain,
|
19
|
-
creator: user,
|
20
|
-
updater: user
|
21
|
-
})
|
22
|
-
|
23
|
-
return result
|
24
|
-
}
|
25
|
-
|
26
|
-
@Directive('@transaction')
|
27
|
-
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
28
|
-
@Mutation(returns => Payment, { description: 'To modify Payment information' })
|
29
|
-
async updatePayment(
|
30
|
-
@Arg('id') id: string,
|
31
|
-
@Arg('patch') patch: PaymentPatch,
|
32
|
-
@Ctx() context: ResolverContext
|
33
|
-
): Promise<Payment> {
|
34
|
-
const { domain, user, tx } = context.state
|
35
|
-
|
36
|
-
const repository = getRepository(Payment, tx)
|
37
|
-
const payment = await repository.findOne({
|
38
|
-
where: { domain: { id: domain.id }, id }
|
39
|
-
})
|
40
|
-
|
41
|
-
const result = await repository.save({
|
42
|
-
...payment,
|
43
|
-
...patch,
|
44
|
-
updater: user
|
45
|
-
})
|
46
|
-
|
47
|
-
return result
|
48
|
-
}
|
49
|
-
|
50
|
-
@Directive('@transaction')
|
51
|
-
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
52
|
-
@Mutation(returns => [Payment], { description: "To modify multiple Payments' information" })
|
53
|
-
async updateMultiplePayment(
|
54
|
-
@Arg('patches', type => [PaymentPatch]) patches: PaymentPatch[],
|
55
|
-
@Ctx() context: ResolverContext
|
56
|
-
): Promise<Payment[]> {
|
57
|
-
const { domain, user, tx } = context.state
|
58
|
-
|
59
|
-
let results = []
|
60
|
-
const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
|
61
|
-
const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
|
62
|
-
const paymentRepo = getRepository(Payment, tx)
|
63
|
-
|
64
|
-
if (_createRecords.length > 0) {
|
65
|
-
for (let i = 0; i < _createRecords.length; i++) {
|
66
|
-
const newRecord = _createRecords[i]
|
67
|
-
|
68
|
-
const result = await paymentRepo.save({
|
69
|
-
...newRecord,
|
70
|
-
domain,
|
71
|
-
creator: user,
|
72
|
-
updater: user
|
73
|
-
})
|
74
|
-
|
75
|
-
results.push({ ...result, cuFlag: '+' })
|
76
|
-
}
|
77
|
-
}
|
78
|
-
|
79
|
-
if (_updateRecords.length > 0) {
|
80
|
-
for (let i = 0; i < _updateRecords.length; i++) {
|
81
|
-
const updateRecord = _updateRecords[i]
|
82
|
-
const payment = await paymentRepo.findOneBy({ id: updateRecord.id })
|
83
|
-
|
84
|
-
const result = await paymentRepo.save({
|
85
|
-
...payment,
|
86
|
-
...updateRecord,
|
87
|
-
updater: user
|
88
|
-
})
|
89
|
-
|
90
|
-
results.push({ ...result, cuFlag: 'M' })
|
91
|
-
}
|
92
|
-
}
|
93
|
-
|
94
|
-
return results
|
95
|
-
}
|
96
|
-
|
97
|
-
@Directive('@transaction')
|
98
|
-
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
99
|
-
@Mutation(returns => Boolean, { description: 'To delete Payment' })
|
100
|
-
async deletePayment(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
|
101
|
-
const { domain, tx } = context.state
|
102
|
-
|
103
|
-
await getRepository(Payment, tx).delete({ domain: { id: domain.id }, id })
|
104
|
-
|
105
|
-
return true
|
106
|
-
}
|
107
|
-
|
108
|
-
@Directive('@transaction')
|
109
|
-
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
110
|
-
@Mutation(returns => Boolean, { description: 'To delete multiple Payments' })
|
111
|
-
async deletePayments(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {
|
112
|
-
const { domain, tx } = context.state
|
113
|
-
|
114
|
-
await getRepository(Payment, tx).delete({
|
115
|
-
domain: { id: domain.id },
|
116
|
-
id: In(ids)
|
117
|
-
})
|
118
|
-
|
119
|
-
return true
|
120
|
-
}
|
121
|
-
|
122
|
-
@Directive('@transaction')
|
123
|
-
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
124
|
-
@Mutation(returns => Boolean, { description: 'To import multiple Payments' })
|
125
|
-
async importPayments(
|
126
|
-
@Arg('payments', type => [PaymentPatch]) payments: PaymentPatch[],
|
127
|
-
@Ctx() context: ResolverContext
|
128
|
-
): Promise<boolean> {
|
129
|
-
const { domain, tx } = context.state
|
130
|
-
|
131
|
-
await Promise.all(
|
132
|
-
payments.map(async (payment: PaymentPatch) => {
|
133
|
-
const createdPayment: Payment = await getRepository(Payment, tx).save({ domain, ...payment })
|
134
|
-
})
|
135
|
-
)
|
136
|
-
|
137
|
-
return true
|
138
|
-
}
|
139
|
-
}
|
@@ -1,50 +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 { Payment } from './payment'
|
5
|
-
import { PaymentList } from './payment-type'
|
6
|
-
|
7
|
-
@Resolver(Payment)
|
8
|
-
export class PaymentQuery {
|
9
|
-
@Directive('@privilege(category: "accounting", privilege: "query")')
|
10
|
-
@Query(returns => Payment!, { nullable: true, description: 'To fetch a Payment' })
|
11
|
-
async payment(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Payment> {
|
12
|
-
const { domain } = context.state
|
13
|
-
|
14
|
-
return await getRepository(Payment).findOne({
|
15
|
-
where: { domain: { id: domain.id }, id }
|
16
|
-
})
|
17
|
-
}
|
18
|
-
|
19
|
-
@Directive('@privilege(category: "accounting", privilege: "query")')
|
20
|
-
@Query(returns => PaymentList, { description: 'To fetch multiple Payments' })
|
21
|
-
async payments(@Args(type => ListParam) params: ListParam, @Ctx() context: ResolverContext): Promise<PaymentList> {
|
22
|
-
const { domain } = context.state
|
23
|
-
|
24
|
-
const queryBuilder = getQueryBuilderFromListParams({
|
25
|
-
domain,
|
26
|
-
params,
|
27
|
-
repository: await getRepository(Payment),
|
28
|
-
searchables: []
|
29
|
-
})
|
30
|
-
|
31
|
-
const [items, total] = await queryBuilder.getManyAndCount()
|
32
|
-
|
33
|
-
return { items, total }
|
34
|
-
}
|
35
|
-
|
36
|
-
@FieldResolver(type => Domain)
|
37
|
-
async domain(@Root() payment: Payment): Promise<Domain> {
|
38
|
-
return payment.domainId && (await getRepository(Domain).findOneBy({ id: payment.domainId }))
|
39
|
-
}
|
40
|
-
|
41
|
-
@FieldResolver(type => User)
|
42
|
-
async updater(@Root() payment: Payment): Promise<User> {
|
43
|
-
return payment.updaterId && (await getRepository(User).findOneBy({ id: payment.updaterId }))
|
44
|
-
}
|
45
|
-
|
46
|
-
@FieldResolver(type => User)
|
47
|
-
async creator(@Root() payment: Payment): Promise<User> {
|
48
|
-
return payment.creatorId && (await getRepository(User).findOneBy({ id: payment.creatorId }))
|
49
|
-
}
|
50
|
-
}
|
@@ -1,64 +0,0 @@
|
|
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 { Payment, PaymentDirection } from './payment'
|
8
|
-
|
9
|
-
@InputType()
|
10
|
-
export class NewPayment {
|
11
|
-
@Field(type => ObjectRef)
|
12
|
-
transaction: ObjectRef
|
13
|
-
|
14
|
-
@Field({ nullable: true })
|
15
|
-
currency?: string
|
16
|
-
|
17
|
-
@Field({ nullable: false })
|
18
|
-
amount: number
|
19
|
-
|
20
|
-
@Field({ nullable: false })
|
21
|
-
paidAt: Date
|
22
|
-
|
23
|
-
@Field(type => PaymentDirection)
|
24
|
-
direction: PaymentDirection
|
25
|
-
|
26
|
-
@Field({ nullable: true })
|
27
|
-
note?: string
|
28
|
-
}
|
29
|
-
|
30
|
-
@InputType()
|
31
|
-
export class PaymentPatch {
|
32
|
-
@Field(type => ID, { nullable: true })
|
33
|
-
id?: string
|
34
|
-
|
35
|
-
@Field(type => ObjectRef)
|
36
|
-
transaction: ObjectRef
|
37
|
-
|
38
|
-
@Field({ nullable: true })
|
39
|
-
currency?: string
|
40
|
-
|
41
|
-
@Field({ nullable: false })
|
42
|
-
amount: number
|
43
|
-
|
44
|
-
@Field({ nullable: false })
|
45
|
-
paidAt: Date
|
46
|
-
|
47
|
-
@Field(type => PaymentDirection)
|
48
|
-
direction: PaymentDirection
|
49
|
-
|
50
|
-
@Field({ nullable: true })
|
51
|
-
note?: string
|
52
|
-
|
53
|
-
@Field({ nullable: true })
|
54
|
-
cuFlag?: string
|
55
|
-
}
|
56
|
-
|
57
|
-
@ObjectType()
|
58
|
-
export class PaymentList {
|
59
|
-
@Field(type => [Payment])
|
60
|
-
items: Payment[]
|
61
|
-
|
62
|
-
@Field(type => Int)
|
63
|
-
total: number
|
64
|
-
}
|