@things-factory/accounting 6.0.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +31 -0
- package/assets/images/book-activity.jpg +0 -0
- package/assets/images/expense-activity.jpg +0 -0
- package/assets/images/hatiolab-logo.png +0 -0
- package/client/activities/activity-book-edit.ts +88 -0
- package/client/activities/activity-book-view.ts +88 -0
- package/client/activities/activity-expense-edit.ts +88 -0
- package/client/activities/activity-expense-view.ts +88 -0
- package/client/bootstrap.ts +1 -0
- package/client/index.ts +0 -0
- package/client/pages/account/account-importer.ts +97 -0
- package/client/pages/account/account-list-page.ts +348 -0
- package/client/pages/accounting-category/accounting-category-importer.ts +97 -0
- package/client/pages/accounting-category/accounting-category-list-page.ts +348 -0
- package/client/pages/financial-statement/financial-statement-importer.ts +97 -0
- package/client/pages/financial-statement/financial-statement-list-page.ts +348 -0
- package/client/pages/income-statement/income-statement-importer.ts +97 -0
- package/client/pages/income-statement/income-statement-list-page.ts +348 -0
- package/client/pages/ledger/ledger-importer.ts +97 -0
- package/client/pages/ledger/ledger-list-page.ts +332 -0
- package/client/pages/main.ts +24 -0
- package/client/pages/transaction/transaction-importer.ts +97 -0
- package/client/pages/transaction/transaction-list-page.ts +348 -0
- package/client/route.ts +27 -0
- package/client/tsconfig.json +11 -0
- package/dist-client/activities/activity-book-edit.d.ts +14 -0
- package/dist-client/activities/activity-book-edit.js +85 -0
- package/dist-client/activities/activity-book-edit.js.map +1 -0
- package/dist-client/activities/activity-book-view.d.ts +14 -0
- package/dist-client/activities/activity-book-view.js +85 -0
- package/dist-client/activities/activity-book-view.js.map +1 -0
- package/dist-client/activities/activity-expense-edit.d.ts +14 -0
- package/dist-client/activities/activity-expense-edit.js +85 -0
- package/dist-client/activities/activity-expense-edit.js.map +1 -0
- package/dist-client/activities/activity-expense-view.d.ts +14 -0
- package/dist-client/activities/activity-expense-view.js +85 -0
- package/dist-client/activities/activity-expense-view.js.map +1 -0
- package/dist-client/bootstrap.d.ts +1 -0
- package/dist-client/bootstrap.js +2 -0
- package/dist-client/bootstrap.js.map +1 -0
- package/dist-client/index.d.ts +0 -0
- package/dist-client/index.js +2 -0
- package/dist-client/index.js.map +1 -0
- package/dist-client/pages/account/account-importer.d.ts +22 -0
- package/dist-client/pages/account/account-importer.js +100 -0
- package/dist-client/pages/account/account-importer.js.map +1 -0
- package/dist-client/pages/account/account-list-page.d.ts +62 -0
- package/dist-client/pages/account/account-list-page.js +326 -0
- package/dist-client/pages/account/account-list-page.js.map +1 -0
- package/dist-client/pages/accounting-category/accounting-category-importer.d.ts +22 -0
- package/dist-client/pages/accounting-category/accounting-category-importer.js +100 -0
- package/dist-client/pages/accounting-category/accounting-category-importer.js.map +1 -0
- package/dist-client/pages/accounting-category/accounting-category-list-page.d.ts +62 -0
- package/dist-client/pages/accounting-category/accounting-category-list-page.js +326 -0
- package/dist-client/pages/accounting-category/accounting-category-list-page.js.map +1 -0
- package/dist-client/pages/financial-statement/financial-statement-importer.d.ts +22 -0
- package/dist-client/pages/financial-statement/financial-statement-importer.js +100 -0
- package/dist-client/pages/financial-statement/financial-statement-importer.js.map +1 -0
- package/dist-client/pages/financial-statement/financial-statement-list-page.d.ts +62 -0
- package/dist-client/pages/financial-statement/financial-statement-list-page.js +326 -0
- package/dist-client/pages/financial-statement/financial-statement-list-page.js.map +1 -0
- package/dist-client/pages/income-statement/income-statement-importer.d.ts +22 -0
- package/dist-client/pages/income-statement/income-statement-importer.js +100 -0
- package/dist-client/pages/income-statement/income-statement-importer.js.map +1 -0
- package/dist-client/pages/income-statement/income-statement-list-page.d.ts +62 -0
- package/dist-client/pages/income-statement/income-statement-list-page.js +326 -0
- package/dist-client/pages/income-statement/income-statement-list-page.js.map +1 -0
- package/dist-client/pages/ledger/ledger-importer.d.ts +22 -0
- package/dist-client/pages/ledger/ledger-importer.js +100 -0
- package/dist-client/pages/ledger/ledger-importer.js.map +1 -0
- package/dist-client/pages/ledger/ledger-list-page.d.ts +62 -0
- package/dist-client/pages/ledger/ledger-list-page.js +317 -0
- package/dist-client/pages/ledger/ledger-list-page.js.map +1 -0
- package/dist-client/pages/main.d.ts +1 -0
- package/dist-client/pages/main.js +27 -0
- package/dist-client/pages/main.js.map +1 -0
- package/dist-client/pages/transaction/transaction-importer.d.ts +22 -0
- package/dist-client/pages/transaction/transaction-importer.js +100 -0
- package/dist-client/pages/transaction/transaction-importer.js.map +1 -0
- package/dist-client/pages/transaction/transaction-list-page.d.ts +62 -0
- package/dist-client/pages/transaction/transaction-list-page.js +326 -0
- package/dist-client/pages/transaction/transaction-list-page.js.map +1 -0
- package/dist-client/route.d.ts +1 -0
- package/dist-client/route.js +23 -0
- package/dist-client/route.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -0
- package/dist-server/activities/activity-book.js +150 -0
- package/dist-server/activities/activity-book.js.map +1 -0
- package/dist-server/activities/activity-expense.js +150 -0
- package/dist-server/activities/activity-expense.js.map +1 -0
- package/dist-server/activities/index.js +19 -0
- package/dist-server/activities/index.js.map +1 -0
- package/dist-server/controllers/index.js +1 -0
- package/dist-server/controllers/index.js.map +1 -0
- package/dist-server/index.js +7 -0
- package/dist-server/index.js.map +1 -0
- package/dist-server/middlewares/index.js +8 -0
- package/dist-server/middlewares/index.js.map +1 -0
- package/dist-server/migrations/index.js +12 -0
- package/dist-server/migrations/index.js.map +1 -0
- package/dist-server/routes.js +25 -0
- package/dist-server/routes.js.map +1 -0
- package/dist-server/service/account/account-history.js +113 -0
- package/dist-server/service/account/account-history.js.map +1 -0
- package/dist-server/service/account/account-mutation.js +130 -0
- package/dist-server/service/account/account-mutation.js.map +1 -0
- package/dist-server/service/account/account-query.js +79 -0
- package/dist-server/service/account/account-query.js.map +1 -0
- package/dist-server/service/account/account-type.js +65 -0
- package/dist-server/service/account/account-type.js.map +1 -0
- package/dist-server/service/account/account.js +102 -0
- package/dist-server/service/account/account.js.map +1 -0
- package/dist-server/service/account/event-subscriber.js +21 -0
- package/dist-server/service/account/event-subscriber.js.map +1 -0
- package/dist-server/service/account/index.js +12 -0
- package/dist-server/service/account/index.js.map +1 -0
- package/dist-server/service/accounting-category/accounting-category-mutation.js +132 -0
- package/dist-server/service/accounting-category/accounting-category-mutation.js.map +1 -0
- package/dist-server/service/accounting-category/accounting-category-query.js +79 -0
- package/dist-server/service/accounting-category/accounting-category-query.js.map +1 -0
- package/dist-server/service/accounting-category/accounting-category-type.js +65 -0
- package/dist-server/service/accounting-category/accounting-category-type.js.map +1 -0
- package/dist-server/service/accounting-category/accounting-category.js +89 -0
- package/dist-server/service/accounting-category/accounting-category.js.map +1 -0
- package/dist-server/service/accounting-category/index.js +10 -0
- package/dist-server/service/accounting-category/index.js.map +1 -0
- package/dist-server/service/financial-statement/event-subscriber.js +21 -0
- package/dist-server/service/financial-statement/event-subscriber.js.map +1 -0
- package/dist-server/service/financial-statement/financial-statement-history.js +126 -0
- package/dist-server/service/financial-statement/financial-statement-history.js.map +1 -0
- package/dist-server/service/financial-statement/financial-statement-mutation.js +132 -0
- package/dist-server/service/financial-statement/financial-statement-mutation.js.map +1 -0
- package/dist-server/service/financial-statement/financial-statement-query.js +79 -0
- package/dist-server/service/financial-statement/financial-statement-query.js.map +1 -0
- package/dist-server/service/financial-statement/financial-statement-type.js +77 -0
- package/dist-server/service/financial-statement/financial-statement-type.js.map +1 -0
- package/dist-server/service/financial-statement/financial-statement.js +111 -0
- package/dist-server/service/financial-statement/financial-statement.js.map +1 -0
- package/dist-server/service/financial-statement/index.js +12 -0
- package/dist-server/service/financial-statement/index.js.map +1 -0
- package/dist-server/service/income-statement/event-subscriber.js +21 -0
- package/dist-server/service/income-statement/event-subscriber.js.map +1 -0
- package/dist-server/service/income-statement/income-statement-history.js +126 -0
- package/dist-server/service/income-statement/income-statement-history.js.map +1 -0
- package/dist-server/service/income-statement/income-statement-mutation.js +132 -0
- package/dist-server/service/income-statement/income-statement-mutation.js.map +1 -0
- package/dist-server/service/income-statement/income-statement-query.js +79 -0
- package/dist-server/service/income-statement/income-statement-query.js.map +1 -0
- package/dist-server/service/income-statement/income-statement-type.js +77 -0
- package/dist-server/service/income-statement/income-statement-type.js.map +1 -0
- package/dist-server/service/income-statement/income-statement.js +117 -0
- package/dist-server/service/income-statement/income-statement.js.map +1 -0
- package/dist-server/service/income-statement/index.js +12 -0
- package/dist-server/service/income-statement/index.js.map +1 -0
- package/dist-server/service/index.js +43 -0
- package/dist-server/service/index.js.map +1 -0
- package/dist-server/service/transaction/event-subscriber.js +21 -0
- package/dist-server/service/transaction/event-subscriber.js.map +1 -0
- package/dist-server/service/transaction/index.js +12 -0
- package/dist-server/service/transaction/index.js.map +1 -0
- package/dist-server/service/transaction/transaction-history.js +123 -0
- package/dist-server/service/transaction/transaction-history.js.map +1 -0
- package/dist-server/service/transaction/transaction-mutation.js +130 -0
- package/dist-server/service/transaction/transaction-mutation.js.map +1 -0
- package/dist-server/service/transaction/transaction-query.js +79 -0
- package/dist-server/service/transaction/transaction-query.js.map +1 -0
- package/dist-server/service/transaction/transaction-type.js +73 -0
- package/dist-server/service/transaction/transaction-type.js.map +1 -0
- package/dist-server/service/transaction/transaction.js +130 -0
- package/dist-server/service/transaction/transaction.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -0
- package/helps/accounting/account.md +160 -0
- package/helps/accounting/accounting-category.md +160 -0
- package/helps/accounting/financial-accounting.md +53 -0
- package/helps/accounting/financial-statement.md +160 -0
- package/helps/accounting/income-statement.md +160 -0
- package/helps/accounting/transaction.md +160 -0
- package/package.json +36 -0
- package/server/activities/activity-book.ts +149 -0
- package/server/activities/activity-expense.ts +149 -0
- package/server/activities/index.ts +19 -0
- package/server/controllers/index.ts +0 -0
- package/server/index.ts +4 -0
- package/server/middlewares/index.ts +3 -0
- package/server/migrations/index.ts +9 -0
- package/server/routes.ts +28 -0
- package/server/service/account/account-history.ts +103 -0
- package/server/service/account/account-mutation.ts +137 -0
- package/server/service/account/account-query.ts +49 -0
- package/server/service/account/account-type.ts +44 -0
- package/server/service/account/account.ts +86 -0
- package/server/service/account/event-subscriber.ts +17 -0
- package/server/service/account/index.ts +9 -0
- package/server/service/accounting-category/accounting-category-mutation.ts +145 -0
- package/server/service/accounting-category/accounting-category-query.ts +51 -0
- package/server/service/accounting-category/accounting-category-type.ts +42 -0
- package/server/service/accounting-category/accounting-category.ts +80 -0
- package/server/service/accounting-category/index.ts +7 -0
- package/server/service/financial-statement/event-subscriber.ts +17 -0
- package/server/service/financial-statement/financial-statement-history.ts +114 -0
- package/server/service/financial-statement/financial-statement-mutation.ts +145 -0
- package/server/service/financial-statement/financial-statement-query.ts +51 -0
- package/server/service/financial-statement/financial-statement-type.ts +51 -0
- package/server/service/financial-statement/financial-statement.ts +100 -0
- package/server/service/financial-statement/index.ts +9 -0
- package/server/service/income-statement/event-subscriber.ts +17 -0
- package/server/service/income-statement/income-statement-history.ts +114 -0
- package/server/service/income-statement/income-statement-mutation.ts +145 -0
- package/server/service/income-statement/income-statement-query.ts +48 -0
- package/server/service/income-statement/income-statement-type.ts +51 -0
- package/server/service/income-statement/income-statement.ts +105 -0
- package/server/service/income-statement/index.ts +9 -0
- package/server/service/index.ts +62 -0
- package/server/service/transaction/event-subscriber.ts +17 -0
- package/server/service/transaction/index.ts +9 -0
- package/server/service/transaction/transaction-history.ts +111 -0
- package/server/service/transaction/transaction-mutation.ts +143 -0
- package/server/service/transaction/transaction-query.ts +48 -0
- package/server/service/transaction/transaction-type.ts +48 -0
- package/server/service/transaction/transaction.ts +115 -0
- package/server/tsconfig.json +10 -0
- package/things-factory.config.js +16 -0
- package/translations/en.json +1 -0
- package/translations/ko.json +1 -0
- package/translations/ms.json +1 -0
- package/translations/zh.json +1 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
|
|
2
|
+
import { In } from 'typeorm'
|
|
3
|
+
|
|
4
|
+
import { createAttachment, deleteAttachmentsByRef } from '@things-factory/attachment-base'
|
|
5
|
+
|
|
6
|
+
import { Transaction } from './transaction'
|
|
7
|
+
import { NewTransaction, TransactionPatch } from './transaction-type'
|
|
8
|
+
|
|
9
|
+
@Resolver(Transaction)
|
|
10
|
+
export class TransactionMutation {
|
|
11
|
+
@Directive('@transaction')
|
|
12
|
+
@Mutation(returns => Transaction, { description: 'To create new Transaction' })
|
|
13
|
+
async createTransaction(
|
|
14
|
+
@Arg('transaction') transaction: NewTransaction,
|
|
15
|
+
@Ctx() context: ResolverContext
|
|
16
|
+
): Promise<Transaction> {
|
|
17
|
+
const { domain, user, tx } = context.state
|
|
18
|
+
|
|
19
|
+
const result = await tx.getRepository(Transaction).save({
|
|
20
|
+
...transaction,
|
|
21
|
+
domain,
|
|
22
|
+
creator: user,
|
|
23
|
+
updater: user
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
return result
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@Directive('@transaction')
|
|
30
|
+
@Mutation(returns => Transaction, { description: 'To modify Transaction information' })
|
|
31
|
+
async updateTransaction(
|
|
32
|
+
@Arg('id') id: string,
|
|
33
|
+
@Arg('patch') patch: TransactionPatch,
|
|
34
|
+
@Ctx() context: ResolverContext
|
|
35
|
+
): Promise<Transaction> {
|
|
36
|
+
const { domain, user, tx } = context.state
|
|
37
|
+
|
|
38
|
+
const repository = tx.getRepository(Transaction)
|
|
39
|
+
const transaction = await repository.findOne({
|
|
40
|
+
where: { domain: { id: domain.id }, id }
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
const result = await repository.save({
|
|
44
|
+
...transaction,
|
|
45
|
+
...patch,
|
|
46
|
+
updater: user
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
return result
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@Directive('@transaction')
|
|
53
|
+
@Mutation(returns => [Transaction], { description: "To modify multiple Transactions' information" })
|
|
54
|
+
async updateMultipleTransaction(
|
|
55
|
+
@Arg('patches', type => [TransactionPatch]) patches: TransactionPatch[],
|
|
56
|
+
@Ctx() context: ResolverContext
|
|
57
|
+
): Promise<Transaction[]> {
|
|
58
|
+
const { domain, user, tx } = context.state
|
|
59
|
+
|
|
60
|
+
let results = []
|
|
61
|
+
const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
|
|
62
|
+
const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
|
|
63
|
+
const transactionRepo = tx.getRepository(Transaction)
|
|
64
|
+
|
|
65
|
+
if (_createRecords.length > 0) {
|
|
66
|
+
for (let i = 0; i < _createRecords.length; i++) {
|
|
67
|
+
const newRecord = _createRecords[i]
|
|
68
|
+
|
|
69
|
+
const result = await transactionRepo.save({
|
|
70
|
+
...newRecord,
|
|
71
|
+
domain,
|
|
72
|
+
creator: user,
|
|
73
|
+
updater: user
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
results.push({ ...result, cuFlag: '+' })
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (_updateRecords.length > 0) {
|
|
81
|
+
for (let i = 0; i < _updateRecords.length; i++) {
|
|
82
|
+
const updateRecord = _updateRecords[i]
|
|
83
|
+
const transaction = await transactionRepo.findOneBy({ id: updateRecord.id })
|
|
84
|
+
|
|
85
|
+
const result = await transactionRepo.save({
|
|
86
|
+
...transaction,
|
|
87
|
+
...updateRecord,
|
|
88
|
+
updater: user
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
results.push({ ...result, cuFlag: 'M' })
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return results
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@Directive('@transaction')
|
|
99
|
+
@Mutation(returns => Boolean, { description: 'To delete Transaction' })
|
|
100
|
+
async deleteTransaction(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
|
|
101
|
+
const { domain, tx } = context.state
|
|
102
|
+
|
|
103
|
+
await tx.getRepository(Transaction).delete({ domain: { id: domain.id }, id })
|
|
104
|
+
await deleteAttachmentsByRef(null, { refBys: [id] }, context)
|
|
105
|
+
|
|
106
|
+
return true
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@Directive('@transaction')
|
|
110
|
+
@Mutation(returns => Boolean, { description: 'To delete multiple Transactions' })
|
|
111
|
+
async deleteTransactions(
|
|
112
|
+
@Arg('ids', type => [String]) ids: string[],
|
|
113
|
+
@Ctx() context: ResolverContext
|
|
114
|
+
): Promise<boolean> {
|
|
115
|
+
const { domain, tx } = context.state
|
|
116
|
+
|
|
117
|
+
await tx.getRepository(Transaction).delete({
|
|
118
|
+
domain: { id: domain.id },
|
|
119
|
+
id: In(ids)
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
await deleteAttachmentsByRef(null, { refBys: ids }, context)
|
|
123
|
+
|
|
124
|
+
return true
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
@Directive('@transaction')
|
|
128
|
+
@Mutation(returns => Boolean, { description: 'To import multiple Transactions' })
|
|
129
|
+
async importTransactions(
|
|
130
|
+
@Arg('transactions', type => [TransactionPatch]) transactions: TransactionPatch[],
|
|
131
|
+
@Ctx() context: ResolverContext
|
|
132
|
+
): Promise<boolean> {
|
|
133
|
+
const { domain, tx } = context.state
|
|
134
|
+
|
|
135
|
+
await Promise.all(
|
|
136
|
+
transactions.map(async (transaction: TransactionPatch) => {
|
|
137
|
+
const createdTransaction: Transaction = await tx.getRepository(Transaction).save({ domain, ...transaction })
|
|
138
|
+
})
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
return true
|
|
142
|
+
}
|
|
143
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
@Query(returns => Transaction!, { nullable: true, description: 'To fetch a Transaction' })
|
|
10
|
+
async transaction(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Transaction> {
|
|
11
|
+
const { domain } = context.state
|
|
12
|
+
|
|
13
|
+
return await getRepository(Transaction).findOne({
|
|
14
|
+
where: { domain: { id: domain.id }, id }
|
|
15
|
+
})
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@Query(returns => TransactionList, { description: 'To fetch multiple Transactions' })
|
|
19
|
+
async transactions(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<TransactionList> {
|
|
20
|
+
const { domain } = context.state
|
|
21
|
+
|
|
22
|
+
const queryBuilder = getQueryBuilderFromListParams({
|
|
23
|
+
domain,
|
|
24
|
+
params,
|
|
25
|
+
repository: await getRepository(Transaction),
|
|
26
|
+
searchables: ['name', 'description']
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
const [items, total] = await queryBuilder.getManyAndCount()
|
|
30
|
+
|
|
31
|
+
return { items, total }
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@FieldResolver(type => Domain)
|
|
35
|
+
async domain(@Root() transaction: Transaction): Promise<Domain> {
|
|
36
|
+
return await getRepository(Domain).findOneBy({ id: transaction.domainId })
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@FieldResolver(type => User)
|
|
40
|
+
async updater(@Root() transaction: Transaction): Promise<User> {
|
|
41
|
+
return await getRepository(User).findOneBy({ id: transaction.updaterId })
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@FieldResolver(type => User)
|
|
45
|
+
async creator(@Root() transaction: Transaction): Promise<User> {
|
|
46
|
+
return await getRepository(User).findOneBy({ id: transaction.creatorId })
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CreateDateColumn,
|
|
3
|
+
UpdateDateColumn,
|
|
4
|
+
DeleteDateColumn,
|
|
5
|
+
Entity,
|
|
6
|
+
Index,
|
|
7
|
+
Column,
|
|
8
|
+
RelationId,
|
|
9
|
+
ManyToOne,
|
|
10
|
+
PrimaryGeneratedColumn,
|
|
11
|
+
VersionColumn
|
|
12
|
+
} from 'typeorm'
|
|
13
|
+
import { ObjectType, Field, Int, ID, registerEnumType } from 'type-graphql'
|
|
14
|
+
|
|
15
|
+
import { Domain } from '@things-factory/shell'
|
|
16
|
+
import { User } from '@things-factory/auth-base'
|
|
17
|
+
import { Account } from '../account/account'
|
|
18
|
+
|
|
19
|
+
export enum TransactionType {
|
|
20
|
+
Income, // 회사가 받은 돈을 나타냅니다. 예를 들어, 제품 판매 수익 등이 해당됩니다.
|
|
21
|
+
Expense, // 회사가 지불한 돈을 나타냅니다. 예를 들어, 임금, 재고 구매 비용, 건물 임대료 등이 해당됩니다.
|
|
22
|
+
Asset, // 회사가 소유한 자산을 나타냅니다. 예를 들어, 토지, 건물, 차량 등이 해당됩니다.
|
|
23
|
+
Liability, // 회사가 지불해야 하는 부채를 나타냅니다. 예를 들어, 대출, 미지급금 등이 해당됩니다.
|
|
24
|
+
Equity // 회사의 자본을 나타냅니다. 예를 들어, 자본금, 이익 잉여금 등이 해당됩니다.
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
registerEnumType(TransactionType, {
|
|
28
|
+
name: 'TransactionType',
|
|
29
|
+
description: 'type enumeration of a transaction'
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
@Entity()
|
|
33
|
+
@Index(
|
|
34
|
+
'ix_transaction_0',
|
|
35
|
+
(transaction: Transaction) => [transaction.domain, transaction.name, transaction.deletedAt],
|
|
36
|
+
{ unique: true }
|
|
37
|
+
)
|
|
38
|
+
@ObjectType({ description: 'Entity for Transaction' })
|
|
39
|
+
export class Transaction {
|
|
40
|
+
@PrimaryGeneratedColumn('uuid')
|
|
41
|
+
@Field(type => ID)
|
|
42
|
+
readonly id: string
|
|
43
|
+
|
|
44
|
+
@VersionColumn()
|
|
45
|
+
@Field({ nullable: true })
|
|
46
|
+
version?: number = 1
|
|
47
|
+
|
|
48
|
+
@ManyToOne(type => Domain)
|
|
49
|
+
@Field({ nullable: true })
|
|
50
|
+
domain?: Domain
|
|
51
|
+
|
|
52
|
+
@RelationId((transaction: Transaction) => transaction.domain)
|
|
53
|
+
domainId?: string
|
|
54
|
+
|
|
55
|
+
@Column()
|
|
56
|
+
@Field({ nullable: true })
|
|
57
|
+
name?: string
|
|
58
|
+
|
|
59
|
+
@Column({ nullable: true })
|
|
60
|
+
@Field({ nullable: true })
|
|
61
|
+
description?: string
|
|
62
|
+
|
|
63
|
+
@Column({ nullable: true })
|
|
64
|
+
@Field({ nullable: true })
|
|
65
|
+
date?: Date
|
|
66
|
+
|
|
67
|
+
@Column({ nullable: true })
|
|
68
|
+
@Field({ nullable: true })
|
|
69
|
+
currency?: string
|
|
70
|
+
|
|
71
|
+
@Column({ nullable: true })
|
|
72
|
+
@Field({ nullable: true })
|
|
73
|
+
amount?: number = 0
|
|
74
|
+
|
|
75
|
+
@Column({ nullable: true })
|
|
76
|
+
@Field({ nullable: true })
|
|
77
|
+
active?: boolean
|
|
78
|
+
|
|
79
|
+
@Column({ nullable: true })
|
|
80
|
+
@Field({ nullable: true })
|
|
81
|
+
type?: TransactionType
|
|
82
|
+
|
|
83
|
+
@ManyToOne(type => Account)
|
|
84
|
+
@Field({ nullable: true })
|
|
85
|
+
account?: Account
|
|
86
|
+
|
|
87
|
+
@RelationId((transaction: Transaction) => transaction.account)
|
|
88
|
+
accountId?: string
|
|
89
|
+
|
|
90
|
+
@CreateDateColumn()
|
|
91
|
+
@Field({ nullable: true })
|
|
92
|
+
createdAt?: Date
|
|
93
|
+
|
|
94
|
+
@UpdateDateColumn()
|
|
95
|
+
@Field({ nullable: true })
|
|
96
|
+
updatedAt?: Date
|
|
97
|
+
|
|
98
|
+
@DeleteDateColumn()
|
|
99
|
+
@Field({ nullable: true })
|
|
100
|
+
deletedAt?: Date
|
|
101
|
+
|
|
102
|
+
@ManyToOne(type => User, { nullable: true })
|
|
103
|
+
@Field(type => User, { nullable: true })
|
|
104
|
+
creator?: User
|
|
105
|
+
|
|
106
|
+
@RelationId((transaction: Transaction) => transaction.creator)
|
|
107
|
+
creatorId?: string
|
|
108
|
+
|
|
109
|
+
@ManyToOne(type => User, { nullable: true })
|
|
110
|
+
@Field(type => User, { nullable: true })
|
|
111
|
+
updater?: User
|
|
112
|
+
|
|
113
|
+
@RelationId((transaction: Transaction) => transaction.updater)
|
|
114
|
+
updaterId?: string
|
|
115
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import route from './dist-client/route'
|
|
2
|
+
import bootstrap from './dist-client/bootstrap'
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
route,
|
|
6
|
+
routes: [
|
|
7
|
+
{ tagname: 'accounting-main', page: 'accounting-main' },
|
|
8
|
+
{ tagname: 'ledger-list-page', page: 'ledger-list' },
|
|
9
|
+
{ tagname: 'account-list-page', page: 'account-list' },
|
|
10
|
+
{ tagname: 'transaction-list-page', page: 'transaction-list' },
|
|
11
|
+
{ tagname: 'accounting-category-list-page', page: 'accounting-category-list' },
|
|
12
|
+
{ tagname: 'financial-statement-list-page', page: 'financial-statement-list' },
|
|
13
|
+
{ tagname: 'income-statement-list-page', page: 'income-statement-list' }
|
|
14
|
+
],
|
|
15
|
+
bootstrap
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|