diff --git a/datafetcher/handlers/accounts.go b/datafetcher/handlers/accounts.go
index 5facf25..6b8b884 100644
--- a/datafetcher/handlers/accounts.go
+++ b/datafetcher/handlers/accounts.go
@@ -6,6 +6,7 @@ import (
"log"
"net/http"
+ "github.com/esteanes/expense-manager/datafetcher/templates"
"github.com/esteanes/expense-manager/datafetcher/upclient"
)
@@ -28,15 +29,15 @@ func NewAccountHandler(log *log.Logger, upclient *upclient.APIClient, auth conte
func (h *AccountHandler) Post(w http.ResponseWriter, r *http.Request) {}
func (h *AccountHandler) Get(w http.ResponseWriter, r *http.Request) {
pageSize := int32(30)
- filterAccountType := upclient.AccountTypeEnum("SAVER")
filterOwnershipType := upclient.OwnershipTypeEnum("INDIVIDUAL")
- resp, r2, err := h.UpClient.AccountsAPI.AccountsGet(h.UpAuth).PageSize(pageSize).FilterAccountType(filterAccountType).FilterOwnershipType(filterOwnershipType).Execute()
-
+ resp, r2, err := h.UpClient.AccountsAPI.AccountsGet(h.UpAuth).PageSize(pageSize).FilterOwnershipType(filterOwnershipType).Execute()
+ h.Log.Println(resp)
if err != nil {
fmt.Fprintf(w, "Error when calling `AccountsAPI.AccountsGet``: %v\n", err)
fmt.Fprintf(w, "Full HTTP response: %v\n", r2)
h.Log.Println("Unable to get account information")
}
- fmt.Fprintf(w, "Response from `AccountsAPI.AccountsGet`: %v\n", resp)
+ // fmt.Fprintf(w, "Response from `AccountsAPI.AccountsGet`: %v\n", resp)
+ templates.Accounts(resp.Data).Render(r.Context(), w)
}
diff --git a/datafetcher/handlers/transactions.go b/datafetcher/handlers/transactions.go
index 5c980c7..f7e0deb 100644
--- a/datafetcher/handlers/transactions.go
+++ b/datafetcher/handlers/transactions.go
@@ -2,11 +2,12 @@ package handlers
import (
"context"
- "encoding/json"
"fmt"
"log"
"net/http"
+ "github.com/esteanes/expense-manager/datafetcher/templates"
+
"github.com/esteanes/expense-manager/datafetcher/upclient"
)
@@ -29,19 +30,12 @@ func NewTransactionHandler(log *log.Logger, upclient *upclient.APIClient, auth c
func (h *TransactionsHandler) Post(w http.ResponseWriter, r *http.Request) {}
func (h *TransactionsHandler) Get(w http.ResponseWriter, r *http.Request) {
pageSize := int32(30) // int32 | The number of records to return in each page. (optional)
- resp2, r2, err := h.UpClient.TransactionsAPI.TransactionsGet(h.UpAuth).PageSize(pageSize).Execute()
+ resp, r2, err := h.UpClient.TransactionsAPI.TransactionsGet(h.UpAuth).PageSize(pageSize).Execute()
if err != nil {
fmt.Fprintf(w, "Error when calling `TransactionsAPI.TransactionsGet``: %v\n", err)
fmt.Fprintf(w, "Full HTTP response: %v\n", r2.Body)
h.Log.Println(r2.Body)
}
// response from `TransactionsGet`: ListTransactionsResponse
- fmt.Fprintf(w, "Response from `TransactionsAPI.TransactionsGet`: %v\n", resp2)
- jsonString := `{"account":{"data":{"type":"accounts","id":"a90b55ad-1bcb-4e75-b407-0e0e1e5c8a6d"},"links":{"related":"https://api.up.com.au/api/v1/accounts/a90b55ad-1bcb-4e75-b407-0e0e1e5c8a6d"}},"transferAccount":{"data":null},"category":{"data":{"type":"categories","id":"public-transport"},"links":{"self":"https://api.up.com.au/api/v1/transactions/e33e57c4-efa9-496d-83bd-e1f8c0b9651c/relationships/category","related":"https://api.up.com.au/api/v1/categories/public-transport"}},"parentCategory":{"data":{"type":"categories","id":"transport"},"links":{"related":"https://api.up.com.au/api/v1/categories/transport"}},"tags":{"data":[],"links":{"self":"https://api.up.com.au/api/v1/transactions/e33e57c4-efa9-496d-83bd-e1f8c0b9651c/relationships/tags"}},"attachment":{"data":null}}`
- var manualResponse upclient.TransactionResourceRelationships
- err = json.Unmarshal([]byte(jsonString), &manualResponse)
- fmt.Fprintf(w, "Manual json unmarshalling: %v\n", manualResponse)
- if err != nil {
- fmt.Fprintf(w, "error unmarshalling: %s\n", err)
- }
+ templates.Transactions(resp.Data).Render(r.Context(), w)
}
diff --git a/datafetcher/server.go b/datafetcher/server.go
index 894d499..6524938 100644
--- a/datafetcher/server.go
+++ b/datafetcher/server.go
@@ -7,9 +7,8 @@ import (
"net/http"
"time"
- "github.com/a-h/templ"
"github.com/esteanes/expense-manager/datafetcher/handlers"
- templates "github.com/esteanes/expense-manager/datafetcher/templ"
+ "github.com/esteanes/expense-manager/datafetcher/templates"
"github.com/esteanes/expense-manager/datafetcher/upclient"
"github.com/alexedwards/scs/v2"
@@ -88,7 +87,6 @@ func HandleRequests(upBankToken string, log *log.Logger) {
// Creating individual handlers
accountHandler := handlers.NewAccountHandler(log, apiClient, auth)
transactionsHandler := handlers.NewTransactionHandler(log, apiClient, auth)
- component := templates.Hello("its ya boi")
mux := http.NewServeMux()
mux.HandleFunc(accountHandler.Uri, accountHandler.ServeHTTP)
mux.HandleFunc(transactionsHandler.Uri, transactionsHandler.ServeHTTP)
@@ -96,7 +94,6 @@ func HandleRequests(upBankToken string, log *log.Logger) {
mux.HandleFunc("/", homePage)
mux.HandleFunc("/info", getInfo)
mux.Handle("/time", NewNowHandler(time.Now))
- mux.Handle("/hello", templ.Handler(component))
mux.HandleFunc("/counter", handleInfo)
log.Println("Serving request at localhost:8080")
muxWithSessionMiddleware := sessionManager.LoadAndSave(mux)
diff --git a/datafetcher/templ/hello.templ b/datafetcher/templ/hello.templ
deleted file mode 100644
index 6f6255e..0000000
--- a/datafetcher/templ/hello.templ
+++ /dev/null
@@ -1,5 +0,0 @@
-package templ
-
-templ Hello(name string) {
-
Hello, { name }
-}
\ No newline at end of file
diff --git a/datafetcher/templ/hello_templ.go b/datafetcher/templ/hello_templ.go
deleted file mode 100644
index ea0fb7d..0000000
--- a/datafetcher/templ/hello_templ.go
+++ /dev/null
@@ -1,48 +0,0 @@
-// Code generated by templ - DO NOT EDIT.
-
-// templ: version: v0.2.747
-package templ
-
-//lint:file-ignore SA4006 This context is only used if a nested component is present.
-
-import "github.com/a-h/templ"
-import templruntime "github.com/a-h/templ/runtime"
-
-func Hello(name string) templ.Component {
- return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
- templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
- templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
- if !templ_7745c5c3_IsBuffer {
- defer func() {
- templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
- if templ_7745c5c3_Err == nil {
- templ_7745c5c3_Err = templ_7745c5c3_BufErr
- }
- }()
- }
- ctx = templ.InitializeContext(ctx)
- templ_7745c5c3_Var1 := templ.GetChildren(ctx)
- if templ_7745c5c3_Var1 == nil {
- templ_7745c5c3_Var1 = templ.NopComponent
- }
- ctx = templ.ClearChildren(ctx)
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("Hello, ")
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- var templ_7745c5c3_Var2 string
- templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(name)
- if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templ/hello.templ`, Line: 4, Col: 19}
- }
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- return templ_7745c5c3_Err
- })
-}
diff --git a/datafetcher/templates/accounts.templ b/datafetcher/templates/accounts.templ
new file mode 100644
index 0000000..4d33a8f
--- /dev/null
+++ b/datafetcher/templates/accounts.templ
@@ -0,0 +1,31 @@
+package templates
+
+import (
+ "github.com/esteanes/expense-manager/datafetcher/upclient"
+ "strings"
+)
+
+templ Accounts(accounts []upclient.AccountResource) {
+
+
+
+
+
+ Accounts
+
+
+ Accounts
+
+ for _, account := range accounts {
+
+
{ account.Attributes.DisplayName }
+
Account Type: { strings.ToTitle(string(account.Attributes.AccountType)) }
+
Balance: { account.Attributes.Balance.CurrencyCode } { account.Attributes.Balance.Value }
+
Created At: { account.Attributes.CreatedAt.String() }
+
+
+ }
+
+
+
+}
diff --git a/datafetcher/templates/accounts_templ.go b/datafetcher/templates/accounts_templ.go
new file mode 100644
index 0000000..0e97308
--- /dev/null
+++ b/datafetcher/templates/accounts_templ.go
@@ -0,0 +1,118 @@
+// Code generated by templ - DO NOT EDIT.
+
+// templ: version: v0.2.771
+package templates
+
+//lint:file-ignore SA4006 This context is only used if a nested component is present.
+
+import "github.com/a-h/templ"
+import templruntime "github.com/a-h/templ/runtime"
+
+import "strings"
+
+import (
+ "github.com/esteanes/expense-manager/datafetcher/upclient"
+)
+
+func Accounts(accounts []upclient.AccountResource) templ.Component {
+ return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
+ if !templ_7745c5c3_IsBuffer {
+ defer func() {
+ templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err == nil {
+ templ_7745c5c3_Err = templ_7745c5c3_BufErr
+ }
+ }()
+ }
+ ctx = templ.InitializeContext(ctx)
+ templ_7745c5c3_Var1 := templ.GetChildren(ctx)
+ if templ_7745c5c3_Var1 == nil {
+ templ_7745c5c3_Var1 = templ.NopComponent
+ }
+ ctx = templ.ClearChildren(ctx)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("AccountsAccounts
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ for _, account := range accounts {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var2 string
+ templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(account.Attributes.DisplayName)
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/accounts.templ`, Line: 22, Col: 43}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Account Type: ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var3 string
+ templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(strings.ToTitle(string(account.Attributes.AccountType)))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/accounts.templ`, Line: 23, Col: 81}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Balance: ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var4 string
+ templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(account.Attributes.Balance.CurrencyCode)
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/accounts.templ`, Line: 24, Col: 60}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var5 string
+ templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(account.Attributes.Balance.Value)
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/accounts.templ`, Line: 24, Col: 95}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Created At: ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var6 string
+ templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(account.Attributes.CreatedAt.String())
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/accounts.templ`, Line: 25, Col: 61}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ return templ_7745c5c3_Err
+ })
+}
+
+var _ = templruntime.GeneratedTemplate
diff --git a/datafetcher/templ/components.templ b/datafetcher/templates/components.templ
similarity index 96%
rename from datafetcher/templ/components.templ
rename to datafetcher/templates/components.templ
index 2bbda5a..0f380f0 100644
--- a/datafetcher/templ/components.templ
+++ b/datafetcher/templates/components.templ
@@ -1,4 +1,4 @@
-package templ
+package templates
import (
"strconv"
diff --git a/datafetcher/templ/components_templ.go b/datafetcher/templates/components_templ.go
similarity index 96%
rename from datafetcher/templ/components_templ.go
rename to datafetcher/templates/components_templ.go
index 3b37a7e..6406894 100644
--- a/datafetcher/templ/components_templ.go
+++ b/datafetcher/templates/components_templ.go
@@ -1,7 +1,7 @@
// Code generated by templ - DO NOT EDIT.
-// templ: version: v0.2.747
-package templ
+// templ: version: v0.2.771
+package templates
//lint:file-ignore SA4006 This context is only used if a nested component is present.
@@ -38,7 +38,7 @@ func TimeComponent(d time.Time) templ.Component {
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(d.String())
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templ/components.templ`, Line: 8, Col: 18}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/components.templ`, Line: 8, Col: 18}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
@@ -103,7 +103,7 @@ func counts(global, user int) templ.Component {
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(global))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templ/components.templ`, Line: 17, Col: 36}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/components.templ`, Line: 17, Col: 36}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
@@ -116,7 +116,7 @@ func counts(global, user int) templ.Component {
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(user))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templ/components.templ`, Line: 18, Col: 32}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/components.templ`, Line: 18, Col: 32}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
if templ_7745c5c3_Err != nil {
@@ -185,3 +185,5 @@ func Page(global, user int) templ.Component {
return templ_7745c5c3_Err
})
}
+
+var _ = templruntime.GeneratedTemplate
diff --git a/datafetcher/templates/transactions.templ b/datafetcher/templates/transactions.templ
new file mode 100644
index 0000000..a229676
--- /dev/null
+++ b/datafetcher/templates/transactions.templ
@@ -0,0 +1,85 @@
+package templates
+
+import "github.com/esteanes/expense-manager/datafetcher/upclient"
+
+func getMessage(transaction upclient.TransactionResource) string {
+ maybeString := transaction.Attributes.Message.Get()
+ if maybeString == nil {
+ return ""
+ }
+ return *maybeString
+}
+
+func getCardPurchase(transaction upclient.TransactionResource) string {
+ maybeCardPurchase := transaction.Attributes.CardPurchaseMethod.Get()
+ if maybeCardPurchase == nil {
+ return ""
+ }
+ return string(maybeCardPurchase.Method)
+}
+
+func getCardPurchaseNumber(transaction upclient.TransactionResource) string {
+ maybeCardPurchase := transaction.Attributes.CardPurchaseMethod.Get()
+ if maybeCardPurchase == nil {
+ return ""
+ }
+ maybePurchaseNumber := maybeCardPurchase.CardNumberSuffix.Get()
+ if maybePurchaseNumber == nil {
+ return ""
+ }
+ return *maybePurchaseNumber
+}
+
+templ Transactions(transactions []upclient.TransactionResource) {
+
+
+
+
+
+ Transactions
+
+
+
+ Transactions
+
+
+
+ Transaction Amount |
+ Description |
+ Status |
+ Time |
+ Message |
+ Purchase Method |
+ Card Number |
+
+
+
+ for _, transaction := range(transactions) {
+
+ { transaction.Attributes.Amount.Value } |
+ { transaction.Attributes.Description } |
+ { string(transaction.Attributes.Status) } |
+ { transaction.Attributes.CreatedAt.String() } |
+ { getMessage(transaction) } |
+ { getCardPurchase(transaction) } |
+ { getCardPurchaseNumber(transaction) } |
+
+ }
+
+
+
+
+}
diff --git a/datafetcher/templates/transactions_templ.go b/datafetcher/templates/transactions_templ.go
new file mode 100644
index 0000000..11e0605
--- /dev/null
+++ b/datafetcher/templates/transactions_templ.go
@@ -0,0 +1,170 @@
+// Code generated by templ - DO NOT EDIT.
+
+// templ: version: v0.2.771
+package templates
+
+//lint:file-ignore SA4006 This context is only used if a nested component is present.
+
+import "github.com/a-h/templ"
+import templruntime "github.com/a-h/templ/runtime"
+
+import (
+ "github.com/esteanes/expense-manager/datafetcher/upclient"
+)
+
+func getMessage(transaction upclient.TransactionResource) string {
+ maybeString := transaction.Attributes.Message.Get()
+ if maybeString == nil {
+ return ""
+ }
+ return *maybeString
+}
+
+func getCardPurchase(transaction upclient.TransactionResource) string {
+ maybeCardPurchase := transaction.Attributes.CardPurchaseMethod.Get()
+ if maybeCardPurchase == nil {
+ return ""
+ }
+ return string(maybeCardPurchase.Method)
+}
+
+func getCardPurchaseNumber(transaction upclient.TransactionResource) string {
+ maybeCardPurchase := transaction.Attributes.CardPurchaseMethod.Get()
+ if maybeCardPurchase == nil {
+ return ""
+ }
+ maybePurchaseNumber := maybeCardPurchase.CardNumberSuffix.Get()
+ if maybePurchaseNumber == nil {
+ return ""
+ }
+ return *maybePurchaseNumber
+}
+
+func Transactions(transactions []upclient.TransactionResource) templ.Component {
+ return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
+ if !templ_7745c5c3_IsBuffer {
+ defer func() {
+ templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err == nil {
+ templ_7745c5c3_Err = templ_7745c5c3_BufErr
+ }
+ }()
+ }
+ ctx = templ.InitializeContext(ctx)
+ templ_7745c5c3_Var1 := templ.GetChildren(ctx)
+ if templ_7745c5c3_Var1 == nil {
+ templ_7745c5c3_Var1 = templ.NopComponent
+ }
+ ctx = templ.ClearChildren(ctx)
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("TransactionsTransactions
Transaction Amount | Description | Status | Time | Message | Purchase Method | Card Number |
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ for _, transaction := range transactions {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var2 string
+ templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(transaction.Attributes.Amount.Value)
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/transactions.templ`, Line: 76, Col: 56}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" | ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var3 string
+ templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(transaction.Attributes.Description)
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/transactions.templ`, Line: 77, Col: 55}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" | ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var4 string
+ templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(string(transaction.Attributes.Status))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/transactions.templ`, Line: 78, Col: 58}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" | ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var5 string
+ templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(transaction.Attributes.CreatedAt.String())
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/transactions.templ`, Line: 79, Col: 62}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" | ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var6 string
+ templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(getMessage(transaction))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/transactions.templ`, Line: 80, Col: 44}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" | ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var7 string
+ templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(getCardPurchase(transaction))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/transactions.templ`, Line: 81, Col: 49}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" | ")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ var templ_7745c5c3_Var8 string
+ templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(getCardPurchaseNumber(transaction))
+ if templ_7745c5c3_Err != nil {
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `datafetcher/templates/transactions.templ`, Line: 82, Col: 55}
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" |
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ return templ_7745c5c3_Err
+ })
+}
+
+var _ = templruntime.GeneratedTemplate
diff --git a/go.mod b/go.mod
index b34b192..5b5a37e 100644
--- a/go.mod
+++ b/go.mod
@@ -3,7 +3,7 @@ module github.com/esteanes/expense-manager
go 1.21.5
require (
- github.com/a-h/templ v0.2.747
+ github.com/a-h/templ v0.2.771
github.com/alexedwards/scs/v2 v2.8.0
github.com/stretchr/testify v1.9.0
)
diff --git a/go.sum b/go.sum
index 4fbc7cf..be64eb6 100644
--- a/go.sum
+++ b/go.sum
@@ -1,5 +1,5 @@
-github.com/a-h/templ v0.2.747 h1:D0dQ2lxC3W7Dxl6fxQ/1zZHBQslSkTSvl5FxP/CfdKg=
-github.com/a-h/templ v0.2.747/go.mod h1:69ObQIbrcuwPCU32ohNaWce3Cb7qM5GMiqN1K+2yop4=
+github.com/a-h/templ v0.2.771 h1:4KH5ykNigYGGpCe0fRJ7/hzwz72k3qFqIiiLLJskbSo=
+github.com/a-h/templ v0.2.771/go.mod h1:lq48JXoUvuQrU0VThrK31yFwdRjTCnIE5bcPCM9IP1w=
github.com/alexedwards/scs/v2 v2.8.0 h1:h31yUYoycPuL0zt14c0gd+oqxfRwIj6SOjHdKRZxhEw=
github.com/alexedwards/scs/v2 v2.8.0/go.mod h1:ToaROZxyKukJKT/xLcVQAChi5k6+Pn1Gvmdl7h3RRj8=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=