@hed-hog/finance 0.0.2
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/README.md +488 -0
- package/dist/finance.module.d.ts +3 -0
- package/dist/finance.module.d.ts.map +1 -0
- package/dist/finance.module.js +28 -0
- package/dist/finance.module.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/hedhog/frontend/app/page.tsx.ejs +17 -0
- package/hedhog/frontend/messages/en.json +6 -0
- package/hedhog/frontend/messages/pt.json +6 -0
- package/hedhog/table/audit_log.yaml +39 -0
- package/hedhog/table/bank_account.yaml +45 -0
- package/hedhog/table/bank_reconciliation.yaml +39 -0
- package/hedhog/table/bank_statement.yaml +40 -0
- package/hedhog/table/bank_statement_line.yaml +41 -0
- package/hedhog/table/branch.yaml +18 -0
- package/hedhog/table/cashflow_projection.yaml +26 -0
- package/hedhog/table/company_profile.yaml +23 -0
- package/hedhog/table/cost_center.yaml +18 -0
- package/hedhog/table/finance_category.yaml +29 -0
- package/hedhog/table/financial_installment.yaml +34 -0
- package/hedhog/table/financial_installment_tag.yaml +23 -0
- package/hedhog/table/financial_title.yaml +61 -0
- package/hedhog/table/financial_title_attachment.yaml +32 -0
- package/hedhog/table/forecast_scenario.yaml +18 -0
- package/hedhog/table/installment_allocation.yaml +26 -0
- package/hedhog/table/payment_method.yaml +21 -0
- package/hedhog/table/period_close.yaml +30 -0
- package/hedhog/table/receivable_schedule.yaml +31 -0
- package/hedhog/table/settlement.yaml +66 -0
- package/hedhog/table/settlement_allocation.yaml +35 -0
- package/package.json +39 -0
- package/src/finance.module.ts +15 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
columns:
|
|
2
|
+
- type: pk
|
|
3
|
+
- name: bank_statement_line_id
|
|
4
|
+
type: fk
|
|
5
|
+
references:
|
|
6
|
+
table: bank_statement_line
|
|
7
|
+
column: id
|
|
8
|
+
onDelete: RESTRICT
|
|
9
|
+
onUpdate: CASCADE
|
|
10
|
+
- name: settlement_id
|
|
11
|
+
type: fk
|
|
12
|
+
references:
|
|
13
|
+
table: settlement
|
|
14
|
+
column: id
|
|
15
|
+
onDelete: RESTRICT
|
|
16
|
+
onUpdate: CASCADE
|
|
17
|
+
- name: status
|
|
18
|
+
type: enum
|
|
19
|
+
values: [pending, reconciled, reversed, adjusted]
|
|
20
|
+
- name: matched_at
|
|
21
|
+
type: datetime
|
|
22
|
+
isNullable: true
|
|
23
|
+
- name: matched_by_user_id
|
|
24
|
+
type: fk
|
|
25
|
+
isNullable: true
|
|
26
|
+
references:
|
|
27
|
+
table: user
|
|
28
|
+
column: id
|
|
29
|
+
onDelete: SET NULL
|
|
30
|
+
onUpdate: CASCADE
|
|
31
|
+
- type: created_at
|
|
32
|
+
- type: updated_at
|
|
33
|
+
|
|
34
|
+
indices:
|
|
35
|
+
- columns: [bank_statement_line_id]
|
|
36
|
+
isUnique: true
|
|
37
|
+
- columns: [settlement_id]
|
|
38
|
+
isUnique: true
|
|
39
|
+
- columns: [status]
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
columns:
|
|
2
|
+
- type: pk
|
|
3
|
+
- name: bank_account_id
|
|
4
|
+
type: fk
|
|
5
|
+
references:
|
|
6
|
+
table: bank_account
|
|
7
|
+
column: id
|
|
8
|
+
onDelete: CASCADE
|
|
9
|
+
onUpdate: CASCADE
|
|
10
|
+
- name: source_type
|
|
11
|
+
type: enum
|
|
12
|
+
values: [ofx, csv, manual]
|
|
13
|
+
- name: idempotency_key
|
|
14
|
+
type: varchar
|
|
15
|
+
length: 120
|
|
16
|
+
isNullable: true
|
|
17
|
+
- name: period_start
|
|
18
|
+
type: datetime
|
|
19
|
+
isNullable: true
|
|
20
|
+
- name: period_end
|
|
21
|
+
type: datetime
|
|
22
|
+
isNullable: true
|
|
23
|
+
- name: imported_at
|
|
24
|
+
type: datetime
|
|
25
|
+
- name: imported_by_user_id
|
|
26
|
+
type: fk
|
|
27
|
+
isNullable: true
|
|
28
|
+
references:
|
|
29
|
+
table: user
|
|
30
|
+
column: id
|
|
31
|
+
onDelete: SET NULL
|
|
32
|
+
onUpdate: CASCADE
|
|
33
|
+
- type: created_at
|
|
34
|
+
- type: updated_at
|
|
35
|
+
|
|
36
|
+
indices:
|
|
37
|
+
- columns: [bank_account_id]
|
|
38
|
+
- columns: [bank_account_id, imported_at]
|
|
39
|
+
- columns: [idempotency_key]
|
|
40
|
+
isUnique: true
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
columns:
|
|
2
|
+
- type: pk
|
|
3
|
+
- name: bank_statement_id
|
|
4
|
+
type: fk
|
|
5
|
+
references:
|
|
6
|
+
table: bank_statement
|
|
7
|
+
column: id
|
|
8
|
+
onDelete: CASCADE
|
|
9
|
+
onUpdate: CASCADE
|
|
10
|
+
- name: bank_account_id
|
|
11
|
+
type: fk
|
|
12
|
+
references:
|
|
13
|
+
table: bank_account
|
|
14
|
+
column: id
|
|
15
|
+
onDelete: CASCADE
|
|
16
|
+
onUpdate: CASCADE
|
|
17
|
+
- name: external_id
|
|
18
|
+
type: varchar
|
|
19
|
+
length: 120
|
|
20
|
+
isNullable: true
|
|
21
|
+
- name: posted_date
|
|
22
|
+
type: datetime
|
|
23
|
+
- name: amount_cents
|
|
24
|
+
type: int
|
|
25
|
+
- name: description
|
|
26
|
+
type: text
|
|
27
|
+
- name: status
|
|
28
|
+
type: enum
|
|
29
|
+
values: [imported, pending, reconciled, reversed, adjusted]
|
|
30
|
+
- name: dedupe_key
|
|
31
|
+
type: varchar
|
|
32
|
+
length: 180
|
|
33
|
+
- type: created_at
|
|
34
|
+
- type: updated_at
|
|
35
|
+
|
|
36
|
+
indices:
|
|
37
|
+
- columns: [bank_account_id]
|
|
38
|
+
- columns: [bank_account_id, posted_date]
|
|
39
|
+
- columns: [bank_account_id, status]
|
|
40
|
+
- columns: [dedupe_key]
|
|
41
|
+
isUnique: true
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
columns:
|
|
2
|
+
- type: pk
|
|
3
|
+
- name: code
|
|
4
|
+
type: varchar
|
|
5
|
+
length: 32
|
|
6
|
+
- name: name
|
|
7
|
+
type: varchar
|
|
8
|
+
length: 180
|
|
9
|
+
- name: status
|
|
10
|
+
type: enum
|
|
11
|
+
values: [active, inactive]
|
|
12
|
+
- type: created_at
|
|
13
|
+
- type: updated_at
|
|
14
|
+
|
|
15
|
+
indices:
|
|
16
|
+
- columns: [code]
|
|
17
|
+
isUnique: true
|
|
18
|
+
- columns: [status]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
columns:
|
|
2
|
+
- type: pk
|
|
3
|
+
- name: scenario_id
|
|
4
|
+
type: fk
|
|
5
|
+
references:
|
|
6
|
+
table: forecast_scenario
|
|
7
|
+
column: id
|
|
8
|
+
onDelete: CASCADE
|
|
9
|
+
onUpdate: CASCADE
|
|
10
|
+
- name: projection_date
|
|
11
|
+
type: datetime
|
|
12
|
+
- name: projection_type
|
|
13
|
+
type: enum
|
|
14
|
+
values: [inflow, outflow, net]
|
|
15
|
+
- name: amount_cents
|
|
16
|
+
type: int
|
|
17
|
+
- name: notes
|
|
18
|
+
type: text
|
|
19
|
+
isNullable: true
|
|
20
|
+
- type: created_at
|
|
21
|
+
- type: updated_at
|
|
22
|
+
|
|
23
|
+
indices:
|
|
24
|
+
- columns: [scenario_id]
|
|
25
|
+
- columns: [scenario_id, projection_date]
|
|
26
|
+
- columns: [projection_type]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
columns:
|
|
2
|
+
- type: pk
|
|
3
|
+
- name: code
|
|
4
|
+
type: varchar
|
|
5
|
+
length: 32
|
|
6
|
+
- name: status
|
|
7
|
+
type: enum
|
|
8
|
+
values: [active, inactive]
|
|
9
|
+
- name: default_currency
|
|
10
|
+
type: char
|
|
11
|
+
length: 3
|
|
12
|
+
default: BRL
|
|
13
|
+
- name: timezone
|
|
14
|
+
type: varchar
|
|
15
|
+
length: 64
|
|
16
|
+
default: America/Sao_Paulo
|
|
17
|
+
- type: created_at
|
|
18
|
+
- type: updated_at
|
|
19
|
+
|
|
20
|
+
indices:
|
|
21
|
+
- columns: [code]
|
|
22
|
+
isUnique: true
|
|
23
|
+
- columns: [status]
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
columns:
|
|
2
|
+
- type: pk
|
|
3
|
+
- name: code
|
|
4
|
+
type: varchar
|
|
5
|
+
length: 64
|
|
6
|
+
- name: name
|
|
7
|
+
type: varchar
|
|
8
|
+
length: 180
|
|
9
|
+
- name: status
|
|
10
|
+
type: enum
|
|
11
|
+
values: [active, inactive]
|
|
12
|
+
- type: created_at
|
|
13
|
+
- type: updated_at
|
|
14
|
+
|
|
15
|
+
indices:
|
|
16
|
+
- columns: [code]
|
|
17
|
+
isUnique: true
|
|
18
|
+
- columns: [status]
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
columns:
|
|
2
|
+
- type: pk
|
|
3
|
+
- name: parent_id
|
|
4
|
+
type: fk
|
|
5
|
+
isNullable: true
|
|
6
|
+
references:
|
|
7
|
+
table: finance_category
|
|
8
|
+
column: id
|
|
9
|
+
onDelete: SET NULL
|
|
10
|
+
onUpdate: CASCADE
|
|
11
|
+
- name: code
|
|
12
|
+
type: varchar
|
|
13
|
+
length: 64
|
|
14
|
+
- name: name
|
|
15
|
+
type: varchar
|
|
16
|
+
length: 180
|
|
17
|
+
- name: kind
|
|
18
|
+
type: enum
|
|
19
|
+
values: [revenue, expense, transfer, adjustment, other]
|
|
20
|
+
- name: status
|
|
21
|
+
type: enum
|
|
22
|
+
values: [active, inactive]
|
|
23
|
+
- type: created_at
|
|
24
|
+
- type: updated_at
|
|
25
|
+
|
|
26
|
+
indices:
|
|
27
|
+
- columns: [code]
|
|
28
|
+
isUnique: true
|
|
29
|
+
- columns: [status]
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
columns:
|
|
2
|
+
- type: pk
|
|
3
|
+
- name: title_id
|
|
4
|
+
type: fk
|
|
5
|
+
references:
|
|
6
|
+
table: financial_title
|
|
7
|
+
column: id
|
|
8
|
+
onDelete: CASCADE
|
|
9
|
+
onUpdate: CASCADE
|
|
10
|
+
- name: installment_number
|
|
11
|
+
type: int
|
|
12
|
+
- name: competence_date
|
|
13
|
+
type: datetime
|
|
14
|
+
- name: due_date
|
|
15
|
+
type: datetime
|
|
16
|
+
- name: amount_cents
|
|
17
|
+
type: int
|
|
18
|
+
- name: open_amount_cents
|
|
19
|
+
type: int
|
|
20
|
+
- name: status
|
|
21
|
+
type: enum
|
|
22
|
+
values: [open, partial, settled, canceled, overdue]
|
|
23
|
+
- name: notes
|
|
24
|
+
type: text
|
|
25
|
+
isNullable: true
|
|
26
|
+
- type: created_at
|
|
27
|
+
- type: updated_at
|
|
28
|
+
|
|
29
|
+
indices:
|
|
30
|
+
- columns: [title_id, installment_number]
|
|
31
|
+
isUnique: true
|
|
32
|
+
- columns: [status]
|
|
33
|
+
- columns: [due_date]
|
|
34
|
+
- columns: [competence_date]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
columns:
|
|
2
|
+
- type: pk
|
|
3
|
+
- name: installment_id
|
|
4
|
+
type: fk
|
|
5
|
+
references:
|
|
6
|
+
table: financial_installment
|
|
7
|
+
column: id
|
|
8
|
+
onDelete: CASCADE
|
|
9
|
+
onUpdate: CASCADE
|
|
10
|
+
- name: tag_id
|
|
11
|
+
type: fk
|
|
12
|
+
references:
|
|
13
|
+
table: tag
|
|
14
|
+
column: id
|
|
15
|
+
onDelete: CASCADE
|
|
16
|
+
onUpdate: CASCADE
|
|
17
|
+
- type: created_at
|
|
18
|
+
- type: updated_at
|
|
19
|
+
|
|
20
|
+
indices:
|
|
21
|
+
- columns: [installment_id, tag_id]
|
|
22
|
+
isUnique: true
|
|
23
|
+
- columns: [tag_id]
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
columns:
|
|
2
|
+
- type: pk
|
|
3
|
+
- name: branch_id
|
|
4
|
+
type: fk
|
|
5
|
+
isNullable: true
|
|
6
|
+
references:
|
|
7
|
+
table: branch
|
|
8
|
+
column: id
|
|
9
|
+
onDelete: SET NULL
|
|
10
|
+
onUpdate: CASCADE
|
|
11
|
+
- name: person_id
|
|
12
|
+
type: fk
|
|
13
|
+
references:
|
|
14
|
+
table: person
|
|
15
|
+
column: id
|
|
16
|
+
onDelete: RESTRICT
|
|
17
|
+
onUpdate: CASCADE
|
|
18
|
+
- name: title_type
|
|
19
|
+
type: enum
|
|
20
|
+
values: [payable, receivable]
|
|
21
|
+
- name: status
|
|
22
|
+
type: enum
|
|
23
|
+
values: [draft, approved, open, partial, settled, canceled, overdue]
|
|
24
|
+
- name: document_number
|
|
25
|
+
type: varchar
|
|
26
|
+
length: 80
|
|
27
|
+
isNullable: true
|
|
28
|
+
- name: description
|
|
29
|
+
type: text
|
|
30
|
+
isNullable: true
|
|
31
|
+
- name: competence_date
|
|
32
|
+
type: datetime
|
|
33
|
+
isNullable: true
|
|
34
|
+
- name: issue_date
|
|
35
|
+
type: datetime
|
|
36
|
+
isNullable: true
|
|
37
|
+
- name: total_amount_cents
|
|
38
|
+
type: int
|
|
39
|
+
- name: finance_category_id
|
|
40
|
+
type: fk
|
|
41
|
+
isNullable: true
|
|
42
|
+
references:
|
|
43
|
+
table: finance_category
|
|
44
|
+
column: id
|
|
45
|
+
onDelete: SET NULL
|
|
46
|
+
onUpdate: CASCADE
|
|
47
|
+
- name: created_by_user_id
|
|
48
|
+
type: fk
|
|
49
|
+
isNullable: true
|
|
50
|
+
references:
|
|
51
|
+
table: user
|
|
52
|
+
column: id
|
|
53
|
+
onDelete: SET NULL
|
|
54
|
+
onUpdate: CASCADE
|
|
55
|
+
- type: created_at
|
|
56
|
+
- type: updated_at
|
|
57
|
+
|
|
58
|
+
indices:
|
|
59
|
+
- columns: [title_type, status]
|
|
60
|
+
- columns: [person_id]
|
|
61
|
+
- columns: [competence_date]
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
columns:
|
|
2
|
+
- type: pk
|
|
3
|
+
- name: title_id
|
|
4
|
+
type: fk
|
|
5
|
+
references:
|
|
6
|
+
table: financial_title
|
|
7
|
+
column: id
|
|
8
|
+
onDelete: CASCADE
|
|
9
|
+
onUpdate: CASCADE
|
|
10
|
+
- name: file_id
|
|
11
|
+
type: fk
|
|
12
|
+
references:
|
|
13
|
+
table: file
|
|
14
|
+
column: id
|
|
15
|
+
onDelete: RESTRICT
|
|
16
|
+
onUpdate: CASCADE
|
|
17
|
+
- name: uploaded_by_user_id
|
|
18
|
+
type: fk
|
|
19
|
+
isNullable: true
|
|
20
|
+
references:
|
|
21
|
+
table: user
|
|
22
|
+
column: id
|
|
23
|
+
onDelete: SET NULL
|
|
24
|
+
onUpdate: CASCADE
|
|
25
|
+
- type: created_at
|
|
26
|
+
- type: updated_at
|
|
27
|
+
|
|
28
|
+
indices:
|
|
29
|
+
- columns: [title_id]
|
|
30
|
+
- columns: [file_id]
|
|
31
|
+
- columns: [title_id, file_id]
|
|
32
|
+
isUnique: true
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
columns:
|
|
2
|
+
- type: pk
|
|
3
|
+
- name: name
|
|
4
|
+
type: varchar
|
|
5
|
+
length: 120
|
|
6
|
+
- name: status
|
|
7
|
+
type: enum
|
|
8
|
+
values: [active, inactive]
|
|
9
|
+
- name: is_default
|
|
10
|
+
type: boolean
|
|
11
|
+
default: false
|
|
12
|
+
- type: created_at
|
|
13
|
+
- type: updated_at
|
|
14
|
+
|
|
15
|
+
indices:
|
|
16
|
+
- columns: [name]
|
|
17
|
+
isUnique: true
|
|
18
|
+
- columns: [status]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
columns:
|
|
2
|
+
- type: pk
|
|
3
|
+
- name: installment_id
|
|
4
|
+
type: fk
|
|
5
|
+
references:
|
|
6
|
+
table: financial_installment
|
|
7
|
+
column: id
|
|
8
|
+
onDelete: CASCADE
|
|
9
|
+
onUpdate: CASCADE
|
|
10
|
+
- name: cost_center_id
|
|
11
|
+
type: fk
|
|
12
|
+
references:
|
|
13
|
+
table: cost_center
|
|
14
|
+
column: id
|
|
15
|
+
onDelete: RESTRICT
|
|
16
|
+
onUpdate: CASCADE
|
|
17
|
+
- name: allocated_amount_cents
|
|
18
|
+
type: int
|
|
19
|
+
- type: created_at
|
|
20
|
+
- type: updated_at
|
|
21
|
+
|
|
22
|
+
indices:
|
|
23
|
+
- columns: [installment_id]
|
|
24
|
+
- columns: [cost_center_id]
|
|
25
|
+
- columns: [installment_id, cost_center_id]
|
|
26
|
+
isUnique: true
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
columns:
|
|
2
|
+
- type: pk
|
|
3
|
+
- name: code
|
|
4
|
+
type: varchar
|
|
5
|
+
length: 32
|
|
6
|
+
- name: name
|
|
7
|
+
type: varchar
|
|
8
|
+
length: 120
|
|
9
|
+
- name: type
|
|
10
|
+
type: enum
|
|
11
|
+
values: [pix, boleto, ted, doc, card, cash, other]
|
|
12
|
+
- name: status
|
|
13
|
+
type: enum
|
|
14
|
+
values: [active, inactive]
|
|
15
|
+
- type: created_at
|
|
16
|
+
- type: updated_at
|
|
17
|
+
|
|
18
|
+
indices:
|
|
19
|
+
- columns: [code]
|
|
20
|
+
isUnique: true
|
|
21
|
+
- columns: [status]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
columns:
|
|
2
|
+
- type: pk
|
|
3
|
+
- name: period_start
|
|
4
|
+
type: datetime
|
|
5
|
+
- name: period_end
|
|
6
|
+
type: datetime
|
|
7
|
+
- name: status
|
|
8
|
+
type: enum
|
|
9
|
+
values: [open, closed]
|
|
10
|
+
- name: closed_at
|
|
11
|
+
type: datetime
|
|
12
|
+
isNullable: true
|
|
13
|
+
- name: closed_by_user_id
|
|
14
|
+
type: fk
|
|
15
|
+
isNullable: true
|
|
16
|
+
references:
|
|
17
|
+
table: user
|
|
18
|
+
column: id
|
|
19
|
+
onDelete: SET NULL
|
|
20
|
+
onUpdate: CASCADE
|
|
21
|
+
- name: notes
|
|
22
|
+
type: text
|
|
23
|
+
isNullable: true
|
|
24
|
+
- type: created_at
|
|
25
|
+
- type: updated_at
|
|
26
|
+
|
|
27
|
+
indices:
|
|
28
|
+
- columns: [period_start, period_end]
|
|
29
|
+
isUnique: true
|
|
30
|
+
- columns: [status]
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
columns:
|
|
2
|
+
- type: pk
|
|
3
|
+
- name: scenario_id
|
|
4
|
+
type: fk
|
|
5
|
+
references:
|
|
6
|
+
table: forecast_scenario
|
|
7
|
+
column: id
|
|
8
|
+
onDelete: CASCADE
|
|
9
|
+
onUpdate: CASCADE
|
|
10
|
+
- name: person_id
|
|
11
|
+
type: fk
|
|
12
|
+
isNullable: true
|
|
13
|
+
references:
|
|
14
|
+
table: person
|
|
15
|
+
column: id
|
|
16
|
+
onDelete: SET NULL
|
|
17
|
+
onUpdate: CASCADE
|
|
18
|
+
- name: expected_date
|
|
19
|
+
type: datetime
|
|
20
|
+
- name: amount_cents
|
|
21
|
+
type: int
|
|
22
|
+
- name: description
|
|
23
|
+
type: text
|
|
24
|
+
isNullable: true
|
|
25
|
+
- type: created_at
|
|
26
|
+
- type: updated_at
|
|
27
|
+
|
|
28
|
+
indices:
|
|
29
|
+
- columns: [scenario_id]
|
|
30
|
+
- columns: [scenario_id, expected_date]
|
|
31
|
+
- columns: [person_id]
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
columns:
|
|
2
|
+
- type: pk
|
|
3
|
+
- name: branch_id
|
|
4
|
+
type: fk
|
|
5
|
+
isNullable: true
|
|
6
|
+
references:
|
|
7
|
+
table: branch
|
|
8
|
+
column: id
|
|
9
|
+
onDelete: SET NULL
|
|
10
|
+
onUpdate: CASCADE
|
|
11
|
+
- name: person_id
|
|
12
|
+
type: fk
|
|
13
|
+
isNullable: true
|
|
14
|
+
references:
|
|
15
|
+
table: person
|
|
16
|
+
column: id
|
|
17
|
+
onDelete: SET NULL
|
|
18
|
+
onUpdate: CASCADE
|
|
19
|
+
- name: bank_account_id
|
|
20
|
+
type: fk
|
|
21
|
+
isNullable: true
|
|
22
|
+
references:
|
|
23
|
+
table: bank_account
|
|
24
|
+
column: id
|
|
25
|
+
onDelete: SET NULL
|
|
26
|
+
onUpdate: CASCADE
|
|
27
|
+
- name: payment_method_id
|
|
28
|
+
type: fk
|
|
29
|
+
isNullable: true
|
|
30
|
+
references:
|
|
31
|
+
table: payment_method
|
|
32
|
+
column: id
|
|
33
|
+
onDelete: SET NULL
|
|
34
|
+
onUpdate: CASCADE
|
|
35
|
+
- name: settlement_type
|
|
36
|
+
type: enum
|
|
37
|
+
values: [payable, receivable, transfer, adjustment]
|
|
38
|
+
- name: status
|
|
39
|
+
type: enum
|
|
40
|
+
values: [pending, confirmed, reversed]
|
|
41
|
+
- name: settled_at
|
|
42
|
+
type: datetime
|
|
43
|
+
- name: amount_cents
|
|
44
|
+
type: int
|
|
45
|
+
- name: description
|
|
46
|
+
type: text
|
|
47
|
+
isNullable: true
|
|
48
|
+
- name: external_reference
|
|
49
|
+
type: varchar
|
|
50
|
+
length: 120
|
|
51
|
+
isNullable: true
|
|
52
|
+
- name: created_by_user_id
|
|
53
|
+
type: fk
|
|
54
|
+
isNullable: true
|
|
55
|
+
references:
|
|
56
|
+
table: user
|
|
57
|
+
column: id
|
|
58
|
+
onDelete: SET NULL
|
|
59
|
+
onUpdate: CASCADE
|
|
60
|
+
- type: created_at
|
|
61
|
+
- type: updated_at
|
|
62
|
+
|
|
63
|
+
indices:
|
|
64
|
+
- columns: [status]
|
|
65
|
+
- columns: [settled_at]
|
|
66
|
+
- columns: [bank_account_id]
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
columns:
|
|
2
|
+
- type: pk
|
|
3
|
+
- name: settlement_id
|
|
4
|
+
type: fk
|
|
5
|
+
references:
|
|
6
|
+
table: settlement
|
|
7
|
+
column: id
|
|
8
|
+
onDelete: CASCADE
|
|
9
|
+
onUpdate: CASCADE
|
|
10
|
+
- name: installment_id
|
|
11
|
+
type: fk
|
|
12
|
+
references:
|
|
13
|
+
table: financial_installment
|
|
14
|
+
column: id
|
|
15
|
+
onDelete: RESTRICT
|
|
16
|
+
onUpdate: CASCADE
|
|
17
|
+
- name: allocated_amount_cents
|
|
18
|
+
type: int
|
|
19
|
+
- name: discount_cents
|
|
20
|
+
type: int
|
|
21
|
+
default: 0
|
|
22
|
+
- name: interest_cents
|
|
23
|
+
type: int
|
|
24
|
+
default: 0
|
|
25
|
+
- name: penalty_cents
|
|
26
|
+
type: int
|
|
27
|
+
default: 0
|
|
28
|
+
- type: created_at
|
|
29
|
+
- type: updated_at
|
|
30
|
+
|
|
31
|
+
indices:
|
|
32
|
+
- columns: [settlement_id]
|
|
33
|
+
- columns: [installment_id]
|
|
34
|
+
- columns: [settlement_id, installment_id]
|
|
35
|
+
isUnique: true
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hed-hog/finance",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@nestjs/common": "*",
|
|
8
|
+
"@nestjs/config": "^4.0.2",
|
|
9
|
+
"@nestjs/core": "^11",
|
|
10
|
+
"@nestjs/jwt": "^11",
|
|
11
|
+
"@nestjs/mapped-types": "*",
|
|
12
|
+
"@hed-hog/api-locale": "0.0.11",
|
|
13
|
+
"@hed-hog/api": "0.0.3",
|
|
14
|
+
"@hed-hog/api-pagination": "0.0.5",
|
|
15
|
+
"@hed-hog/api-prisma": "0.0.4",
|
|
16
|
+
"@hed-hog/contact": "0.0.222",
|
|
17
|
+
"@hed-hog/api-types": "0.0.1",
|
|
18
|
+
"@hed-hog/tag": "0.0.222"
|
|
19
|
+
},
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"import": "./dist/index.js",
|
|
23
|
+
"require": "./dist/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./package.json": "./package.json"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"src",
|
|
30
|
+
"hedhog"
|
|
31
|
+
],
|
|
32
|
+
"scripts": {
|
|
33
|
+
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\"",
|
|
34
|
+
"prebuild": "pnpm exec ts-node ../../scripts/build-dependencies.ts libraries/finance",
|
|
35
|
+
"build": "tsc --project tsconfig.production.json",
|
|
36
|
+
"patch": "pnpm exec ts-node ../../scripts/patch.ts libraries/finance",
|
|
37
|
+
"prod": "pnpm run patch && pnpm run build && pnpm publish --access public --no-git-checks"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { forwardRef, Module } from '@nestjs/common';
|
|
2
|
+
import { ConfigModule } from '@nestjs/config';
|
|
3
|
+
import { LocaleModule } from '@hed-hog/api-locale';
|
|
4
|
+
import { PaginationModule } from '@hed-hog/api-pagination';
|
|
5
|
+
import { PrismaModule } from '@hed-hog/api-prisma';
|
|
6
|
+
|
|
7
|
+
@Module({
|
|
8
|
+
imports: [
|
|
9
|
+
ConfigModule.forRoot(),
|
|
10
|
+
forwardRef(() => PaginationModule),
|
|
11
|
+
forwardRef(() => PrismaModule),
|
|
12
|
+
forwardRef(() => LocaleModule)
|
|
13
|
+
]
|
|
14
|
+
})
|
|
15
|
+
export class FinanceModule {}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './finance.module';
|