Skip to content

Commit

Permalink
fix: add equity account set to balance sheet
Browse files Browse the repository at this point in the history
  • Loading branch information
bodymindarts committed Jun 20, 2024
1 parent ad9d706 commit 86fe61d
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
BIN_OUT_DIR := out
BINARY := $(BIN_OUT_DIR)/terraform-provider-cala

version = 0.0.16
version = 0.0.17
os_arch = $(shell go env GOOS)_$(shell go env GOARCH)
provider_path = registry.terraform.io/galoymoney/cala/$(version)/$(os_arch)/

Expand Down
6 changes: 6 additions & 0 deletions cala/graphql/balance_sheet.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ query balanceSheetGet($journalId: UUID!) {
liabilities {
accountSetId
}
equity {
accountSetId
}
assets {
accountSetId
}
Expand Down Expand Up @@ -57,6 +60,9 @@ mutation balanceSheetCreate($input: BalanceSheetCreateInput!) {
liabilities {
accountSetId
}
equity {
accountSetId
}
schedule1 {
accountSetId
}
Expand Down
4 changes: 2 additions & 2 deletions docs/resources/account_set.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
page_title: "cala_account_set Resource - terraform-provider-cala"
subcategory: ""
description: |-
Cala account.
Cala account set.
---

# cala_account_set (Resource)

Cala account.
Cala account set.

## Example Usage

Expand Down
4 changes: 2 additions & 2 deletions docs/resources/account_set_member_account.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
page_title: "cala_account_set_member_account Resource - terraform-provider-cala"
subcategory: ""
description: |-
Cala account.
Represents the membership of an account in an account set.
---

# cala_account_set_member_account (Resource)

Cala account.
Represents the membership of an account in an account set.

## Example Usage

Expand Down
4 changes: 2 additions & 2 deletions docs/resources/account_set_member_account_set.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
page_title: "cala_account_set_member_account_set Resource - terraform-provider-cala"
subcategory: ""
description: |-
Cala account set.
Represents the membership of an account set in another account set.
---

# cala_account_set_member_account_set (Resource)

Cala account set.
Represents the membership of an account set in another account set.

## Example Usage

Expand Down
1 change: 1 addition & 0 deletions docs/resources/balance_sheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ resource "cala_balance_sheet" "balance_sheet" {
### Read-Only

- `assets_account_set_id` (String) ID of the account set for assets.
- `equity_account_set_id` (String) ID of the account set for equity.
- `liabilities_account_set_id` (String) ID of the account set for liabilities.
- `schedule10_account_set_id` (String) ID of the account set for schedule 10.
- `schedule11_account_set_id` (String) ID of the account set for schedule 11.
Expand Down
2 changes: 1 addition & 1 deletion examples/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ terraform {
required_providers {
cala = {
source = "registry.terraform.io/galoymoney/cala"
version = "0.0.16"
version = "0.0.17"
}
}
}
38 changes: 38 additions & 0 deletions provider/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions provider/resource_balance_sheet.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type BalanceSheetResourceModel struct {
JournalId types.String `tfsdk:"journal_id"`
AssetsAccountSetId types.String `tfsdk:"assets_account_set_id"`
LiabilitiesAccountSetId types.String `tfsdk:"liabilities_account_set_id"`
EquityAccountSetId types.String `tfsdk:"equity_account_set_id"`
Schedule1AccountSetId types.String `tfsdk:"schedule1_account_set_id"`
Schedule2AccountSetId types.String `tfsdk:"schedule2_account_set_id"`
Schedule3AccountSetId types.String `tfsdk:"schedule3_account_set_id"`
Expand Down Expand Up @@ -59,6 +60,10 @@ func (r *BalanceSheetResource) Schema(ctx context.Context, req resource.SchemaRe
MarkdownDescription: "ID of the account set for liabilities.",
Computed: true,
},
"equity_account_set_id": schema.StringAttribute{
MarkdownDescription: "ID of the account set for equity.",
Computed: true,
},
"schedule1_account_set_id": schema.StringAttribute{
MarkdownDescription: "ID of the account set for schedule 1.",
Computed: true,
Expand Down Expand Up @@ -147,6 +152,7 @@ func (r *BalanceSheetResource) Read(ctx context.Context, req resource.ReadReques

data.AssetsAccountSetId = types.StringValue(balanceSheet.Assets.AccountSetId)
data.LiabilitiesAccountSetId = types.StringValue(balanceSheet.Liabilities.AccountSetId)
data.EquityAccountSetId = types.StringValue(balanceSheet.Equity.AccountSetId)
data.Schedule1AccountSetId = types.StringValue(balanceSheet.Schedule1.AccountSetId)
data.Schedule2AccountSetId = types.StringValue(balanceSheet.Schedule2.AccountSetId)
data.Schedule3AccountSetId = types.StringValue(balanceSheet.Schedule3.AccountSetId)
Expand Down Expand Up @@ -186,6 +192,7 @@ func (r *BalanceSheetResource) Create(ctx context.Context, req resource.CreateRe

data.AssetsAccountSetId = types.StringValue(balanceSheet.Assets.AccountSetId)
data.LiabilitiesAccountSetId = types.StringValue(balanceSheet.Liabilities.AccountSetId)
data.EquityAccountSetId = types.StringValue(balanceSheet.Equity.AccountSetId)
data.Schedule1AccountSetId = types.StringValue(balanceSheet.Schedule1.AccountSetId)
data.Schedule2AccountSetId = types.StringValue(balanceSheet.Schedule2.AccountSetId)
data.Schedule3AccountSetId = types.StringValue(balanceSheet.Schedule3.AccountSetId)
Expand Down
3 changes: 3 additions & 0 deletions schema/vendor/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ type AccountSet {
createdAt: Timestamp!
modifiedAt: Timestamp!
balance(currency: CurrencyCode!): Balance
sets(first: Int!, after: String): AccountSetConnection!
}

type AccountSetConnection {
Expand Down Expand Up @@ -178,6 +179,7 @@ type BalanceAmount {
type BalanceSheet {
assets: AccountSet!
liabilities: AccountSet!
equity: AccountSet!
schedule1: AccountSet!
schedule2: AccountSet!
schedule3: AccountSet!
Expand Down Expand Up @@ -314,6 +316,7 @@ type BitfinexMutation {
type BitfinexQuery {
integration(id: UUID!): BfxIntegration
addressBackedAccount(id: UUID!): BfxAddressBackedAccount
addressBackedAccountByCode(code: String!): BfxAddressBackedAccount
withdrawal(id: UUID!): BfxWithdrawal
}

Expand Down
6 changes: 3 additions & 3 deletions vendir.lock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ apiVersion: vendir.k14s.io/v1alpha1
directories:
- contents:
- git:
commitTitle: 'fix: update schema'
sha: e1e6f2af96c1d0c2865308724b210be3b0841f7e
commitTitle: 'fix: sdl'
sha: ce094294dc275ef32a608ec2edfb51cfd83e9dc0
tags:
- 0.3.2-3-ge1e6f2a
- 0.3.4-3-gce09429
path: vendor
path: schema
kind: LockConfig

0 comments on commit 86fe61d

Please sign in to comment.