@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,123 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
CreateDateColumn,
|
3
|
-
UpdateDateColumn,
|
4
|
-
DeleteDateColumn,
|
5
|
-
Entity,
|
6
|
-
Index,
|
7
|
-
Column,
|
8
|
-
RelationId,
|
9
|
-
ManyToOne,
|
10
|
-
VersionColumn,
|
11
|
-
PrimaryGeneratedColumn
|
12
|
-
} from 'typeorm'
|
13
|
-
import { ObjectType, Field, ID, registerEnumType } from 'type-graphql'
|
14
|
-
|
15
|
-
import { Domain } from '@things-factory/shell'
|
16
|
-
import { User } from '@things-factory/auth-base'
|
17
|
-
import { Transaction } from '../transaction/transaction'
|
18
|
-
|
19
|
-
export enum PaymentDirection {
|
20
|
-
Incoming = 'Incoming', // 수금
|
21
|
-
Outgoing = 'Outgoing' // 지출
|
22
|
-
}
|
23
|
-
|
24
|
-
registerEnumType(PaymentDirection, {
|
25
|
-
name: 'PaymentDirection',
|
26
|
-
description: 'Indicates whether the payment is incoming (received) or outgoing (paid)' // 결제 방향을 나타냅니다 (수금 또는 지출)
|
27
|
-
})
|
28
|
-
|
29
|
-
@Entity()
|
30
|
-
@Index('ix_payment_0', (payment: Payment) => [payment.domain, payment.transaction, payment.paidAt], {
|
31
|
-
where: '"deleted_at" IS NULL',
|
32
|
-
unique: true
|
33
|
-
})
|
34
|
-
@Index(
|
35
|
-
'ix_payment_1',
|
36
|
-
(payment: Payment) => [payment.domain, payment.year, payment.quarter, payment.month, payment.paidAt],
|
37
|
-
{
|
38
|
-
unique: true,
|
39
|
-
where: '"deleted_at" IS NULL'
|
40
|
-
}
|
41
|
-
)
|
42
|
-
@ObjectType({ description: 'Entity representing a Payment record in the system' }) // 시스템 내에서 결제 기록을 나타내는 엔티티
|
43
|
-
export class Payment {
|
44
|
-
@PrimaryGeneratedColumn('uuid')
|
45
|
-
@Field(type => ID, { description: 'Unique identifier for the payment record' })
|
46
|
-
readonly id: string // 고유 식별자 (UUID)
|
47
|
-
|
48
|
-
@VersionColumn()
|
49
|
-
@Field({ nullable: true, description: 'Version number used for optimistic locking' })
|
50
|
-
version?: number = 1 // 낙관적 잠금을 위한 버전 관리 필드
|
51
|
-
|
52
|
-
@ManyToOne(type => Domain)
|
53
|
-
@Field({ nullable: true, description: 'The domain to which this payment belongs' })
|
54
|
-
domain?: Domain // 결제가 속한 도메인
|
55
|
-
|
56
|
-
@RelationId((payment: Payment) => payment.domain)
|
57
|
-
domainId?: string // 도메인의 ID
|
58
|
-
|
59
|
-
@ManyToOne(type => Transaction, transaction => transaction.payments)
|
60
|
-
@Field(type => Transaction, { description: 'The transaction associated with this payment' })
|
61
|
-
transaction: Transaction // 결제와 연결된 트랜잭션
|
62
|
-
|
63
|
-
@RelationId((payment: Payment) => payment.transaction)
|
64
|
-
transactionId: string // 연결된 트랜잭션의 ID
|
65
|
-
|
66
|
-
@Column({ nullable: true })
|
67
|
-
@Field({ nullable: true, description: 'The currency used in the payment' })
|
68
|
-
currency?: string // 결제에 사용된 통화
|
69
|
-
|
70
|
-
@Column({ nullable: false })
|
71
|
-
@Field({ nullable: false, description: 'The amount of money involved in the payment' })
|
72
|
-
amount: number // 결제된 금액
|
73
|
-
|
74
|
-
@Column({ nullable: true })
|
75
|
-
@Field({ nullable: true, description: 'Fiscal year in which the payment was made' })
|
76
|
-
year?: number // 결제가 발생한 회계 연도
|
77
|
-
|
78
|
-
@Column({ nullable: true })
|
79
|
-
@Field({ nullable: true, description: 'Fiscal quarter in which the payment was made' })
|
80
|
-
quarter?: number // 결제가 발생한 회계 분기
|
81
|
-
|
82
|
-
@Column({ nullable: true })
|
83
|
-
@Field({ nullable: true, description: 'Fiscal month in which the payment was made' })
|
84
|
-
month?: number // 결제가 발생한 회계 월
|
85
|
-
|
86
|
-
@Column({ nullable: false })
|
87
|
-
@Field({ nullable: false, description: 'The date and time when the payment was made' })
|
88
|
-
paidAt: Date // 결제가 이루어진 날짜 및 시간
|
89
|
-
|
90
|
-
@Column({ nullable: false })
|
91
|
-
@Field(type => PaymentDirection, { description: 'Direction of the payment (Incoming or Outgoing)' })
|
92
|
-
direction: PaymentDirection // 결제 방향 (수금 또는 지출)
|
93
|
-
|
94
|
-
@Column({ nullable: true })
|
95
|
-
@Field({ nullable: true, description: 'Additional notes or comments about the payment' })
|
96
|
-
note?: string // 결제에 대한 추가 설명 또는 메모
|
97
|
-
|
98
|
-
@CreateDateColumn()
|
99
|
-
@Field({ nullable: true, description: 'The date and time when the payment record was created' })
|
100
|
-
createdAt?: Date // 결제 레코드가 생성된 날짜 및 시간
|
101
|
-
|
102
|
-
@UpdateDateColumn()
|
103
|
-
@Field({ nullable: true, description: 'The date and time when the payment record was last updated' })
|
104
|
-
updatedAt?: Date // 결제 레코드가 마지막으로 업데이트된 날짜 및 시간
|
105
|
-
|
106
|
-
@DeleteDateColumn()
|
107
|
-
@Field({ nullable: true, description: 'The date and time when the payment record was deleted' })
|
108
|
-
deletedAt?: Date // 결제 레코드가 삭제된 날짜 및 시간
|
109
|
-
|
110
|
-
@ManyToOne(type => User, { nullable: true })
|
111
|
-
@Field(type => User, { nullable: true, description: 'The user who created the payment record' })
|
112
|
-
creator?: User // 결제 레코드를 생성한 사용자
|
113
|
-
|
114
|
-
@RelationId((payment: Payment) => payment.creator)
|
115
|
-
creatorId?: string // 결제 레코드를 생성한 사용자의 ID
|
116
|
-
|
117
|
-
@ManyToOne(type => User, { nullable: true })
|
118
|
-
@Field(type => User, { nullable: true, description: 'The user who last updated the payment record' })
|
119
|
-
updater?: User // 결제 레코드를 마지막으로 업데이트한 사용자
|
120
|
-
|
121
|
-
@RelationId((payment: Payment) => payment.updater)
|
122
|
-
updaterId?: string // 결제 레코드를 업데이트한 사용자의 ID
|
123
|
-
}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import { EventSubscriber } from 'typeorm'
|
2
|
-
|
3
|
-
import { HistoryEntitySubscriber } from '@operato/typeorm-history'
|
4
|
-
|
5
|
-
import { Transaction } from './transaction'
|
6
|
-
import { TransactionHistory } from './transaction-history'
|
7
|
-
|
8
|
-
@EventSubscriber()
|
9
|
-
export class TransactionHistoryEntitySubscriber extends HistoryEntitySubscriber<Transaction, TransactionHistory> {
|
10
|
-
public get entity() {
|
11
|
-
return Transaction
|
12
|
-
}
|
13
|
-
|
14
|
-
public get historyEntity() {
|
15
|
-
return TransactionHistory
|
16
|
-
}
|
17
|
-
}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import { Transaction } from './transaction'
|
2
|
-
import { TransactionHistory } from './transaction-history'
|
3
|
-
import { TransactionQuery } from './transaction-query'
|
4
|
-
import { TransactionMutation } from './transaction-mutation'
|
5
|
-
import { TransactionHistoryEntitySubscriber } from './event-subscriber'
|
6
|
-
|
7
|
-
export const entities = [Transaction, TransactionHistory]
|
8
|
-
export const resolvers = [TransactionQuery, TransactionMutation]
|
9
|
-
export const subscribers = [TransactionHistoryEntitySubscriber]
|
@@ -1,161 +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, TransactionCategory, TransactionStatus, TransactionType } from './transaction'
|
15
|
-
import { Account } from '../account/account'
|
16
|
-
|
17
|
-
const ORMCONFIG = config.get('ormconfig', {})
|
18
|
-
const DATABASE_TYPE = ORMCONFIG.type
|
19
|
-
|
20
|
-
@Entity()
|
21
|
-
@Index(
|
22
|
-
'ix_transaction_history_0',
|
23
|
-
(transactionHistory: TransactionHistory) => [transactionHistory.originalId, transactionHistory.version],
|
24
|
-
{ unique: true }
|
25
|
-
)
|
26
|
-
@Index(
|
27
|
-
'ix_transaction_history_1',
|
28
|
-
(transactionHistory: TransactionHistory) => [
|
29
|
-
transactionHistory.domain,
|
30
|
-
transactionHistory.originalId,
|
31
|
-
transactionHistory.version
|
32
|
-
],
|
33
|
-
{ unique: true }
|
34
|
-
)
|
35
|
-
@ObjectType({ description: 'History Entity of Transaction' })
|
36
|
-
export class TransactionHistory implements HistoryEntityInterface<Transaction> {
|
37
|
-
@PrimaryGeneratedColumn('uuid')
|
38
|
-
@Field(type => ID)
|
39
|
-
readonly id: string
|
40
|
-
|
41
|
-
@Column({ nullable: true, default: 1 })
|
42
|
-
@Field({ nullable: true })
|
43
|
-
version?: number = 1
|
44
|
-
|
45
|
-
@ManyToOne(type => Domain)
|
46
|
-
@Field({ nullable: true })
|
47
|
-
domain?: Domain
|
48
|
-
|
49
|
-
@RelationId((transactionHistory: TransactionHistory) => transactionHistory.domain)
|
50
|
-
domainId?: string
|
51
|
-
|
52
|
-
@Column()
|
53
|
-
@Field({ nullable: true })
|
54
|
-
name?: string
|
55
|
-
|
56
|
-
@Column({ nullable: true })
|
57
|
-
@Field({ nullable: true })
|
58
|
-
description?: string
|
59
|
-
|
60
|
-
@Column({ nullable: true })
|
61
|
-
@Field({ nullable: true })
|
62
|
-
currency?: string
|
63
|
-
|
64
|
-
@Column({ nullable: true })
|
65
|
-
@Field({ nullable: true })
|
66
|
-
amount?: number = 0
|
67
|
-
|
68
|
-
@Column({ nullable: true })
|
69
|
-
@Field({ nullable: true })
|
70
|
-
active?: boolean
|
71
|
-
|
72
|
-
@Column({ nullable: true })
|
73
|
-
@Field({ nullable: true })
|
74
|
-
type?: TransactionType
|
75
|
-
|
76
|
-
@Column({ nullable: false })
|
77
|
-
@Field(type => TransactionCategory, { nullable: false })
|
78
|
-
category: TransactionCategory // 트랜잭션의 카테고리 (확정, 전망)
|
79
|
-
|
80
|
-
@Column({ nullable: false })
|
81
|
-
@Field(type => TransactionStatus, { nullable: false })
|
82
|
-
status: TransactionStatus // 트랜잭션의 상태 (예: Paid, Delayed 등)
|
83
|
-
|
84
|
-
@Column({ nullable: true })
|
85
|
-
@Field({ nullable: true, description: 'The probability of the forecast being realized (0 to 100)' })
|
86
|
-
probability?: number // 예측이 실현될 확률 (0 ~ 100)
|
87
|
-
|
88
|
-
@Column({ nullable: true })
|
89
|
-
@Field({ nullable: true, description: 'Additional notes or comments about the forecast' })
|
90
|
-
forecastNotes?: string // 전망에 대한 추가 설명이나 메모
|
91
|
-
|
92
|
-
@ManyToOne(type => Account)
|
93
|
-
@Field({ nullable: true })
|
94
|
-
account?: Account
|
95
|
-
|
96
|
-
@RelationId((transactionHistory: TransactionHistory) => transactionHistory.account)
|
97
|
-
accountId?: string
|
98
|
-
|
99
|
-
@Column({ nullable: true })
|
100
|
-
@Field({ nullable: true, description: 'fiscal year' })
|
101
|
-
year?: number
|
102
|
-
|
103
|
-
@Column({ nullable: true })
|
104
|
-
@Field({ nullable: true, description: 'fiscal quarter' })
|
105
|
-
quarter?: number
|
106
|
-
|
107
|
-
@Column({ nullable: true })
|
108
|
-
@Field({ nullable: true, description: 'fiscal month' })
|
109
|
-
month?: number
|
110
|
-
|
111
|
-
@Column({ nullable: false })
|
112
|
-
@Field({ nullable: false, description: 'The date the transaction occurs or is scheduled (in string format)' })
|
113
|
-
transactionDate: string // 트랜잭션이 발생하거나 발생할 날짜
|
114
|
-
|
115
|
-
@Column()
|
116
|
-
@Field({ nullable: true })
|
117
|
-
createdAt?: Date
|
118
|
-
|
119
|
-
@Column()
|
120
|
-
@Field({ nullable: true })
|
121
|
-
updatedAt?: Date
|
122
|
-
|
123
|
-
@Column()
|
124
|
-
@Field({ nullable: true })
|
125
|
-
deletedAt?: Date
|
126
|
-
|
127
|
-
@ManyToOne(type => User, { nullable: true })
|
128
|
-
@Field(type => User, { nullable: true })
|
129
|
-
creator?: User
|
130
|
-
|
131
|
-
@RelationId((transactionHistory: TransactionHistory) => transactionHistory.creator)
|
132
|
-
creatorId?: string
|
133
|
-
|
134
|
-
@ManyToOne(type => User, { nullable: true })
|
135
|
-
@Field(type => User, { nullable: true })
|
136
|
-
updater?: User
|
137
|
-
|
138
|
-
@RelationId((transactionHistory: TransactionHistory) => transactionHistory.updater)
|
139
|
-
updaterId?: string
|
140
|
-
|
141
|
-
@HistoryOriginalIdColumn()
|
142
|
-
public originalId!: string
|
143
|
-
|
144
|
-
@HistoryActionColumn({
|
145
|
-
nullable: false,
|
146
|
-
type:
|
147
|
-
DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
|
148
|
-
? 'enum'
|
149
|
-
: DATABASE_TYPE == 'oracle'
|
150
|
-
? 'varchar2'
|
151
|
-
: DATABASE_TYPE == 'mssql'
|
152
|
-
? 'nvarchar'
|
153
|
-
: 'varchar',
|
154
|
-
enum:
|
155
|
-
DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
|
156
|
-
? HistoryActionType
|
157
|
-
: undefined,
|
158
|
-
length: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb' ? undefined : 10
|
159
|
-
})
|
160
|
-
public action!: HistoryActionType
|
161
|
-
}
|
@@ -1,146 +0,0 @@
|
|
1
|
-
import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
|
2
|
-
import { In } from 'typeorm'
|
3
|
-
|
4
|
-
import { getRepository } from '@things-factory/shell'
|
5
|
-
|
6
|
-
import { Transaction } from './transaction'
|
7
|
-
import { NewTransaction, TransactionPatch } from './transaction-type'
|
8
|
-
|
9
|
-
@Resolver(Transaction)
|
10
|
-
export class TransactionMutation {
|
11
|
-
@Directive('@transaction')
|
12
|
-
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
13
|
-
@Mutation(returns => Transaction, { description: 'To create new Transaction' })
|
14
|
-
async createTransaction(
|
15
|
-
@Arg('transaction') transaction: NewTransaction,
|
16
|
-
@Ctx() context: ResolverContext
|
17
|
-
): Promise<Transaction> {
|
18
|
-
const { domain, user, tx } = context.state
|
19
|
-
|
20
|
-
const result = await getRepository(Transaction, tx).save({
|
21
|
-
...transaction,
|
22
|
-
domain,
|
23
|
-
creator: user,
|
24
|
-
updater: user
|
25
|
-
})
|
26
|
-
|
27
|
-
return result
|
28
|
-
}
|
29
|
-
|
30
|
-
@Directive('@transaction')
|
31
|
-
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
32
|
-
@Mutation(returns => Transaction, { description: 'To modify Transaction information' })
|
33
|
-
async updateTransaction(
|
34
|
-
@Arg('id') id: string,
|
35
|
-
@Arg('patch') patch: TransactionPatch,
|
36
|
-
@Ctx() context: ResolverContext
|
37
|
-
): Promise<Transaction> {
|
38
|
-
const { domain, user, tx } = context.state
|
39
|
-
|
40
|
-
const repository = getRepository(Transaction, tx)
|
41
|
-
const transaction = await repository.findOne({
|
42
|
-
where: { domain: { id: domain.id }, id }
|
43
|
-
})
|
44
|
-
|
45
|
-
const result = await repository.save({
|
46
|
-
...transaction,
|
47
|
-
...patch,
|
48
|
-
updater: user
|
49
|
-
})
|
50
|
-
|
51
|
-
return result
|
52
|
-
}
|
53
|
-
|
54
|
-
@Directive('@transaction')
|
55
|
-
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
56
|
-
@Mutation(returns => [Transaction], { description: "To modify multiple Transactions' information" })
|
57
|
-
async updateMultipleTransaction(
|
58
|
-
@Arg('patches', type => [TransactionPatch]) patches: TransactionPatch[],
|
59
|
-
@Ctx() context: ResolverContext
|
60
|
-
): Promise<Transaction[]> {
|
61
|
-
const { domain, user, tx } = context.state
|
62
|
-
|
63
|
-
let results = []
|
64
|
-
const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
|
65
|
-
const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
|
66
|
-
const transactionRepo = getRepository(Transaction, tx)
|
67
|
-
|
68
|
-
if (_createRecords.length > 0) {
|
69
|
-
for (let i = 0; i < _createRecords.length; i++) {
|
70
|
-
const newRecord = _createRecords[i]
|
71
|
-
|
72
|
-
const result = await transactionRepo.save({
|
73
|
-
...newRecord,
|
74
|
-
domain,
|
75
|
-
creator: user,
|
76
|
-
updater: user
|
77
|
-
})
|
78
|
-
|
79
|
-
results.push({ ...result, cuFlag: '+' })
|
80
|
-
}
|
81
|
-
}
|
82
|
-
|
83
|
-
if (_updateRecords.length > 0) {
|
84
|
-
for (let i = 0; i < _updateRecords.length; i++) {
|
85
|
-
const updateRecord = _updateRecords[i]
|
86
|
-
const transaction = await transactionRepo.findOneBy({ id: updateRecord.id })
|
87
|
-
|
88
|
-
const result = await transactionRepo.save({
|
89
|
-
...transaction,
|
90
|
-
...updateRecord,
|
91
|
-
updater: user
|
92
|
-
})
|
93
|
-
|
94
|
-
results.push({ ...result, cuFlag: 'M' })
|
95
|
-
}
|
96
|
-
}
|
97
|
-
|
98
|
-
return results
|
99
|
-
}
|
100
|
-
|
101
|
-
@Directive('@transaction')
|
102
|
-
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
103
|
-
@Mutation(returns => Boolean, { description: 'To delete Transaction' })
|
104
|
-
async deleteTransaction(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
|
105
|
-
const { domain, tx } = context.state
|
106
|
-
|
107
|
-
await getRepository(Transaction, tx).delete({ domain: { id: domain.id }, id })
|
108
|
-
|
109
|
-
return true
|
110
|
-
}
|
111
|
-
|
112
|
-
@Directive('@transaction')
|
113
|
-
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
114
|
-
@Mutation(returns => Boolean, { description: 'To delete multiple Transactions' })
|
115
|
-
async deleteTransactions(
|
116
|
-
@Arg('ids', type => [String]) ids: string[],
|
117
|
-
@Ctx() context: ResolverContext
|
118
|
-
): Promise<boolean> {
|
119
|
-
const { domain, tx } = context.state
|
120
|
-
|
121
|
-
await getRepository(Transaction, tx).delete({
|
122
|
-
domain: { id: domain.id },
|
123
|
-
id: In(ids)
|
124
|
-
})
|
125
|
-
|
126
|
-
return true
|
127
|
-
}
|
128
|
-
|
129
|
-
@Directive('@transaction')
|
130
|
-
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
131
|
-
@Mutation(returns => Boolean, { description: 'To import multiple Transactions' })
|
132
|
-
async importTransactions(
|
133
|
-
@Arg('transactions', type => [TransactionPatch]) transactions: TransactionPatch[],
|
134
|
-
@Ctx() context: ResolverContext
|
135
|
-
): Promise<boolean> {
|
136
|
-
const { domain, tx } = context.state
|
137
|
-
|
138
|
-
await Promise.all(
|
139
|
-
transactions.map(async (transaction: TransactionPatch) => {
|
140
|
-
const createdTransaction: Transaction = await getRepository(Transaction, tx).save({ domain, ...transaction })
|
141
|
-
})
|
142
|
-
)
|
143
|
-
|
144
|
-
return true
|
145
|
-
}
|
146
|
-
}
|
@@ -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 { Transaction } from './transaction'
|
5
|
-
import { TransactionList } from './transaction-type'
|
6
|
-
|
7
|
-
@Resolver(Transaction)
|
8
|
-
export class TransactionQuery {
|
9
|
-
@Directive('@privilege(category: "accounting", privilege: "query")')
|
10
|
-
@Query(returns => Transaction!, { nullable: true, description: 'To fetch a Transaction' })
|
11
|
-
async transaction(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Transaction> {
|
12
|
-
const { domain } = context.state
|
13
|
-
|
14
|
-
return await getRepository(Transaction).findOne({
|
15
|
-
where: { domain: { id: domain.id }, id }
|
16
|
-
})
|
17
|
-
}
|
18
|
-
|
19
|
-
@Directive('@privilege(category: "accounting", privilege: "query")')
|
20
|
-
@Query(returns => TransactionList, { description: 'To fetch multiple Transactions' })
|
21
|
-
async transactions(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<TransactionList> {
|
22
|
-
const { domain } = context.state
|
23
|
-
|
24
|
-
const queryBuilder = getQueryBuilderFromListParams({
|
25
|
-
domain,
|
26
|
-
params,
|
27
|
-
repository: await getRepository(Transaction),
|
28
|
-
searchables: ['name', 'description']
|
29
|
-
})
|
30
|
-
|
31
|
-
const [items, total] = await queryBuilder.getManyAndCount()
|
32
|
-
|
33
|
-
return { items, total }
|
34
|
-
}
|
35
|
-
|
36
|
-
@FieldResolver(type => Domain)
|
37
|
-
async domain(@Root() transaction: Transaction): Promise<Domain> {
|
38
|
-
return await getRepository(Domain).findOneBy({ id: transaction.domainId })
|
39
|
-
}
|
40
|
-
|
41
|
-
@FieldResolver(type => User)
|
42
|
-
async updater(@Root() transaction: Transaction): Promise<User> {
|
43
|
-
return await getRepository(User).findOneBy({ id: transaction.updaterId })
|
44
|
-
}
|
45
|
-
|
46
|
-
@FieldResolver(type => User)
|
47
|
-
async creator(@Root() transaction: Transaction): Promise<User> {
|
48
|
-
return await getRepository(User).findOneBy({ id: transaction.creatorId })
|
49
|
-
}
|
50
|
-
}
|
@@ -1,48 +0,0 @@
|
|
1
|
-
import { ObjectType, Field, InputType, Int, ID, registerEnumType } from 'type-graphql'
|
2
|
-
|
3
|
-
import { Transaction, TransactionType } from './transaction'
|
4
|
-
|
5
|
-
@InputType()
|
6
|
-
export class NewTransaction {
|
7
|
-
@Field()
|
8
|
-
name: string
|
9
|
-
|
10
|
-
@Field({ nullable: true })
|
11
|
-
description?: string
|
12
|
-
|
13
|
-
@Field(type => TransactionType, { nullable: true })
|
14
|
-
type?: TransactionType
|
15
|
-
|
16
|
-
@Field({ nullable: true })
|
17
|
-
active?: boolean
|
18
|
-
}
|
19
|
-
|
20
|
-
@InputType()
|
21
|
-
export class TransactionPatch {
|
22
|
-
@Field(type => ID, { nullable: true })
|
23
|
-
id?: string
|
24
|
-
|
25
|
-
@Field({ nullable: true })
|
26
|
-
name?: string
|
27
|
-
|
28
|
-
@Field({ nullable: true })
|
29
|
-
description?: string
|
30
|
-
|
31
|
-
@Field(type => TransactionType, { nullable: true })
|
32
|
-
type?: TransactionType
|
33
|
-
|
34
|
-
@Field({ nullable: true })
|
35
|
-
active?: boolean
|
36
|
-
|
37
|
-
@Field({ nullable: true })
|
38
|
-
cuFlag?: string
|
39
|
-
}
|
40
|
-
|
41
|
-
@ObjectType()
|
42
|
-
export class TransactionList {
|
43
|
-
@Field(type => [Transaction])
|
44
|
-
items: Transaction[]
|
45
|
-
|
46
|
-
@Field(type => Int)
|
47
|
-
total: number
|
48
|
-
}
|