@things-factory/accounting 8.0.0-alpha.1 → 8.0.0-alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- package/client/bootstrap.ts +10 -1
- package/client/components/accounting-category-selector.ts +136 -0
- package/client/components/accounting-category-view.ts +75 -0
- package/client/grist-editors/grist-editor-accounting-category-object.ts +83 -0
- package/client/grist-editors/grist-renderer-accounting-category-object.ts +13 -0
- package/client/pages/account/account-list-page.ts +33 -2
- package/client/pages/accounting-category/accounting-category-list-page.ts +31 -1
- package/client/pages/accounting-category/accounting-category-tree-page.ts +338 -0
- package/client/pages/accounting-document/accounting-document-importer.ts +90 -0
- package/client/pages/accounting-document/accounting-document-list-page.ts +398 -0
- package/client/pages/{ledger/ledger-importer.ts → payment/payment-importer.ts} +10 -17
- package/client/pages/{ledger/ledger-list-page.ts → payment/payment-list-page.ts} +118 -57
- package/client/route.ts +0 -4
- package/client/types/accounting-category.ts +23 -0
- package/client/types/index.ts +1 -0
- package/dist-client/bootstrap.js +7 -1
- package/dist-client/bootstrap.js.map +1 -1
- package/dist-client/components/accounting-category-selector.d.ts +16 -0
- package/dist-client/components/accounting-category-selector.js +134 -0
- package/dist-client/components/accounting-category-selector.js.map +1 -0
- package/dist-client/components/accounting-category-view.d.ts +14 -0
- package/dist-client/components/accounting-category-view.js +81 -0
- package/dist-client/components/accounting-category-view.js.map +1 -0
- package/dist-client/grist-editors/grist-editor-accounting-category-object.d.ts +11 -0
- package/dist-client/grist-editors/grist-editor-accounting-category-object.js +71 -0
- package/dist-client/grist-editors/grist-editor-accounting-category-object.js.map +1 -0
- package/dist-client/grist-editors/grist-renderer-accounting-category-object.d.ts +2 -0
- package/dist-client/grist-editors/grist-renderer-accounting-category-object.js +9 -0
- package/dist-client/grist-editors/grist-renderer-accounting-category-object.js.map +1 -0
- package/dist-client/pages/account/account-list-page.js +33 -2
- package/dist-client/pages/account/account-list-page.js.map +1 -1
- package/dist-client/pages/accounting-category/accounting-category-list-page.js +31 -1
- package/dist-client/pages/accounting-category/accounting-category-list-page.js.map +1 -1
- package/dist-client/pages/accounting-category/accounting-category-tree-page.d.ts +46 -0
- package/dist-client/pages/accounting-category/accounting-category-tree-page.js +329 -0
- package/dist-client/pages/accounting-category/accounting-category-tree-page.js.map +1 -0
- package/dist-client/pages/accounting-document/accounting-document-importer.d.ts +23 -0
- package/dist-client/pages/accounting-document/accounting-document-importer.js +93 -0
- package/dist-client/pages/accounting-document/accounting-document-importer.js.map +1 -0
- package/dist-client/pages/accounting-document/accounting-document-list-page.d.ts +66 -0
- package/dist-client/pages/accounting-document/accounting-document-list-page.js +370 -0
- package/dist-client/pages/accounting-document/accounting-document-list-page.js.map +1 -0
- package/dist-client/pages/{ledger/ledger-importer.d.ts → payment/payment-importer.d.ts} +3 -2
- package/dist-client/pages/{ledger/ledger-importer.js → payment/payment-importer.js} +14 -21
- package/dist-client/pages/payment/payment-importer.js.map +1 -0
- package/dist-client/pages/{ledger/ledger-list-page.d.ts → payment/payment-list-page.d.ts} +12 -8
- package/dist-client/pages/{ledger/ledger-list-page.js → payment/payment-list-page.js} +114 -67
- package/dist-client/pages/payment/payment-list-page.js.map +1 -0
- package/dist-client/route.d.ts +1 -1
- package/dist-client/route.js +0 -3
- package/dist-client/route.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-client/types/accounting-category.d.ts +16 -0
- package/dist-client/types/accounting-category.js +3 -0
- package/dist-client/types/accounting-category.js.map +1 -0
- package/dist-client/types/index.d.ts +1 -0
- package/dist-client/types/index.js +2 -0
- package/dist-client/types/index.js.map +1 -0
- package/dist-server/activities/activity-book.js +31 -19
- package/dist-server/activities/activity-book.js.map +1 -1
- package/dist-server/controllers/summary-statements.js +13 -7
- package/dist-server/controllers/summary-statements.js.map +1 -1
- package/dist-server/index.d.ts +1 -0
- package/dist-server/index.js +1 -0
- package/dist-server/index.js.map +1 -1
- package/dist-server/migrations/1725200507196-seed-fiscal-entities.js +3 -3
- package/dist-server/migrations/1725200507196-seed-fiscal-entities.js.map +1 -1
- package/dist-server/migrations/1725201467183-seed-accounts.js +31 -31
- package/dist-server/migrations/1725201467183-seed-accounts.js.map +1 -1
- package/dist-server/routes.d.ts +0 -1
- package/dist-server/routes.js +0 -1
- package/dist-server/routes.js.map +1 -1
- package/dist-server/service/account/account-history.d.ts +4 -1
- package/dist-server/service/account/account-history.js +14 -4
- package/dist-server/service/account/account-history.js.map +1 -1
- package/dist-server/service/account/account-mutation.js +13 -9
- package/dist-server/service/account/account-mutation.js.map +1 -1
- package/dist-server/service/account/account-query.js +2 -0
- package/dist-server/service/account/account-query.js.map +1 -1
- package/dist-server/service/account/account.d.ts +1 -1
- package/dist-server/service/account/account.js +15 -4
- package/dist-server/service/account/account.js.map +1 -1
- package/dist-server/service/account/index.d.ts +1 -2
- package/dist-server/service/accounting-category/accounting-category-history.d.ts +26 -0
- package/dist-server/service/accounting-category/accounting-category-history.js +136 -0
- package/dist-server/service/accounting-category/accounting-category-history.js.map +1 -0
- package/dist-server/service/accounting-category/accounting-category-mutation.js +12 -8
- package/dist-server/service/accounting-category/accounting-category-mutation.js.map +1 -1
- package/dist-server/service/accounting-category/accounting-category-query.d.ts +1 -0
- package/dist-server/service/accounting-category/accounting-category-query.js +23 -0
- package/dist-server/service/accounting-category/accounting-category-query.js.map +1 -1
- package/dist-server/service/accounting-category/accounting-category.d.ts +1 -0
- package/dist-server/service/accounting-category/accounting-category.js +14 -3
- package/dist-server/service/accounting-category/accounting-category.js.map +1 -1
- package/dist-server/service/accounting-category/event-subscriber.d.ts +7 -0
- package/dist-server/service/accounting-category/event-subscriber.js +21 -0
- package/dist-server/service/accounting-category/event-subscriber.js.map +1 -0
- package/dist-server/service/accounting-category/index.d.ts +2 -1
- package/dist-server/service/accounting-category/index.js +4 -2
- package/dist-server/service/accounting-category/index.js.map +1 -1
- package/dist-server/service/accounting-document/accounting-document-history.d.ts +26 -0
- package/dist-server/service/accounting-document/accounting-document-history.js +129 -0
- package/dist-server/service/accounting-document/accounting-document-history.js.map +1 -0
- package/dist-server/service/accounting-document/accounting-document-mutation.d.ts +10 -0
- package/dist-server/service/accounting-document/accounting-document-mutation.js +128 -0
- package/dist-server/service/accounting-document/accounting-document-mutation.js.map +1 -0
- package/dist-server/service/accounting-document/accounting-document-query.d.ts +11 -0
- package/dist-server/service/accounting-document/accounting-document-query.js +79 -0
- package/dist-server/service/accounting-document/accounting-document-query.js.map +1 -0
- package/dist-server/service/accounting-document/accounting-document-type.d.ts +20 -0
- package/dist-server/service/accounting-document/accounting-document-type.js +74 -0
- package/dist-server/service/accounting-document/accounting-document-type.js.map +1 -0
- package/dist-server/service/accounting-document/accounting-document.d.ts +21 -0
- package/dist-server/service/accounting-document/accounting-document.js +104 -0
- package/dist-server/service/accounting-document/accounting-document.js.map +1 -0
- package/dist-server/service/accounting-document/event-subscriber.d.ts +7 -0
- package/dist-server/service/accounting-document/event-subscriber.js +21 -0
- package/dist-server/service/accounting-document/event-subscriber.js.map +1 -0
- package/dist-server/service/accounting-document/index.d.ts +7 -0
- package/dist-server/service/accounting-document/index.js +12 -0
- package/dist-server/service/accounting-document/index.js.map +1 -0
- package/dist-server/service/financial-statement/financial-statement-history.d.ts +9 -6
- package/dist-server/service/financial-statement/financial-statement-history.js +30 -20
- package/dist-server/service/financial-statement/financial-statement-history.js.map +1 -1
- package/dist-server/service/financial-statement/financial-statement-line-item.d.ts +19 -0
- package/dist-server/service/financial-statement/financial-statement-line-item.js +94 -0
- package/dist-server/service/financial-statement/financial-statement-line-item.js.map +1 -0
- package/dist-server/service/financial-statement/financial-statement-mutation.js +12 -8
- package/dist-server/service/financial-statement/financial-statement-mutation.js.map +1 -1
- package/dist-server/service/financial-statement/financial-statement-query.js +2 -0
- package/dist-server/service/financial-statement/financial-statement-query.js.map +1 -1
- package/dist-server/service/financial-statement/financial-statement.d.ts +2 -0
- package/dist-server/service/financial-statement/financial-statement.js +45 -24
- package/dist-server/service/financial-statement/financial-statement.js.map +1 -1
- package/dist-server/service/financial-statement/index.d.ts +2 -2
- package/dist-server/service/financial-statement/index.js +2 -1
- package/dist-server/service/financial-statement/index.js.map +1 -1
- package/dist-server/service/fiscal-month/fiscal-month-mutation.js +6 -0
- package/dist-server/service/fiscal-month/fiscal-month-mutation.js.map +1 -1
- package/dist-server/service/fiscal-month/fiscal-month-query.js +2 -0
- package/dist-server/service/fiscal-month/fiscal-month-query.js.map +1 -1
- package/dist-server/service/fiscal-month/fiscal-month.js +1 -1
- package/dist-server/service/fiscal-month/fiscal-month.js.map +1 -1
- package/dist-server/service/fiscal-quarter/fiscal-quarter-mutation.js +6 -0
- package/dist-server/service/fiscal-quarter/fiscal-quarter-mutation.js.map +1 -1
- package/dist-server/service/fiscal-quarter/fiscal-quarter-query.js +2 -0
- package/dist-server/service/fiscal-quarter/fiscal-quarter-query.js.map +1 -1
- package/dist-server/service/fiscal-quarter/fiscal-quarter.js +1 -1
- package/dist-server/service/fiscal-quarter/fiscal-quarter.js.map +1 -1
- package/dist-server/service/fiscal-year/fiscal-year-mutation.js +6 -0
- package/dist-server/service/fiscal-year/fiscal-year-mutation.js.map +1 -1
- package/dist-server/service/fiscal-year/fiscal-year-query.js +2 -0
- package/dist-server/service/fiscal-year/fiscal-year-query.js.map +1 -1
- package/dist-server/service/fiscal-year/fiscal-year.js +1 -1
- package/dist-server/service/fiscal-year/fiscal-year.js.map +1 -1
- package/dist-server/service/income-statement/income-statement-history.d.ts +9 -5
- package/dist-server/service/income-statement/income-statement-history.js +35 -20
- package/dist-server/service/income-statement/income-statement-history.js.map +1 -1
- package/dist-server/service/income-statement/income-statement-line-item.d.ts +19 -0
- package/dist-server/service/income-statement/income-statement-line-item.js +96 -0
- package/dist-server/service/income-statement/income-statement-line-item.js.map +1 -0
- package/dist-server/service/income-statement/income-statement-mutation.js +12 -8
- package/dist-server/service/income-statement/income-statement-mutation.js.map +1 -1
- package/dist-server/service/income-statement/income-statement-query.js +2 -0
- package/dist-server/service/income-statement/income-statement-query.js.map +1 -1
- package/dist-server/service/income-statement/income-statement.d.ts +2 -0
- package/dist-server/service/income-statement/income-statement.js +46 -26
- package/dist-server/service/income-statement/income-statement.js.map +1 -1
- package/dist-server/service/income-statement/index.d.ts +2 -2
- package/dist-server/service/income-statement/index.js +2 -1
- package/dist-server/service/income-statement/index.js.map +1 -1
- package/dist-server/service/index.d.ts +4 -2
- package/dist-server/service/index.js +10 -0
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/payment/event-subscriber.d.ts +7 -0
- package/dist-server/service/payment/event-subscriber.js +21 -0
- package/dist-server/service/payment/event-subscriber.js.map +1 -0
- package/dist-server/service/payment/index.d.ts +8 -0
- package/dist-server/service/payment/index.js +12 -0
- package/dist-server/service/payment/index.js.map +1 -0
- package/dist-server/service/payment/payment-history.d.ts +30 -0
- package/dist-server/service/payment/payment-history.js +143 -0
- package/dist-server/service/payment/payment-history.js.map +1 -0
- package/dist-server/service/payment/payment-mutation.d.ts +10 -0
- package/dist-server/service/payment/payment-mutation.js +134 -0
- package/dist-server/service/payment/payment-mutation.js.map +1 -0
- package/dist-server/service/payment/payment-query.d.ts +11 -0
- package/dist-server/service/payment/payment-query.js +81 -0
- package/dist-server/service/payment/payment-query.js.map +1 -0
- package/dist-server/service/payment/payment-type.d.ts +24 -0
- package/dist-server/service/payment/payment-type.js +90 -0
- package/dist-server/service/payment/payment-type.js.map +1 -0
- package/dist-server/service/payment/payment.d.ts +30 -0
- package/dist-server/service/payment/payment.js +146 -0
- package/dist-server/service/payment/payment.js.map +1 -0
- package/dist-server/service/transaction/index.d.ts +2 -1
- package/dist-server/service/transaction/transaction-history.d.ts +6 -2
- package/dist-server/service/transaction/transaction-history.js +28 -9
- package/dist-server/service/transaction/transaction-history.js.map +1 -1
- package/dist-server/service/transaction/transaction-mutation.js +13 -9
- package/dist-server/service/transaction/transaction-mutation.js.map +1 -1
- package/dist-server/service/transaction/transaction-query.js +2 -0
- package/dist-server/service/transaction/transaction-query.js.map +1 -1
- package/dist-server/service/transaction/transaction.d.ts +28 -6
- package/dist-server/service/transaction/transaction.js +119 -31
- package/dist-server/service/transaction/transaction.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/helps/accounting/accounting-document.md +160 -0
- package/helps/accounting/contract.md +160 -0
- package/helps/accounting/payment.md +160 -0
- package/package.json +5 -5
- package/server/activities/activity-book.ts +31 -19
- package/server/controllers/summary-statements.ts +13 -7
- package/server/index.ts +1 -0
- package/server/migrations/1725200507196-seed-fiscal-entities.ts +3 -3
- package/server/migrations/1725201467183-seed-accounts.ts +31 -31
- package/server/routes.ts +0 -2
- package/server/service/account/account-history.ts +14 -6
- package/server/service/account/account-mutation.ts +13 -10
- package/server/service/account/account-query.ts +2 -0
- package/server/service/account/account.ts +15 -4
- package/server/service/accounting-category/accounting-category-history.ts +123 -0
- package/server/service/accounting-category/accounting-category-mutation.ts +12 -9
- package/server/service/accounting-category/accounting-category-query.ts +23 -0
- package/server/service/accounting-category/accounting-category.ts +14 -3
- package/server/service/accounting-category/event-subscriber.ts +20 -0
- package/server/service/accounting-category/index.ts +4 -2
- package/server/service/accounting-document/accounting-document-history.ts +117 -0
- package/server/service/accounting-document/accounting-document-mutation.ts +137 -0
- package/server/service/accounting-document/accounting-document-query.ts +48 -0
- package/server/service/accounting-document/accounting-document-type.ts +52 -0
- package/server/service/accounting-document/accounting-document.ts +93 -0
- package/server/service/accounting-document/event-subscriber.ts +17 -0
- package/server/service/accounting-document/index.ts +9 -0
- package/server/service/financial-statement/financial-statement-history.ts +27 -18
- package/server/service/financial-statement/financial-statement-line-item.ts +82 -0
- package/server/service/financial-statement/financial-statement-mutation.ts +12 -9
- package/server/service/financial-statement/financial-statement-query.ts +2 -0
- package/server/service/financial-statement/financial-statement.ts +52 -36
- package/server/service/financial-statement/index.ts +2 -1
- package/server/service/fiscal-month/fiscal-month-mutation.ts +10 -2
- package/server/service/fiscal-month/fiscal-month-query.ts +3 -1
- package/server/service/fiscal-month/fiscal-month.ts +1 -1
- package/server/service/fiscal-quarter/fiscal-quarter-mutation.ts +14 -3
- package/server/service/fiscal-quarter/fiscal-quarter-query.ts +2 -0
- package/server/service/fiscal-quarter/fiscal-quarter.ts +1 -1
- package/server/service/fiscal-year/fiscal-year-mutation.ts +10 -2
- package/server/service/fiscal-year/fiscal-year-query.ts +2 -0
- package/server/service/fiscal-year/fiscal-year.ts +1 -1
- package/server/service/income-statement/income-statement-history.ts +30 -17
- package/server/service/income-statement/income-statement-line-item.ts +84 -0
- package/server/service/income-statement/income-statement-mutation.ts +12 -10
- package/server/service/income-statement/income-statement-query.ts +2 -0
- package/server/service/income-statement/income-statement.ts +54 -39
- package/server/service/income-statement/index.ts +2 -1
- package/server/service/index.ts +18 -0
- package/server/service/payment/event-subscriber.ts +17 -0
- package/server/service/payment/index.ts +9 -0
- package/server/service/payment/payment-history.ts +126 -0
- package/server/service/payment/payment-mutation.ts +139 -0
- package/server/service/payment/payment-query.ts +50 -0
- package/server/service/payment/payment-type.ts +64 -0
- package/server/service/payment/payment.ts +123 -0
- package/server/service/transaction/transaction-history.ts +24 -8
- package/server/service/transaction/transaction-mutation.ts +13 -10
- package/server/service/transaction/transaction-query.ts +2 -0
- package/server/service/transaction/transaction.ts +130 -34
- package/things-factory.config.js +0 -1
- package/translations/en.json +9 -1
- package/translations/ja.json +9 -1
- package/translations/ko.json +9 -1
- package/translations/ms.json +9 -1
- package/translations/zh.json +9 -1
- package/client/pages/main.ts +0 -24
- package/dist-client/pages/ledger/ledger-importer.js.map +0 -1
- package/dist-client/pages/ledger/ledger-list-page.js.map +0 -1
- package/dist-client/pages/main.d.ts +0 -1
- package/dist-client/pages/main.js +0 -27
- package/dist-client/pages/main.js.map +0 -1
@@ -145,31 +145,31 @@ export class SeedAccounts1725201467183 implements MigrationInterface {
|
|
145
145
|
const accounts = [
|
146
146
|
// 유동자산 계정
|
147
147
|
{
|
148
|
-
|
148
|
+
code: '101',
|
149
149
|
name: '현금 및 현금성 자산',
|
150
150
|
description: '현금, 예금 및 기타 현금성 자산',
|
151
151
|
category: subCategories.유동자산
|
152
152
|
},
|
153
153
|
{
|
154
|
-
|
154
|
+
code: '102',
|
155
155
|
name: '매출채권',
|
156
156
|
description: '상품 또는 서비스의 판매로 인해 발생한 채권',
|
157
157
|
category: subCategories.유동자산
|
158
158
|
},
|
159
159
|
{
|
160
|
-
|
160
|
+
code: '103',
|
161
161
|
name: '재고자산',
|
162
162
|
description: '판매를 목적으로 보유한 상품, 제품, 원재료 등',
|
163
163
|
category: subCategories.유동자산
|
164
164
|
},
|
165
165
|
{
|
166
|
-
|
166
|
+
code: '104',
|
167
167
|
name: '단기금융상품',
|
168
168
|
description: '단기투자 목적으로 보유한 금융상품',
|
169
169
|
category: subCategories.유동자산
|
170
170
|
},
|
171
171
|
{
|
172
|
-
|
172
|
+
code: '105',
|
173
173
|
name: '선급금',
|
174
174
|
description: '상품, 서비스 제공을 위해 미리 지급한 금액',
|
175
175
|
category: subCategories.유동자산
|
@@ -177,25 +177,25 @@ export class SeedAccounts1725201467183 implements MigrationInterface {
|
|
177
177
|
|
178
178
|
// 비유동자산 계정
|
179
179
|
{
|
180
|
-
|
180
|
+
code: '201',
|
181
181
|
name: '건물',
|
182
182
|
description: '기업이 소유한 건물',
|
183
183
|
category: furtherSubCategories.유형자산
|
184
184
|
},
|
185
185
|
{
|
186
|
-
|
186
|
+
code: '202',
|
187
187
|
name: '토지',
|
188
188
|
description: '기업이 소유한 토지',
|
189
189
|
category: furtherSubCategories.유형자산
|
190
190
|
},
|
191
191
|
{
|
192
|
-
|
192
|
+
code: '203',
|
193
193
|
name: '기계장치',
|
194
194
|
description: '생산을 위해 사용되는 기계 및 장치',
|
195
195
|
category: furtherSubCategories.유형자산
|
196
196
|
},
|
197
197
|
{
|
198
|
-
|
198
|
+
code: '204',
|
199
199
|
name: '무형자산',
|
200
200
|
description: '특허권, 상표권 등의 무형자산',
|
201
201
|
category: furtherSubCategories.무형자산
|
@@ -203,70 +203,70 @@ export class SeedAccounts1725201467183 implements MigrationInterface {
|
|
203
203
|
|
204
204
|
// 유동부채 계정
|
205
205
|
{
|
206
|
-
|
206
|
+
code: '301',
|
207
207
|
name: '매입채무',
|
208
208
|
description: '상품 또는 서비스의 구매로 인해 발생한 채무',
|
209
209
|
category: subCategories.유동부채
|
210
210
|
},
|
211
211
|
{
|
212
|
-
|
212
|
+
code: '302',
|
213
213
|
name: '단기차입금',
|
214
214
|
description: '단기 대출금',
|
215
215
|
category: furtherSubCategories.단기금융부채
|
216
216
|
},
|
217
217
|
{
|
218
|
-
|
218
|
+
code: '303',
|
219
219
|
name: '미지급금',
|
220
220
|
description: '이미 발생한 비용에 대한 지급할 금액',
|
221
221
|
category: subCategories.유동부채
|
222
222
|
},
|
223
223
|
{
|
224
|
-
|
224
|
+
code: '304',
|
225
225
|
name: '선수금',
|
226
226
|
description: '고객으로부터 미리 받은 금액',
|
227
227
|
category: subCategories.유동부채
|
228
228
|
},
|
229
229
|
|
230
230
|
// 비유동부채 계정
|
231
|
-
{
|
231
|
+
{ code: '401', name: '장기차입금', description: '장기 대출금', category: subCategories.비유동부채 },
|
232
232
|
{
|
233
|
-
|
233
|
+
code: '402',
|
234
234
|
name: '퇴직급여충당부채',
|
235
235
|
description: '퇴직급여 지급을 위해 설정한 부채',
|
236
236
|
category: subCategories.비유동부채
|
237
237
|
},
|
238
238
|
|
239
239
|
// 자본 계정
|
240
|
-
{
|
241
|
-
{
|
240
|
+
{ code: '501', name: '자본금', description: '주주가 납입한 자본', category: topLevelCategories.자본 },
|
241
|
+
{ code: '502', name: '이익잉여금', description: '이익의 축적', category: topLevelCategories.자본 },
|
242
242
|
|
243
243
|
// 수익 계정
|
244
244
|
{
|
245
|
-
|
245
|
+
code: '601',
|
246
246
|
name: '제품매출',
|
247
247
|
description: '제품의 판매로 인한 수익',
|
248
248
|
category: topLevelCategories.수익
|
249
249
|
},
|
250
250
|
{
|
251
|
-
|
251
|
+
code: '602',
|
252
252
|
name: '상품매출',
|
253
253
|
description: '상품의 판매로 인한 수익',
|
254
254
|
category: topLevelCategories.수익
|
255
255
|
},
|
256
256
|
{
|
257
|
-
|
257
|
+
code: '603',
|
258
258
|
name: '용역매출',
|
259
259
|
description: '용역 제공으로 인한 수익',
|
260
260
|
category: topLevelCategories.수익
|
261
261
|
},
|
262
262
|
{
|
263
|
-
|
263
|
+
code: '604',
|
264
264
|
name: '이자수익',
|
265
265
|
description: '금융 자산에서 발생한 이자수익',
|
266
266
|
category: topLevelCategories.수익
|
267
267
|
},
|
268
268
|
{
|
269
|
-
|
269
|
+
code: '605',
|
270
270
|
name: '배당금수익',
|
271
271
|
description: '주식 투자로 인한 배당금 수익',
|
272
272
|
category: topLevelCategories.수익
|
@@ -274,32 +274,32 @@ export class SeedAccounts1725201467183 implements MigrationInterface {
|
|
274
274
|
|
275
275
|
// 비용 계정
|
276
276
|
{
|
277
|
-
|
277
|
+
code: '701',
|
278
278
|
name: '매출원가',
|
279
279
|
description: '제품, 상품, 용역 제공에 대한 원가',
|
280
280
|
category: topLevelCategories.비용
|
281
281
|
},
|
282
|
-
{
|
283
|
-
{
|
282
|
+
{ code: '702', name: '급여', description: '직원 급여 비용', category: topLevelCategories.비용 },
|
283
|
+
{ code: '703', name: '임대료', description: '건물 및 설비 임차료', category: topLevelCategories.비용 },
|
284
284
|
{
|
285
|
-
|
285
|
+
code: '704',
|
286
286
|
name: '감가상각비',
|
287
287
|
description: '유형자산의 감가상각비용',
|
288
288
|
category: topLevelCategories.비용
|
289
289
|
},
|
290
290
|
{
|
291
|
-
|
291
|
+
code: '705',
|
292
292
|
name: '이자비용',
|
293
293
|
description: '차입금에 대한 이자비용',
|
294
294
|
category: topLevelCategories.비용
|
295
295
|
},
|
296
296
|
{
|
297
|
-
|
297
|
+
code: '706',
|
298
298
|
name: '판매비 및 관리비',
|
299
299
|
description: '기업 운영에 필요한 비용',
|
300
300
|
category: topLevelCategories.비용
|
301
301
|
},
|
302
|
-
{
|
302
|
+
{ code: '707', name: '법인세비용', description: '법인세 납부 비용', category: topLevelCategories.비용 }
|
303
303
|
]
|
304
304
|
|
305
305
|
// 계정 저장
|
@@ -331,9 +331,9 @@ export class SeedAccounts1725201467183 implements MigrationInterface {
|
|
331
331
|
}
|
332
332
|
|
333
333
|
// Accounts 삭제
|
334
|
-
await accountRepository.
|
334
|
+
await accountRepository.softDelete({ domain: { id: domain.id } })
|
335
335
|
|
336
336
|
// AccountingCategories 삭제
|
337
|
-
await accountingCategoryRepository.
|
337
|
+
await accountingCategoryRepository.softDelete({ domain: { id: domain.id } })
|
338
338
|
}
|
339
339
|
}
|
package/server/routes.ts
CHANGED
@@ -12,6 +12,7 @@ import { config } from '@things-factory/env'
|
|
12
12
|
import { Domain } from '@things-factory/shell'
|
13
13
|
|
14
14
|
import { Account } from './account'
|
15
|
+
import { AccountingCategory } from '../accounting-category/accounting-category'
|
15
16
|
|
16
17
|
const ORMCONFIG = config.get('ormconfig', {})
|
17
18
|
const DATABASE_TYPE = ORMCONFIG.type
|
@@ -41,12 +42,12 @@ export class AccountHistory implements HistoryEntityInterface<Account> {
|
|
41
42
|
@Field({ nullable: true })
|
42
43
|
domain?: Domain
|
43
44
|
|
44
|
-
@RelationId((
|
45
|
+
@RelationId((accountHistory: AccountHistory) => accountHistory.domain)
|
45
46
|
domainId?: string
|
46
47
|
|
47
48
|
@Column({ nullable: true })
|
48
49
|
@Field({ nullable: true })
|
49
|
-
|
50
|
+
code?: string
|
50
51
|
|
51
52
|
@Column({ nullable: true })
|
52
53
|
@Field({ nullable: true })
|
@@ -60,6 +61,13 @@ export class AccountHistory implements HistoryEntityInterface<Account> {
|
|
60
61
|
@Field({ nullable: true })
|
61
62
|
active?: boolean
|
62
63
|
|
64
|
+
@ManyToOne(type => AccountingCategory)
|
65
|
+
@Field(type => AccountingCategory, { nullable: true })
|
66
|
+
category?: AccountingCategory
|
67
|
+
|
68
|
+
@RelationId((accountHistory: AccountHistory) => accountHistory.category)
|
69
|
+
categoryId?: string
|
70
|
+
|
63
71
|
@Column({ nullable: true })
|
64
72
|
@Field({ nullable: true })
|
65
73
|
createdAt?: Date
|
@@ -76,14 +84,14 @@ export class AccountHistory implements HistoryEntityInterface<Account> {
|
|
76
84
|
@Field({ nullable: true })
|
77
85
|
creator?: User
|
78
86
|
|
79
|
-
@RelationId((
|
87
|
+
@RelationId((accountHistory: AccountHistory) => accountHistory.creator)
|
80
88
|
creatorId?: string
|
81
89
|
|
82
90
|
@ManyToOne(type => User, { nullable: true })
|
83
91
|
@Field({ nullable: true })
|
84
92
|
updater?: User
|
85
93
|
|
86
|
-
@RelationId((
|
94
|
+
@RelationId((accountHistory: AccountHistory) => accountHistory.updater)
|
87
95
|
updaterId?: string
|
88
96
|
|
89
97
|
@HistoryOriginalIdColumn()
|
@@ -95,8 +103,8 @@ export class AccountHistory implements HistoryEntityInterface<Account> {
|
|
95
103
|
DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
|
96
104
|
? 'enum'
|
97
105
|
: DATABASE_TYPE == 'oracle'
|
98
|
-
|
99
|
-
|
106
|
+
? 'varchar2'
|
107
|
+
: 'smallint',
|
100
108
|
enum: HistoryActionType
|
101
109
|
})
|
102
110
|
public action!: HistoryActionType
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
|
2
2
|
import { In } from 'typeorm'
|
3
3
|
|
4
|
-
import {
|
4
|
+
import { getRepository } from '@things-factory/shell'
|
5
5
|
|
6
6
|
import { Account } from './account'
|
7
7
|
import { NewAccount, AccountPatch } from './account-type'
|
@@ -9,11 +9,12 @@ import { NewAccount, AccountPatch } from './account-type'
|
|
9
9
|
@Resolver(Account)
|
10
10
|
export class AccountMutation {
|
11
11
|
@Directive('@transaction')
|
12
|
+
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
12
13
|
@Mutation(returns => Account, { description: 'To create new Account' })
|
13
14
|
async createAccount(@Arg('account') account: NewAccount, @Ctx() context: ResolverContext): Promise<Account> {
|
14
15
|
const { domain, user, tx } = context.state
|
15
16
|
|
16
|
-
const result = await
|
17
|
+
const result = await getRepository(Account, tx).save({
|
17
18
|
...account,
|
18
19
|
domain,
|
19
20
|
creator: user,
|
@@ -24,6 +25,7 @@ export class AccountMutation {
|
|
24
25
|
}
|
25
26
|
|
26
27
|
@Directive('@transaction')
|
28
|
+
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
27
29
|
@Mutation(returns => Account, { description: 'To modify Account information' })
|
28
30
|
async updateAccount(
|
29
31
|
@Arg('id') id: string,
|
@@ -32,7 +34,7 @@ export class AccountMutation {
|
|
32
34
|
): Promise<Account> {
|
33
35
|
const { domain, user, tx } = context.state
|
34
36
|
|
35
|
-
const repository =
|
37
|
+
const repository = getRepository(Account, tx)
|
36
38
|
const account = await repository.findOne({
|
37
39
|
where: { domain: { id: domain.id }, id }
|
38
40
|
})
|
@@ -47,6 +49,7 @@ export class AccountMutation {
|
|
47
49
|
}
|
48
50
|
|
49
51
|
@Directive('@transaction')
|
52
|
+
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
50
53
|
@Mutation(returns => [Account], { description: "To modify multiple Accounts' information" })
|
51
54
|
async updateMultipleAccount(
|
52
55
|
@Arg('patches', type => [AccountPatch]) patches: AccountPatch[],
|
@@ -57,7 +60,7 @@ export class AccountMutation {
|
|
57
60
|
let results = []
|
58
61
|
const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
|
59
62
|
const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
|
60
|
-
const accountRepo =
|
63
|
+
const accountRepo = getRepository(Account, tx)
|
61
64
|
|
62
65
|
if (_createRecords.length > 0) {
|
63
66
|
for (let i = 0; i < _createRecords.length; i++) {
|
@@ -93,32 +96,32 @@ export class AccountMutation {
|
|
93
96
|
}
|
94
97
|
|
95
98
|
@Directive('@transaction')
|
99
|
+
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
96
100
|
@Mutation(returns => Boolean, { description: 'To delete Account' })
|
97
101
|
async deleteAccount(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
|
98
102
|
const { domain, tx } = context.state
|
99
103
|
|
100
|
-
await
|
101
|
-
await deleteAttachmentsByRef(null, { refBys: [id] }, context)
|
104
|
+
await getRepository(Account, tx).delete({ domain: { id: domain.id }, id })
|
102
105
|
|
103
106
|
return true
|
104
107
|
}
|
105
108
|
|
106
109
|
@Directive('@transaction')
|
110
|
+
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
107
111
|
@Mutation(returns => Boolean, { description: 'To delete multiple Accounts' })
|
108
112
|
async deleteAccounts(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<boolean> {
|
109
113
|
const { domain, tx } = context.state
|
110
114
|
|
111
|
-
await
|
115
|
+
await getRepository(Account, tx).delete({
|
112
116
|
domain: { id: domain.id },
|
113
117
|
id: In(ids)
|
114
118
|
})
|
115
119
|
|
116
|
-
await deleteAttachmentsByRef(null, { refBys: ids }, context)
|
117
|
-
|
118
120
|
return true
|
119
121
|
}
|
120
122
|
|
121
123
|
@Directive('@transaction')
|
124
|
+
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
122
125
|
@Mutation(returns => Boolean, { description: 'To import multiple Accounts' })
|
123
126
|
async importAccounts(
|
124
127
|
@Arg('accounts', type => [AccountPatch]) accounts: AccountPatch[],
|
@@ -128,7 +131,7 @@ export class AccountMutation {
|
|
128
131
|
|
129
132
|
await Promise.all(
|
130
133
|
accounts.map(async (account: AccountPatch) => {
|
131
|
-
const createdAccount: Account = await
|
134
|
+
const createdAccount: Account = await getRepository(Account, tx).save({ domain, ...account })
|
132
135
|
})
|
133
136
|
)
|
134
137
|
|
@@ -7,6 +7,7 @@ import { AccountList } from './account-type'
|
|
7
7
|
|
8
8
|
@Resolver(Account)
|
9
9
|
export class AccountQuery {
|
10
|
+
@Directive('@privilege(category: "accounting", privilege: "query")')
|
10
11
|
@Query(returns => Account!, { nullable: true, description: 'To fetch a Account' })
|
11
12
|
async account(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Account> {
|
12
13
|
const { domain } = context.state
|
@@ -16,6 +17,7 @@ export class AccountQuery {
|
|
16
17
|
})
|
17
18
|
}
|
18
19
|
|
20
|
+
@Directive('@privilege(category: "accounting", privilege: "query")')
|
19
21
|
@Query(returns => AccountList, { description: 'To fetch multiple Accounts' })
|
20
22
|
async accounts(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<AccountList> {
|
21
23
|
const { domain } = context.state
|
@@ -17,7 +17,18 @@ import { User } from '@things-factory/auth-base'
|
|
17
17
|
import { AccountingCategory } from '../accounting-category/accounting-category'
|
18
18
|
|
19
19
|
@Entity()
|
20
|
-
@Index('ix_account_0', (account: Account) => [account.domain, account.name
|
20
|
+
@Index('ix_account_0', (account: Account) => [account.domain, account.name], {
|
21
|
+
unique: true,
|
22
|
+
where: '"deleted_at" IS NULL'
|
23
|
+
})
|
24
|
+
@Index('ix_account_1', (account: Account) => [account.domain, account.code], {
|
25
|
+
unique: true,
|
26
|
+
where: '"deleted_at" IS NULL'
|
27
|
+
})
|
28
|
+
@Index('ix_account_2', (account: Account) => [account.domain, account.category], {
|
29
|
+
unique: false,
|
30
|
+
where: '"deleted_at" IS NULL'
|
31
|
+
})
|
21
32
|
@ObjectType({ description: 'Entity for Account' })
|
22
33
|
export class Account {
|
23
34
|
@PrimaryGeneratedColumn('uuid')
|
@@ -36,8 +47,8 @@ export class Account {
|
|
36
47
|
domainId?: string
|
37
48
|
|
38
49
|
@Column()
|
39
|
-
@Field({ nullable: true, description: 'Account
|
40
|
-
|
50
|
+
@Field({ nullable: true, description: 'Account code number' })
|
51
|
+
code?: string
|
41
52
|
|
42
53
|
@Column()
|
43
54
|
@Field({ nullable: true, description: 'Account name' })
|
@@ -51,7 +62,7 @@ export class Account {
|
|
51
62
|
@Field({ nullable: true })
|
52
63
|
active?: boolean
|
53
64
|
|
54
|
-
@
|
65
|
+
@ManyToOne(type => AccountingCategory)
|
55
66
|
@Field(type => AccountingCategory, { nullable: true })
|
56
67
|
category?: AccountingCategory
|
57
68
|
|
@@ -0,0 +1,123 @@
|
|
1
|
+
import { Field, ID, ObjectType } from 'type-graphql'
|
2
|
+
import { Entity, Index, Column, ManyToOne, RelationId, PrimaryGeneratedColumn, OneToMany } 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 { AccountingCategory } from './accounting-category'
|
15
|
+
|
16
|
+
const ORMCONFIG = config.get('ormconfig', {})
|
17
|
+
const DATABASE_TYPE = ORMCONFIG.type
|
18
|
+
|
19
|
+
@Entity()
|
20
|
+
@Index(
|
21
|
+
'ix_accounting_category_history_0',
|
22
|
+
(accountingCategoryHistory: AccountingCategoryHistory) => [
|
23
|
+
accountingCategoryHistory.originalId,
|
24
|
+
accountingCategoryHistory.version
|
25
|
+
],
|
26
|
+
{ unique: true }
|
27
|
+
)
|
28
|
+
@Index(
|
29
|
+
'ix_accounting_category_history_1',
|
30
|
+
(accountingCategoryHistory: AccountingCategoryHistory) => [
|
31
|
+
accountingCategoryHistory.domain,
|
32
|
+
accountingCategoryHistory.originalId,
|
33
|
+
accountingCategoryHistory.version
|
34
|
+
],
|
35
|
+
{ unique: true }
|
36
|
+
)
|
37
|
+
@ObjectType({ description: 'History Entity of Accounting Category' })
|
38
|
+
export class AccountingCategoryHistory implements HistoryEntityInterface<AccountingCategory> {
|
39
|
+
@PrimaryGeneratedColumn('uuid')
|
40
|
+
@Field(type => ID)
|
41
|
+
readonly id: string
|
42
|
+
|
43
|
+
@Column({ nullable: true, default: 1 })
|
44
|
+
@Field({ nullable: true })
|
45
|
+
version?: number = 1
|
46
|
+
|
47
|
+
@ManyToOne(type => Domain)
|
48
|
+
@Field({ nullable: true })
|
49
|
+
domain?: Domain
|
50
|
+
|
51
|
+
@RelationId((accountingCategoryHistory: AccountingCategoryHistory) => accountingCategoryHistory.domain)
|
52
|
+
domainId?: string
|
53
|
+
|
54
|
+
@Column()
|
55
|
+
@Field({ nullable: true, description: 'Account category code' })
|
56
|
+
code?: string
|
57
|
+
|
58
|
+
@Column()
|
59
|
+
@Field({ nullable: true })
|
60
|
+
name?: string
|
61
|
+
|
62
|
+
@Column({ nullable: true })
|
63
|
+
@Field({ nullable: true })
|
64
|
+
description?: string
|
65
|
+
|
66
|
+
@Column({ nullable: true })
|
67
|
+
@Field({ nullable: true })
|
68
|
+
active?: boolean
|
69
|
+
|
70
|
+
@ManyToOne(type => AccountingCategoryHistory, accountingCategoryHistory => accountingCategoryHistory.children, {
|
71
|
+
nullable: true
|
72
|
+
})
|
73
|
+
@Field({ nullable: true })
|
74
|
+
parent?: AccountingCategoryHistory
|
75
|
+
|
76
|
+
@RelationId((accountingCategoryHistory: AccountingCategoryHistory) => accountingCategoryHistory.parent)
|
77
|
+
parentId?: string
|
78
|
+
|
79
|
+
@OneToMany(type => AccountingCategoryHistory, accountingCategoryHistory => accountingCategoryHistory.parent)
|
80
|
+
@Field(type => [AccountingCategoryHistory])
|
81
|
+
children?: AccountingCategoryHistory[]
|
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((accountingCategory: AccountingCategoryHistory) => accountingCategory.creator)
|
100
|
+
creatorId?: string
|
101
|
+
|
102
|
+
@ManyToOne(type => User, { nullable: true })
|
103
|
+
@Field(type => User, { nullable: true })
|
104
|
+
updater?: User
|
105
|
+
|
106
|
+
@RelationId((accountingCategory: AccountingCategoryHistory) => accountingCategory.updater)
|
107
|
+
updaterId?: string
|
108
|
+
|
109
|
+
@HistoryOriginalIdColumn()
|
110
|
+
public originalId!: string
|
111
|
+
|
112
|
+
@HistoryActionColumn({
|
113
|
+
nullable: false,
|
114
|
+
type:
|
115
|
+
DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
|
116
|
+
? 'enum'
|
117
|
+
: DATABASE_TYPE == 'oracle'
|
118
|
+
? 'varchar2'
|
119
|
+
: 'smallint',
|
120
|
+
enum: HistoryActionType
|
121
|
+
})
|
122
|
+
public action!: HistoryActionType
|
123
|
+
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
|
2
2
|
import { In } from 'typeorm'
|
3
3
|
|
4
|
-
import {
|
4
|
+
import { getRepository } from '@things-factory/shell'
|
5
5
|
|
6
6
|
import { AccountingCategory } from './accounting-category'
|
7
7
|
import { NewAccountingCategory, AccountingCategoryPatch } from './accounting-category-type'
|
@@ -9,6 +9,7 @@ import { NewAccountingCategory, AccountingCategoryPatch } from './accounting-cat
|
|
9
9
|
@Resolver(AccountingCategory)
|
10
10
|
export class AccountingCategoryMutation {
|
11
11
|
@Directive('@transaction')
|
12
|
+
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
12
13
|
@Mutation(returns => AccountingCategory, { description: 'To create new AccountingCategory' })
|
13
14
|
async createAccountingCategory(
|
14
15
|
@Arg('accountingCategory') accountingCategory: NewAccountingCategory,
|
@@ -16,7 +17,7 @@ export class AccountingCategoryMutation {
|
|
16
17
|
): Promise<AccountingCategory> {
|
17
18
|
const { domain, user, tx } = context.state
|
18
19
|
|
19
|
-
const result = await
|
20
|
+
const result = await getRepository(AccountingCategory, tx).save({
|
20
21
|
...accountingCategory,
|
21
22
|
domain,
|
22
23
|
creator: user,
|
@@ -27,6 +28,7 @@ export class AccountingCategoryMutation {
|
|
27
28
|
}
|
28
29
|
|
29
30
|
@Directive('@transaction')
|
31
|
+
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
30
32
|
@Mutation(returns => AccountingCategory, { description: 'To modify AccountingCategory information' })
|
31
33
|
async updateAccountingCategory(
|
32
34
|
@Arg('id') id: string,
|
@@ -35,7 +37,7 @@ export class AccountingCategoryMutation {
|
|
35
37
|
): Promise<AccountingCategory> {
|
36
38
|
const { domain, user, tx } = context.state
|
37
39
|
|
38
|
-
const repository =
|
40
|
+
const repository = getRepository(AccountingCategory, tx)
|
39
41
|
const accountingCategory = await repository.findOne({
|
40
42
|
where: { domain: { id: domain.id }, id }
|
41
43
|
})
|
@@ -50,6 +52,7 @@ export class AccountingCategoryMutation {
|
|
50
52
|
}
|
51
53
|
|
52
54
|
@Directive('@transaction')
|
55
|
+
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
53
56
|
@Mutation(returns => [AccountingCategory], { description: "To modify multiple AccountingCategories' information" })
|
54
57
|
async updateMultipleAccountingCategory(
|
55
58
|
@Arg('patches', type => [AccountingCategoryPatch]) patches: AccountingCategoryPatch[],
|
@@ -60,7 +63,7 @@ export class AccountingCategoryMutation {
|
|
60
63
|
let results = []
|
61
64
|
const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')
|
62
65
|
const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')
|
63
|
-
const accountingCategoryRepo =
|
66
|
+
const accountingCategoryRepo = getRepository(AccountingCategory, tx)
|
64
67
|
|
65
68
|
if (_createRecords.length > 0) {
|
66
69
|
for (let i = 0; i < _createRecords.length; i++) {
|
@@ -96,17 +99,18 @@ export class AccountingCategoryMutation {
|
|
96
99
|
}
|
97
100
|
|
98
101
|
@Directive('@transaction')
|
102
|
+
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
99
103
|
@Mutation(returns => Boolean, { description: 'To delete AccountingCategory' })
|
100
104
|
async deleteAccountingCategory(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {
|
101
105
|
const { domain, tx } = context.state
|
102
106
|
|
103
|
-
await
|
104
|
-
await deleteAttachmentsByRef(null, { refBys: [id] }, context)
|
107
|
+
await getRepository(AccountingCategory, tx).delete({ domain: { id: domain.id }, id })
|
105
108
|
|
106
109
|
return true
|
107
110
|
}
|
108
111
|
|
109
112
|
@Directive('@transaction')
|
113
|
+
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
110
114
|
@Mutation(returns => Boolean, { description: 'To delete multiple AccountingCategories' })
|
111
115
|
async deleteAccountingCategories(
|
112
116
|
@Arg('ids', type => [String]) ids: string[],
|
@@ -114,17 +118,16 @@ export class AccountingCategoryMutation {
|
|
114
118
|
): Promise<boolean> {
|
115
119
|
const { domain, tx } = context.state
|
116
120
|
|
117
|
-
await
|
121
|
+
await getRepository(AccountingCategory, tx).delete({
|
118
122
|
domain: { id: domain.id },
|
119
123
|
id: In(ids)
|
120
124
|
})
|
121
125
|
|
122
|
-
await deleteAttachmentsByRef(null, { refBys: ids }, context)
|
123
|
-
|
124
126
|
return true
|
125
127
|
}
|
126
128
|
|
127
129
|
@Directive('@transaction')
|
130
|
+
@Directive('@privilege(category: "accounting", privilege: "mutation")')
|
128
131
|
@Mutation(returns => Boolean, { description: 'To import multiple AccountingCategories' })
|
129
132
|
async importAccountingCategories(
|
130
133
|
@Arg('accountingCategories', type => [AccountingCategoryPatch]) accountingCategories: AccountingCategoryPatch[],
|