Skip to content

Commit 350b013

Browse files
authored
feat: add balance field to budget (#180)
This will facilitate the frontend implementation. The actual value is not computed as of now.
1 parent fe557ca commit 350b013

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

api/docs.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1874,6 +1874,9 @@ const docTemplate = `{
18741874
"controllers.Budget": {
18751875
"type": "object",
18761876
"properties": {
1877+
"balance": {
1878+
"type": "number"
1879+
},
18771880
"createdAt": {
18781881
"type": "string",
18791882
"example": "2022-04-02T19:28:44.491514Z"

api/swagger.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1862,6 +1862,9 @@
18621862
"controllers.Budget": {
18631863
"type": "object",
18641864
"properties": {
1865+
"balance": {
1866+
"type": "number"
1867+
},
18651868
"createdAt": {
18661869
"type": "string",
18671870
"example": "2022-04-02T19:28:44.491514Z"

api/swagger.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ definitions:
9595
type: object
9696
controllers.Budget:
9797
properties:
98+
balance:
99+
type: number
98100
createdAt:
99101
example: "2022-04-02T19:28:44.491514Z"
100102
type: string

pkg/models/budget.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"time"
55

66
"github.com/google/uuid"
7+
"github.com/shopspring/decimal"
78
)
89

910
// Budget represents a budget
@@ -13,6 +14,7 @@ import (
1314
type Budget struct {
1415
Model
1516
BudgetCreate
17+
Balance decimal.Decimal `json:"balance" gorm:"-"`
1618
}
1719

1820
type BudgetCreate struct {

0 commit comments

Comments
 (0)