@things-factory/accounting 10.1.140 → 10.1.142
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/dist-server/service/account/account-match.d.ts +32 -0
- package/dist-server/service/account/account-match.js +74 -0
- package/dist-server/service/account/account-match.js.map +1 -0
- package/dist-server/service/account/default-accounts-subscriber.d.ts +7 -0
- package/dist-server/service/account/default-accounts-subscriber.js +22 -0
- package/dist-server/service/account/default-accounts-subscriber.js.map +1 -0
- package/dist-server/service/account/default-accounts.d.ts +22 -0
- package/dist-server/service/account/default-accounts.js +92 -0
- package/dist-server/service/account/default-accounts.js.map +1 -0
- package/dist-server/service/account/index.d.ts +3 -2
- package/dist-server/service/account/index.js +2 -1
- package/dist-server/service/account/index.js.map +1 -1
- package/dist-server/service/accounting-category/index.d.ts +1 -1
- package/dist-server/service/accounting-document/index.d.ts +1 -1
- package/dist-server/service/bank-account/index.d.ts +1 -1
- package/dist-server/service/bank-statement/index.d.ts +1 -1
- package/dist-server/service/financial-institution/index.d.ts +1 -1
- package/dist-server/service/financial-statement/index.d.ts +2 -2
- package/dist-server/service/fiscal-month/index.d.ts +1 -1
- package/dist-server/service/fiscal-quarter/index.d.ts +1 -1
- package/dist-server/service/fiscal-year/index.d.ts +1 -1
- package/dist-server/service/index.d.ts +5 -2
- package/dist-server/service/index.js +3 -0
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/payment/document-targets.d.ts +16 -0
- package/dist-server/service/payment/document-targets.js +99 -0
- package/dist-server/service/payment/document-targets.js.map +1 -0
- package/dist-server/service/payment/payment-service.js +3 -0
- package/dist-server/service/payment/payment-service.js.map +1 -1
- package/dist-server/service/payment/payment-targets.d.ts +12 -0
- package/dist-server/service/payment/payment-targets.js +9 -0
- package/dist-server/service/payment/payment-targets.js.map +1 -1
- package/dist-server/service/transaction/transaction-query.js +13 -1
- package/dist-server/service/transaction/transaction-query.js.map +1 -1
- package/dist-server/service/transaction/transaction-service.js +2 -0
- package/dist-server/service/transaction/transaction-service.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -7
- package/translations/en.json +10 -1
- package/translations/ko.json +10 -1
- package/dist-server/migrations/1725201467183-seed-accounts.d.ts +0 -5
- package/dist-server/migrations/1725201467183-seed-accounts.js +0 -323
- package/dist-server/migrations/1725201467183-seed-accounts.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/accounting",
|
|
3
|
-
"version": "10.1.
|
|
3
|
+
"version": "10.1.142",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "dist-client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -32,14 +32,16 @@
|
|
|
32
32
|
"@material/web": "^2.0.0",
|
|
33
33
|
"@operato/graphql": "^10.0.0",
|
|
34
34
|
"@operato/shell": "^10.0.0",
|
|
35
|
-
"@things-factory/attachment-base": "^10.1.
|
|
36
|
-
"@things-factory/auth-base": "^10.1.
|
|
37
|
-
"@things-factory/biz-base": "^10.1.
|
|
38
|
-
"@things-factory/
|
|
39
|
-
"@things-factory/
|
|
35
|
+
"@things-factory/attachment-base": "^10.1.142",
|
|
36
|
+
"@things-factory/auth-base": "^10.1.142",
|
|
37
|
+
"@things-factory/biz-base": "^10.1.142",
|
|
38
|
+
"@things-factory/invoice": "^10.1.142",
|
|
39
|
+
"@things-factory/shell": "^10.1.142",
|
|
40
|
+
"@things-factory/tax-invoice": "^10.1.142",
|
|
41
|
+
"@things-factory/worklist": "^10.1.142",
|
|
40
42
|
"graphql-upload": "^15.0.2",
|
|
41
43
|
"moment-timezone": "^0.5.43",
|
|
42
44
|
"xlsx": "^0.18.5"
|
|
43
45
|
},
|
|
44
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "73522201151b0156168b0eeea15f2962cda0bd8f"
|
|
45
47
|
}
|
package/translations/en.json
CHANGED
|
@@ -51,5 +51,14 @@
|
|
|
51
51
|
"error.bank-total-mismatch": "The bank transaction total does not match",
|
|
52
52
|
"error.bank-file-too-large": "Upload a bank file smaller than 10MB",
|
|
53
53
|
"error.bank-account-not-registered": "Register the statement account and currency first",
|
|
54
|
-
"error.bank-assignment-invalid": "A held transaction can only be placed on one of its candidates, once."
|
|
54
|
+
"error.bank-assignment-invalid": "A held transaction can only be placed on one of its candidates, once.",
|
|
55
|
+
"error.tax-invoice-not-found": "The tax invoice was not found. Reload and try again.",
|
|
56
|
+
"error.invoice-payment-side": "A sales invoice links to a deposit, a purchase invoice to a withdrawal; a negative one the other way.",
|
|
57
|
+
"error.invoice-payment-over": "The linked amounts are more than the invoice.",
|
|
58
|
+
"error.tax-invoice-payment-side": "A sale links to a deposit, a purchase to a withdrawal; a corrective (negative) tax invoice the other way.",
|
|
59
|
+
"error.tax-invoice-payment-over": "The linked amounts are more than the tax invoice.",
|
|
60
|
+
"error.document-payment-same-currency": "In the document currency, the amount is said once.",
|
|
61
|
+
"error.document-payment-amount-required": "When the currencies differ, record what was paid in the document currency ({currency}).",
|
|
62
|
+
"error.document-payment-basis-required": "When the currencies differ, note the exchange rate or settlement basis.",
|
|
63
|
+
"error.document-payment-precision": "An amount has more decimals than its currency."
|
|
55
64
|
}
|
package/translations/ko.json
CHANGED
|
@@ -51,5 +51,14 @@
|
|
|
51
51
|
"error.bank-total-mismatch": "은행 파일의 거래 합계가 맞지 않습니다.",
|
|
52
52
|
"error.bank-file-too-large": "은행 파일은 10MB 이하로 올려주세요.",
|
|
53
53
|
"error.bank-account-not-registered": "{bank} {account} ({currency}) 계좌를 먼저 등록하세요.",
|
|
54
|
-
"error.bank-assignment-invalid": "보류된 거래는 그 후보 중 하나에만, 한 번씩 지정할 수 있습니다."
|
|
54
|
+
"error.bank-assignment-invalid": "보류된 거래는 그 후보 중 하나에만, 한 번씩 지정할 수 있습니다.",
|
|
55
|
+
"error.tax-invoice-not-found": "세금계산서를 찾을 수 없습니다. 다시 불러와야 합니다.",
|
|
56
|
+
"error.invoice-payment-side": "매출 청구서는 입금, 매입 청구서는 출금에 연결합니다. 음수 청구서는 반대입니다.",
|
|
57
|
+
"error.invoice-payment-over": "연결한 금액이 청구서 금액을 넘습니다.",
|
|
58
|
+
"error.tax-invoice-payment-side": "매출은 입금, 매입은 출금에 연결합니다. 수정(음수) 세금계산서는 반대입니다.",
|
|
59
|
+
"error.tax-invoice-payment-over": "연결한 금액이 세금계산서 금액을 넘습니다.",
|
|
60
|
+
"error.document-payment-same-currency": "통화가 같으면 문서 통화 금액을 따로 적지 않습니다.",
|
|
61
|
+
"error.document-payment-amount-required": "통화가 다르면 문서 통화({currency})로 얼마를 치렀는지 적으세요.",
|
|
62
|
+
"error.document-payment-basis-required": "통화가 다르면 환율이나 정산 근거를 비고에 적으세요.",
|
|
63
|
+
"error.document-payment-precision": "금액의 소수 자릿수를 통화에 맞추세요."
|
|
55
64
|
}
|
|
@@ -1,323 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SeedAccounts1725201467183 = void 0;
|
|
4
|
-
const shell_1 = require("@things-factory/shell");
|
|
5
|
-
const auth_base_1 = require("@things-factory/auth-base");
|
|
6
|
-
const account_1 = require("../service/account/account");
|
|
7
|
-
const accounting_category_1 = require("../service/accounting-category/accounting-category");
|
|
8
|
-
class SeedAccounts1725201467183 {
|
|
9
|
-
async up(queryRunner) {
|
|
10
|
-
const domainRepository = (0, shell_1.getRepository)(shell_1.Domain);
|
|
11
|
-
const userRepository = (0, shell_1.getRepository)(auth_base_1.User);
|
|
12
|
-
const accountingCategoryRepository = (0, shell_1.getRepository)(accounting_category_1.AccountingCategory);
|
|
13
|
-
const accountRepository = (0, shell_1.getRepository)(account_1.Account);
|
|
14
|
-
const domain = await domainRepository.findOne({
|
|
15
|
-
where: { name: 'SYSTEM' }
|
|
16
|
-
});
|
|
17
|
-
if (!domain) {
|
|
18
|
-
throw new Error('SYSTEM domain not found');
|
|
19
|
-
}
|
|
20
|
-
const user = await userRepository.findOne({ where: { id: domain.owner } });
|
|
21
|
-
if (!user) {
|
|
22
|
-
throw new Error('Domain owner not found');
|
|
23
|
-
}
|
|
24
|
-
try {
|
|
25
|
-
// 최상위 카테고리 생성
|
|
26
|
-
const topLevelCategories = {
|
|
27
|
-
자산: await accountingCategoryRepository.save({
|
|
28
|
-
domain,
|
|
29
|
-
code: 'ASSET',
|
|
30
|
-
name: '자산',
|
|
31
|
-
description: '기업이 소유하고 있는 자산',
|
|
32
|
-
creator: user,
|
|
33
|
-
updater: user
|
|
34
|
-
}),
|
|
35
|
-
부채: await accountingCategoryRepository.save({
|
|
36
|
-
domain,
|
|
37
|
-
code: 'LIABILITY',
|
|
38
|
-
name: '부채',
|
|
39
|
-
description: '기업이 갚아야 할 빚',
|
|
40
|
-
creator: user,
|
|
41
|
-
updater: user
|
|
42
|
-
}),
|
|
43
|
-
자본: await accountingCategoryRepository.save({
|
|
44
|
-
domain,
|
|
45
|
-
code: 'EQUITY',
|
|
46
|
-
name: '자본',
|
|
47
|
-
description: '기업 소유주의 자산',
|
|
48
|
-
creator: user,
|
|
49
|
-
updater: user
|
|
50
|
-
}),
|
|
51
|
-
수익: await accountingCategoryRepository.save({
|
|
52
|
-
domain,
|
|
53
|
-
code: 'REVENUE',
|
|
54
|
-
name: '수익',
|
|
55
|
-
description: '기업이 벌어들인 돈',
|
|
56
|
-
creator: user,
|
|
57
|
-
updater: user
|
|
58
|
-
}),
|
|
59
|
-
비용: await accountingCategoryRepository.save({
|
|
60
|
-
domain,
|
|
61
|
-
code: 'EXPENSE',
|
|
62
|
-
name: '비용',
|
|
63
|
-
description: '기업 운영에 사용된 돈',
|
|
64
|
-
creator: user,
|
|
65
|
-
updater: user
|
|
66
|
-
})
|
|
67
|
-
};
|
|
68
|
-
// 유동자산 및 비유동자산과 같은 하위 카테고리 생성
|
|
69
|
-
const subCategories = {
|
|
70
|
-
유동자산: await accountingCategoryRepository.save({
|
|
71
|
-
domain,
|
|
72
|
-
code: 'CURRENT_ASSET',
|
|
73
|
-
name: '유동자산',
|
|
74
|
-
description: '쉽게 현금화할 수 있는 자산',
|
|
75
|
-
parent: topLevelCategories.자산,
|
|
76
|
-
creator: user,
|
|
77
|
-
updater: user
|
|
78
|
-
}),
|
|
79
|
-
비유동자산: await accountingCategoryRepository.save({
|
|
80
|
-
domain,
|
|
81
|
-
code: 'NON_CURRENT_ASSET',
|
|
82
|
-
name: '비유동자산',
|
|
83
|
-
description: '장기 보유 자산',
|
|
84
|
-
parent: topLevelCategories.자산,
|
|
85
|
-
creator: user,
|
|
86
|
-
updater: user
|
|
87
|
-
}),
|
|
88
|
-
유동부채: await accountingCategoryRepository.save({
|
|
89
|
-
domain,
|
|
90
|
-
code: 'CURRENT_LIABILITY',
|
|
91
|
-
name: '유동부채',
|
|
92
|
-
description: '단기간에 상환해야 하는 부채',
|
|
93
|
-
parent: topLevelCategories.부채,
|
|
94
|
-
creator: user,
|
|
95
|
-
updater: user
|
|
96
|
-
}),
|
|
97
|
-
비유동부채: await accountingCategoryRepository.save({
|
|
98
|
-
domain,
|
|
99
|
-
code: 'NON_CURRENT_LIABILITY',
|
|
100
|
-
name: '비유동부채',
|
|
101
|
-
description: '장기 부채',
|
|
102
|
-
parent: topLevelCategories.부채,
|
|
103
|
-
creator: user,
|
|
104
|
-
updater: user
|
|
105
|
-
})
|
|
106
|
-
};
|
|
107
|
-
// 이제 유형자산, 무형자산, 단기금융부채 같은 하위 카테고리를 subCategories 객체를 사용하여 생성합니다.
|
|
108
|
-
const furtherSubCategories = {
|
|
109
|
-
유형자산: await accountingCategoryRepository.save({
|
|
110
|
-
domain,
|
|
111
|
-
code: 'TANGIBLE_ASSET',
|
|
112
|
-
name: '유형자산',
|
|
113
|
-
description: '물리적 형태가 있는 자산',
|
|
114
|
-
parent: subCategories.비유동자산,
|
|
115
|
-
creator: user,
|
|
116
|
-
updater: user
|
|
117
|
-
}),
|
|
118
|
-
무형자산: await accountingCategoryRepository.save({
|
|
119
|
-
domain,
|
|
120
|
-
code: 'INTANGIBLE_ASSET',
|
|
121
|
-
name: '무형자산',
|
|
122
|
-
description: '물리적 형태가 없는 자산',
|
|
123
|
-
parent: subCategories.비유동자산,
|
|
124
|
-
creator: user,
|
|
125
|
-
updater: user
|
|
126
|
-
}),
|
|
127
|
-
단기금융부채: await accountingCategoryRepository.save({
|
|
128
|
-
domain,
|
|
129
|
-
code: 'SHORT_TERM_FINANCIAL_LIABILITY',
|
|
130
|
-
name: '단기금융부채',
|
|
131
|
-
description: '단기적으로 갚아야 할 금융부채',
|
|
132
|
-
parent: subCategories.유동부채,
|
|
133
|
-
creator: user,
|
|
134
|
-
updater: user
|
|
135
|
-
})
|
|
136
|
-
};
|
|
137
|
-
// 계정 생성 및 하위 카테고리 연결
|
|
138
|
-
const accounts = [
|
|
139
|
-
// 유동자산 계정
|
|
140
|
-
{
|
|
141
|
-
code: '101',
|
|
142
|
-
name: '현금 및 현금성 자산',
|
|
143
|
-
description: '현금, 예금 및 기타 현금성 자산',
|
|
144
|
-
category: subCategories.유동자산
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
code: '102',
|
|
148
|
-
name: '매출채권',
|
|
149
|
-
description: '상품 또는 서비스의 판매로 인해 발생한 채권',
|
|
150
|
-
category: subCategories.유동자산
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
code: '103',
|
|
154
|
-
name: '재고자산',
|
|
155
|
-
description: '판매를 목적으로 보유한 상품, 제품, 원재료 등',
|
|
156
|
-
category: subCategories.유동자산
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
code: '104',
|
|
160
|
-
name: '단기금융상품',
|
|
161
|
-
description: '단기투자 목적으로 보유한 금융상품',
|
|
162
|
-
category: subCategories.유동자산
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
code: '105',
|
|
166
|
-
name: '선급금',
|
|
167
|
-
description: '상품, 서비스 제공을 위해 미리 지급한 금액',
|
|
168
|
-
category: subCategories.유동자산
|
|
169
|
-
},
|
|
170
|
-
// 비유동자산 계정
|
|
171
|
-
{
|
|
172
|
-
code: '201',
|
|
173
|
-
name: '건물',
|
|
174
|
-
description: '기업이 소유한 건물',
|
|
175
|
-
category: furtherSubCategories.유형자산
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
code: '202',
|
|
179
|
-
name: '토지',
|
|
180
|
-
description: '기업이 소유한 토지',
|
|
181
|
-
category: furtherSubCategories.유형자산
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
code: '203',
|
|
185
|
-
name: '기계장치',
|
|
186
|
-
description: '생산을 위해 사용되는 기계 및 장치',
|
|
187
|
-
category: furtherSubCategories.유형자산
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
code: '204',
|
|
191
|
-
name: '무형자산',
|
|
192
|
-
description: '특허권, 상표권 등의 무형자산',
|
|
193
|
-
category: furtherSubCategories.무형자산
|
|
194
|
-
},
|
|
195
|
-
// 유동부채 계정
|
|
196
|
-
{
|
|
197
|
-
code: '301',
|
|
198
|
-
name: '매입채무',
|
|
199
|
-
description: '상품 또는 서비스의 구매로 인해 발생한 채무',
|
|
200
|
-
category: subCategories.유동부채
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
code: '302',
|
|
204
|
-
name: '단기차입금',
|
|
205
|
-
description: '단기 대출금',
|
|
206
|
-
category: furtherSubCategories.단기금융부채
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
code: '303',
|
|
210
|
-
name: '미지급금',
|
|
211
|
-
description: '이미 발생한 비용에 대한 지급할 금액',
|
|
212
|
-
category: subCategories.유동부채
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
code: '304',
|
|
216
|
-
name: '선수금',
|
|
217
|
-
description: '고객으로부터 미리 받은 금액',
|
|
218
|
-
category: subCategories.유동부채
|
|
219
|
-
},
|
|
220
|
-
// 비유동부채 계정
|
|
221
|
-
{ code: '401', name: '장기차입금', description: '장기 대출금', category: subCategories.비유동부채 },
|
|
222
|
-
{
|
|
223
|
-
code: '402',
|
|
224
|
-
name: '퇴직급여충당부채',
|
|
225
|
-
description: '퇴직급여 지급을 위해 설정한 부채',
|
|
226
|
-
category: subCategories.비유동부채
|
|
227
|
-
},
|
|
228
|
-
// 자본 계정
|
|
229
|
-
{ code: '501', name: '자본금', description: '주주가 납입한 자본', category: topLevelCategories.자본 },
|
|
230
|
-
{ code: '502', name: '이익잉여금', description: '이익의 축적', category: topLevelCategories.자본 },
|
|
231
|
-
// 수익 계정
|
|
232
|
-
{
|
|
233
|
-
code: '601',
|
|
234
|
-
name: '제품매출',
|
|
235
|
-
description: '제품의 판매로 인한 수익',
|
|
236
|
-
category: topLevelCategories.수익
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
code: '602',
|
|
240
|
-
name: '상품매출',
|
|
241
|
-
description: '상품의 판매로 인한 수익',
|
|
242
|
-
category: topLevelCategories.수익
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
code: '603',
|
|
246
|
-
name: '용역매출',
|
|
247
|
-
description: '용역 제공으로 인한 수익',
|
|
248
|
-
category: topLevelCategories.수익
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
code: '604',
|
|
252
|
-
name: '이자수익',
|
|
253
|
-
description: '금융 자산에서 발생한 이자수익',
|
|
254
|
-
category: topLevelCategories.수익
|
|
255
|
-
},
|
|
256
|
-
{
|
|
257
|
-
code: '605',
|
|
258
|
-
name: '배당금수익',
|
|
259
|
-
description: '주식 투자로 인한 배당금 수익',
|
|
260
|
-
category: topLevelCategories.수익
|
|
261
|
-
},
|
|
262
|
-
// 비용 계정
|
|
263
|
-
{
|
|
264
|
-
code: '701',
|
|
265
|
-
name: '매출원가',
|
|
266
|
-
description: '제품, 상품, 용역 제공에 대한 원가',
|
|
267
|
-
category: topLevelCategories.비용
|
|
268
|
-
},
|
|
269
|
-
{ code: '702', name: '급여', description: '직원 급여 비용', category: topLevelCategories.비용 },
|
|
270
|
-
{ code: '703', name: '임대료', description: '건물 및 설비 임차료', category: topLevelCategories.비용 },
|
|
271
|
-
{
|
|
272
|
-
code: '704',
|
|
273
|
-
name: '감가상각비',
|
|
274
|
-
description: '유형자산의 감가상각비용',
|
|
275
|
-
category: topLevelCategories.비용
|
|
276
|
-
},
|
|
277
|
-
{
|
|
278
|
-
code: '705',
|
|
279
|
-
name: '이자비용',
|
|
280
|
-
description: '차입금에 대한 이자비용',
|
|
281
|
-
category: topLevelCategories.비용
|
|
282
|
-
},
|
|
283
|
-
{
|
|
284
|
-
code: '706',
|
|
285
|
-
name: '판매비 및 관리비',
|
|
286
|
-
description: '기업 운영에 필요한 비용',
|
|
287
|
-
category: topLevelCategories.비용
|
|
288
|
-
},
|
|
289
|
-
{ code: '707', name: '법인세비용', description: '법인세 납부 비용', category: topLevelCategories.비용 }
|
|
290
|
-
];
|
|
291
|
-
// 계정 저장
|
|
292
|
-
for (const account of accounts) {
|
|
293
|
-
await accountRepository.save({
|
|
294
|
-
domain,
|
|
295
|
-
...account,
|
|
296
|
-
creator: user,
|
|
297
|
-
updater: user
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
catch (error) {
|
|
302
|
-
console.error('Failed to seed accounting categories and accounts:', error);
|
|
303
|
-
throw error;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
async down(queryRunner) {
|
|
307
|
-
const domainRepository = (0, shell_1.getRepository)(shell_1.Domain);
|
|
308
|
-
const accountingCategoryRepository = (0, shell_1.getRepository)(accounting_category_1.AccountingCategory);
|
|
309
|
-
const accountRepository = (0, shell_1.getRepository)(account_1.Account);
|
|
310
|
-
const domain = await domainRepository.findOne({
|
|
311
|
-
where: { name: 'SYSTEM' }
|
|
312
|
-
});
|
|
313
|
-
if (!domain) {
|
|
314
|
-
throw new Error('SYSTEM domain not found');
|
|
315
|
-
}
|
|
316
|
-
// Accounts 삭제
|
|
317
|
-
await accountRepository.softDelete({ domain: { id: domain.id } });
|
|
318
|
-
// AccountingCategories 삭제
|
|
319
|
-
await accountingCategoryRepository.softDelete({ domain: { id: domain.id } });
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
exports.SeedAccounts1725201467183 = SeedAccounts1725201467183;
|
|
323
|
-
//# sourceMappingURL=1725201467183-seed-accounts.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"1725201467183-seed-accounts.js","sourceRoot":"","sources":["../../server/migrations/1725201467183-seed-accounts.ts"],"names":[],"mappings":";;;AACA,iDAA6D;AAC7D,yDAAgD;AAChD,wDAAoD;AACpD,4FAAuF;AAEvF,MAAa,yBAAyB;IAC7B,KAAK,CAAC,EAAE,CAAC,WAAwB;QACtC,MAAM,gBAAgB,GAAG,IAAA,qBAAa,EAAC,cAAM,CAAC,CAAA;QAC9C,MAAM,cAAc,GAAG,IAAA,qBAAa,EAAC,gBAAI,CAAC,CAAA;QAC1C,MAAM,4BAA4B,GAAG,IAAA,qBAAa,EAAC,wCAAkB,CAAC,CAAA;QACtE,MAAM,iBAAiB,GAAG,IAAA,qBAAa,EAAC,iBAAO,CAAC,CAAA;QAEhD,MAAM,MAAM,GAAkB,MAAM,gBAAgB,CAAC,OAAO,CAAC;YAC3D,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SAC1B,CAAC,CAAA;QAEF,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;QAC5C,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,cAAc,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;QAE1E,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAA;QAC3C,CAAC;QAED,IAAI,CAAC;YACH,cAAc;YACd,MAAM,kBAAkB,GAAG;g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AC,CAAA;QAEF,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;QAC5C,CAAC;QAED,cAAc;QACd,MAAM,iBAAiB,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAA;QAEjE,0BAA0B;QAC1B,MAAM,4BAA4B,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAA;IAC9E,CAAC;CACF;AA5UD,8DA4UC","sourcesContent":["import { MigrationInterface, QueryRunner } from 'typeorm'\nimport { Domain, getRepository } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\nimport { Account } from '../service/account/account'\nimport { AccountingCategory } from '../service/accounting-category/accounting-category'\n\nexport class SeedAccounts1725201467183 implements MigrationInterface {\n public async up(queryRunner: QueryRunner): Promise<void> {\n const domainRepository = getRepository(Domain)\n const userRepository = getRepository(User)\n const accountingCategoryRepository = getRepository(AccountingCategory)\n const accountRepository = getRepository(Account)\n\n const domain: Domain | null = await domainRepository.findOne({\n where: { name: 'SYSTEM' }\n })\n\n if (!domain) {\n throw new Error('SYSTEM domain not found')\n }\n\n const user = await userRepository.findOne({ where: { id: domain.owner } })\n\n if (!user) {\n throw new Error('Domain owner not found')\n }\n\n try {\n // 최상위 카테고리 생성\n const topLevelCategories = {\n 자산: await accountingCategoryRepository.save({\n domain,\n code: 'ASSET',\n name: '자산',\n description: '기업이 소유하고 있는 자산',\n creator: user,\n updater: user\n }),\n 부채: await accountingCategoryRepository.save({\n domain,\n code: 'LIABILITY',\n name: '부채',\n description: '기업이 갚아야 할 빚',\n creator: user,\n updater: user\n }),\n 자본: await accountingCategoryRepository.save({\n domain,\n code: 'EQUITY',\n name: '자본',\n description: '기업 소유주의 자산',\n creator: user,\n updater: user\n }),\n 수익: await accountingCategoryRepository.save({\n domain,\n code: 'REVENUE',\n name: '수익',\n description: '기업이 벌어들인 돈',\n creator: user,\n updater: user\n }),\n 비용: await accountingCategoryRepository.save({\n domain,\n code: 'EXPENSE',\n name: '비용',\n description: '기업 운영에 사용된 돈',\n creator: user,\n updater: user\n })\n }\n\n // 유동자산 및 비유동자산과 같은 하위 카테고리 생성\n const subCategories = {\n 유동자산: await accountingCategoryRepository.save({\n domain,\n code: 'CURRENT_ASSET',\n name: '유동자산',\n description: '쉽게 현금화할 수 있는 자산',\n parent: topLevelCategories.자산,\n creator: user,\n updater: user\n }),\n 비유동자산: await accountingCategoryRepository.save({\n domain,\n code: 'NON_CURRENT_ASSET',\n name: '비유동자산',\n description: '장기 보유 자산',\n parent: topLevelCategories.자산,\n creator: user,\n updater: user\n }),\n 유동부채: await accountingCategoryRepository.save({\n domain,\n code: 'CURRENT_LIABILITY',\n name: '유동부채',\n description: '단기간에 상환해야 하는 부채',\n parent: topLevelCategories.부채,\n creator: user,\n updater: user\n }),\n 비유동부채: await accountingCategoryRepository.save({\n domain,\n code: 'NON_CURRENT_LIABILITY',\n name: '비유동부채',\n description: '장기 부채',\n parent: topLevelCategories.부채,\n creator: user,\n updater: user\n })\n }\n\n // 이제 유형자산, 무형자산, 단기금융부채 같은 하위 카테고리를 subCategories 객체를 사용하여 생성합니다.\n const furtherSubCategories = {\n 유형자산: await accountingCategoryRepository.save({\n domain,\n code: 'TANGIBLE_ASSET',\n name: '유형자산',\n description: '물리적 형태가 있는 자산',\n parent: subCategories.비유동자산,\n creator: user,\n updater: user\n }),\n 무형자산: await accountingCategoryRepository.save({\n domain,\n code: 'INTANGIBLE_ASSET',\n name: '무형자산',\n description: '물리적 형태가 없는 자산',\n parent: subCategories.비유동자산,\n creator: user,\n updater: user\n }),\n 단기금융부채: await accountingCategoryRepository.save({\n domain,\n code: 'SHORT_TERM_FINANCIAL_LIABILITY',\n name: '단기금융부채',\n description: '단기적으로 갚아야 할 금융부채',\n parent: subCategories.유동부채,\n creator: user,\n updater: user\n })\n }\n\n // 계정 생성 및 하위 카테고리 연결\n const accounts = [\n // 유동자산 계정\n {\n code: '101',\n name: '현금 및 현금성 자산',\n description: '현금, 예금 및 기타 현금성 자산',\n category: subCategories.유동자산\n },\n {\n code: '102',\n name: '매출채권',\n description: '상품 또는 서비스의 판매로 인해 발생한 채권',\n category: subCategories.유동자산\n },\n {\n code: '103',\n name: '재고자산',\n description: '판매를 목적으로 보유한 상품, 제품, 원재료 등',\n category: subCategories.유동자산\n },\n {\n code: '104',\n name: '단기금융상품',\n description: '단기투자 목적으로 보유한 금융상품',\n category: subCategories.유동자산\n },\n {\n code: '105',\n name: '선급금',\n description: '상품, 서비스 제공을 위해 미리 지급한 금액',\n category: subCategories.유동자산\n },\n\n // 비유동자산 계정\n {\n code: '201',\n name: '건물',\n description: '기업이 소유한 건물',\n category: furtherSubCategories.유형자산\n },\n {\n code: '202',\n name: '토지',\n description: '기업이 소유한 토지',\n category: furtherSubCategories.유형자산\n },\n {\n code: '203',\n name: '기계장치',\n description: '생산을 위해 사용되는 기계 및 장치',\n category: furtherSubCategories.유형자산\n },\n {\n code: '204',\n name: '무형자산',\n description: '특허권, 상표권 등의 무형자산',\n category: furtherSubCategories.무형자산\n },\n\n // 유동부채 계정\n {\n code: '301',\n name: '매입채무',\n description: '상품 또는 서비스의 구매로 인해 발생한 채무',\n category: subCategories.유동부채\n },\n {\n code: '302',\n name: '단기차입금',\n description: '단기 대출금',\n category: furtherSubCategories.단기금융부채\n },\n {\n code: '303',\n name: '미지급금',\n description: '이미 발생한 비용에 대한 지급할 금액',\n category: subCategories.유동부채\n },\n {\n code: '304',\n name: '선수금',\n description: '고객으로부터 미리 받은 금액',\n category: subCategories.유동부채\n },\n\n // 비유동부채 계정\n { code: '401', name: '장기차입금', description: '장기 대출금', category: subCategories.비유동부채 },\n {\n code: '402',\n name: '퇴직급여충당부채',\n description: '퇴직급여 지급을 위해 설정한 부채',\n category: subCategories.비유동부채\n },\n\n // 자본 계정\n { code: '501', name: '자본금', description: '주주가 납입한 자본', category: topLevelCategories.자본 },\n { code: '502', name: '이익잉여금', description: '이익의 축적', category: topLevelCategories.자본 },\n\n // 수익 계정\n {\n code: '601',\n name: '제품매출',\n description: '제품의 판매로 인한 수익',\n category: topLevelCategories.수익\n },\n {\n code: '602',\n name: '상품매출',\n description: '상품의 판매로 인한 수익',\n category: topLevelCategories.수익\n },\n {\n code: '603',\n name: '용역매출',\n description: '용역 제공으로 인한 수익',\n category: topLevelCategories.수익\n },\n {\n code: '604',\n name: '이자수익',\n description: '금융 자산에서 발생한 이자수익',\n category: topLevelCategories.수익\n },\n {\n code: '605',\n name: '배당금수익',\n description: '주식 투자로 인한 배당금 수익',\n category: topLevelCategories.수익\n },\n\n // 비용 계정\n {\n code: '701',\n name: '매출원가',\n description: '제품, 상품, 용역 제공에 대한 원가',\n category: topLevelCategories.비용\n },\n { code: '702', name: '급여', description: '직원 급여 비용', category: topLevelCategories.비용 },\n { code: '703', name: '임대료', description: '건물 및 설비 임차료', category: topLevelCategories.비용 },\n {\n code: '704',\n name: '감가상각비',\n description: '유형자산의 감가상각비용',\n category: topLevelCategories.비용\n },\n {\n code: '705',\n name: '이자비용',\n description: '차입금에 대한 이자비용',\n category: topLevelCategories.비용\n },\n {\n code: '706',\n name: '판매비 및 관리비',\n description: '기업 운영에 필요한 비용',\n category: topLevelCategories.비용\n },\n { code: '707', name: '법인세비용', description: '법인세 납부 비용', category: topLevelCategories.비용 }\n ]\n\n // 계정 저장\n for (const account of accounts) {\n await accountRepository.save({\n domain,\n ...account,\n creator: user,\n updater: user\n })\n }\n } catch (error) {\n console.error('Failed to seed accounting categories and accounts:', error)\n throw error\n }\n }\n\n public async down(queryRunner: QueryRunner): Promise<void> {\n const domainRepository = getRepository(Domain)\n const accountingCategoryRepository = getRepository(AccountingCategory)\n const accountRepository = getRepository(Account)\n\n const domain: Domain | null = await domainRepository.findOne({\n where: { name: 'SYSTEM' }\n })\n\n if (!domain) {\n throw new Error('SYSTEM domain not found')\n }\n\n // Accounts 삭제\n await accountRepository.softDelete({ domain: { id: domain.id } })\n\n // AccountingCategories 삭제\n await accountingCategoryRepository.softDelete({ domain: { id: domain.id } })\n }\n}\n"]}
|