diff --git a/src/.env b/src/.env new file mode 100644 index 0000000..61ac8c6 --- /dev/null +++ b/src/.env @@ -0,0 +1,2 @@ +registry=dir.esilva.org +repo=esilva diff --git a/src/.golangci.yaml b/src/.golangci.yaml new file mode 100644 index 0000000..1212311 --- /dev/null +++ b/src/.golangci.yaml @@ -0,0 +1,11 @@ +version: "2" +linters: + default: all + disable: + - wsl + - depguard + - varnamelen + - wrapcheck + - wsl_v5 + - exhaustruct + - gochecknoglobals diff --git a/src/api/api.go b/src/api/api.go index 0558788..d72cec1 100644 --- a/src/api/api.go +++ b/src/api/api.go @@ -1,3 +1,4 @@ +// package api will handle the JSON REST API responsabilities package api import "github.com/gin-gonic/gin" diff --git a/src/api/apiTypes.go b/src/api/apiTypes.go index b33b423..fac5b2c 100644 --- a/src/api/apiTypes.go +++ b/src/api/apiTypes.go @@ -22,6 +22,7 @@ func getAllTypes(c *gin.Context) { c.JSON(http.StatusOK, gin.H{"users": types}) } +// RouteTypes will route the endpoints for the types resources func RouteTypes(router *gin.RouterGroup) { router.GET("types", getAllTypes) } diff --git a/src/api/apiUsers.go b/src/api/apiUsers.go index a4fe81a..7bb44d4 100644 --- a/src/api/apiUsers.go +++ b/src/api/apiUsers.go @@ -22,6 +22,7 @@ func getAllUsers(c *gin.Context) { c.JSON(http.StatusOK, gin.H{"users": users}) } +// RouteUsers will route the endpoints for the users resources func RouteUsers(router *gin.RouterGroup) { router.GET("users", getAllUsers) } diff --git a/src/api/auth.go b/src/api/auth.go index 6df337c..7096be2 100644 --- a/src/api/auth.go +++ b/src/api/auth.go @@ -5,6 +5,7 @@ import ( "strings" expauth "expenses/expenses/auth" + "github.com/gin-gonic/gin" ) @@ -12,6 +13,7 @@ type TokenData struct { Token string `json:"JWTToken"` } +// APIAuhtMiddleWare will handle this API authentication func APIAuthMiddleWare() gin.HandlerFunc { return func(c *gin.Context) { auth := c.GetHeader("Authorization") diff --git a/src/expenses/app.go b/src/expenses/app.go index 87ce216..f479331 100644 --- a/src/expenses/app.go +++ b/src/expenses/app.go @@ -1,17 +1,20 @@ +// Package expenses will be the core of the expenses splitter webapp's functionalities package expenses import ( "context" - "expenses/config" - "expenses/expenses/repo" "log" "strings" + "expenses/config" + "expenses/expenses/repo" + "github.com/jackc/pgx/v5/pgxpool" lua "github.com/yuin/gopher-lua" ) -type ExpensesApp struct { +// ExpApp is the data structure for the main runtime of this application. +type ExpApp struct { Lua *lua.LState ExpRepo repo.ExpenseRepository CategoryRepo repo.CategoryRepository @@ -21,29 +24,33 @@ type ExpensesApp struct { } var ( - App *ExpensesApp + // App provides access to the expenses main service. + App *ExpApp ) -func NewExpenseApp(db *pgxpool.Pool, luaVM *lua.LState) *ExpensesApp { - return &ExpensesApp{ - ExpRepo: repo.NewPgExpRepo(db), - CategoryRepo: repo.NewPgCatRepo(db), - UserRepo: repo.NewPgUserRepo(db), - StoreRepo: repo.NewPgStoreRepo(db), - TypeRepo: repo.NewPgTypeRepo(db), +// NewExpenseApp returns a new instance of our core App. +func NewExpenseApp(dbPool *pgxpool.Pool, luaVM *lua.LState) *ExpApp { + return &ExpApp{ + ExpRepo: repo.NewPgExpRepo(dbPool), + CategoryRepo: repo.NewPgCatRepo(dbPool), + UserRepo: repo.NewPgUserRepo(dbPool), + StoreRepo: repo.NewPgStoreRepo(dbPool), + TypeRepo: repo.NewPgTypeRepo(dbPool), Lua: luaVM, } } -func (a *ExpensesApp) Close() { - // TODO - // Close the repos? +// Close will close this ExpApp instance. +func (a *ExpApp) Close() { + // TODO - Close the repos? a.Lua.Close() } -func StartLuaVM() (*lua.LState, error) { +// startLuaVM creates the LuaVM we require to run our custom scripts. +func startLuaVM() (*lua.LState, error) { L := lua.NewState() App.registerLuaBinds(L) + return L, nil } @@ -75,7 +82,8 @@ func runMigrations(luaVM *lua.LState) error { return nil } -func (a *ExpensesApp) GoToMigration(id uint) error { +// GoToMigration provides a way to force moving to the specified migration. +func (a *ExpApp) GoToMigration(id uint) error { migrator, err := repo.NewPgMigrator() if err != nil { return err @@ -84,6 +92,7 @@ func (a *ExpensesApp) GoToMigration(id uint) error { return migrator.Goto(id) } +// StartApp will configure and open the required connections to run this app. func StartApp() error { config.SetConfig("./config.yaml") cfg := config.GetInstance() @@ -91,7 +100,7 @@ func StartApp() error { pgStr := getPgConnString(cfg) // Create the LuaVM - luaVM, err := StartLuaVM() + luaVM, err := startLuaVM() if err != nil { return err } diff --git a/src/expenses/auth/authMiddlware.go b/src/expenses/auth/authMiddlware.go index 41453d0..87f299f 100644 --- a/src/expenses/auth/authMiddlware.go +++ b/src/expenses/auth/authMiddlware.go @@ -11,6 +11,8 @@ import ( mod "expenses/expenses/models" ) +// AuthMiddleware is the middleware we will use to verify if a user is +// authenticated or not func AuthMiddleware() gin.HandlerFunc { log.Println("Are we authing?") return func(c *gin.Context) { diff --git a/src/expenses/categories.go b/src/expenses/categories.go index e3df240..84edb4d 100644 --- a/src/expenses/categories.go +++ b/src/expenses/categories.go @@ -5,16 +5,20 @@ import ( mod "expenses/expenses/models" ) -func (a *ExpensesApp) GetAllCategories(ctx context.Context) ([]mod.Category, error) { +// GetAllCategories returns all categories. +func (a *ExpApp) GetAllCategories(ctx context.Context) ([]mod.Category, error) { return a.CategoryRepo.GetAll(ctx) } -func (a *ExpensesApp) GetCategory(id int32) (mod.Category, error) { +// GetCategory returns a category by its ID. +func (a *ExpApp) GetCategory(id int32) (mod.Category, error) { ctx := context.Background() + return a.CategoryRepo.Get(ctx, id) } -func (a *ExpensesApp) CreateCategory(name string) error { +// CreateCategory creates a new category. +func (a *ExpApp) CreateCategory(name string) error { ctx := context.Background() newCat := mod.Category{ @@ -24,7 +28,8 @@ func (a *ExpensesApp) CreateCategory(name string) error { return a.CategoryRepo.Insert(ctx, newCat) } -func (a *ExpensesApp) UpdateCategory(id int32, name string) error { +// UpdateCategory updates a category by its ID. +func (a *ExpApp) UpdateCategory(id int32, name string) error { ctx := context.Background() cat := mod.Category{ @@ -35,7 +40,9 @@ func (a *ExpensesApp) UpdateCategory(id int32, name string) error { return a.CategoryRepo.Update(ctx, cat) } -func (a *ExpensesApp) DeleteCategory(id int32) error { +// DeleteCategory deletes a category by its ID. +func (a *ExpApp) DeleteCategory(id int32) error { ctx := context.Background() + return a.CategoryRepo.Delete(ctx, id) } diff --git a/src/expenses/errors/errors.go b/src/expenses/errors/errors.go index 24be0e6..5c3c440 100644 --- a/src/expenses/errors/errors.go +++ b/src/expenses/errors/errors.go @@ -1,8 +1,8 @@ +// Package errors package will have custom errors for the expenses package package errors import "fmt" var ( - ErrNotFound = fmt.Errorf("not found") + ErrNotFound = fmt.Errorf("not found") // ErrNotFound is used for not found data ) - diff --git a/src/expenses/expenseDebts.go b/src/expenses/expenseDebts.go index 463a644..e56fc58 100644 --- a/src/expenses/expenseDebts.go +++ b/src/expenses/expenseDebts.go @@ -8,19 +8,24 @@ import ( dec "github.com/shopspring/decimal" ) -type UserTab struct { +// userTab describes the tab a given user has. +type userTab struct { User mod.User Sum dec.Decimal } -type UserTabs []UserTab -func (ut UserTabs) SortBySum() { +// userTabs is a list of UserTab. +type userTabs []userTab + +// SortBySum sorts the list of UserTab by the attrib Sum. +func (ut userTabs) SortBySum() { sort.Slice(ut, func(i, j int) bool { return ut[i].Sum.Cmp(ut[j].Sum) > 0 }) } -func (ut UserTabs) Equal(t UserTabs) bool { +// Equal returns the equality of the passed UserTab. +func (ut userTabs) Equal(t userTabs) bool { if len(ut) != len(t) { return false } @@ -34,24 +39,24 @@ func (ut UserTabs) Equal(t UserTabs) bool { return true } -func filterExpenseParticipants(e *mod.Expense) (UserTabs, UserTabs) { +func filterExpenseParticipants(e *mod.Expense) (userTabs, userTabs) { shares := mapShares(e) payments := mapPayments(e) - debtors := UserTabs{} - creditors := UserTabs{} + debtors := userTabs{} + creditors := userTabs{} for user, share := range shares { debt := share.Sub(payments[user]) if debt.LessThan(dec.NewFromFloat(0.0)) { - creditors = append(creditors, UserTab{ + creditors = append(creditors, userTab{ User: user, Sum: debt.Abs(), }) } if debt.GreaterThan(dec.NewFromFloat(0.0)) { - debtors = append(debtors, UserTab{ + debtors = append(debtors, userTab{ User: user, Sum: debt.Abs(), }) @@ -66,13 +71,13 @@ func filterExpenseParticipants(e *mod.Expense) (UserTabs, UserTabs) { // TODO // Instead of doing this impererively (I think?) create a struct that can -// handle doing the accounting while collecting the data instead -type CompoundKey struct { +// handle doing the accounting while collecting the data instead. +type compoundeKey struct { Debtor mod.User Creditor mod.User } -func resolveDebt(creditor UserTab, debtors UserTabs) mod.Debts { +func resolveDebt(creditor userTab, debtors userTabs) mod.Debts { debts := mod.Debts{} credit := creditor.Sum @@ -101,14 +106,14 @@ func resolveDebt(creditor UserTab, debtors UserTabs) mod.Debts { return debts } -func resolveDebts(debtors UserTabs, creditors UserTabs) mod.Debts { - keyedDebts := make(map[CompoundKey]dec.Decimal) +func resolveDebts(debtors userTabs, creditors userTabs) mod.Debts { + keyedDebts := make(map[compoundeKey]dec.Decimal) for _, creditor := range creditors { debt := resolveDebt(creditor, debtors) for _, d := range debt { - key := CompoundKey{Debtor: d.Debtor, Creditor: d.Creditor} + key := compoundeKey{Debtor: d.Debtor, Creditor: d.Creditor} if _, ok := keyedDebts[key]; ok { keyedDebts[key] = keyedDebts[key].Add(d.Sum) } else { @@ -149,16 +154,16 @@ func CalculateDebts(e *mod.Expense) (mod.Debts, error) { // This won't work if the payment was made with multiple payments - but for my // use case that won't be a thing. Right now every expense I introduce has been // fully payed in one go -func (a *ExpensesApp) settleDebt(payment mod.Payment, - credit mod.Payment, eId int32) error { +func (a *ExpApp) settleDebt(payment mod.Payment, + credit mod.Payment, eID int32) error { ctx := context.Background() credit.PayedAmount = credit.PayedAmount.Sub(payment.PayedAmount) - return a.ExpRepo.SettleDebt(ctx, eId, payment, credit) + return a.ExpRepo.SettleDebt(ctx, eID, payment, credit) } -func (a *ExpensesApp) ProcessDebt(expID int32, debt mod.Debt) error { +func (a *ExpApp) ProcessDebt(expID int32, debt mod.Debt) error { // We have to balance the debtor and creditor payments payment := mod.Payment{ User: mod.User{ diff --git a/src/expenses/expenseDebts_aux.go b/src/expenses/expenseDebts_aux.go index c6bb12f..0e076eb 100644 --- a/src/expenses/expenseDebts_aux.go +++ b/src/expenses/expenseDebts_aux.go @@ -21,32 +21,32 @@ func NewDebtCalculator(e *mod.Expense) *DebtCalculator { } // TODO -// This code will be replicated in the expenses controller but without +// This code will be replicated in the expenses controller but without // the dc -func (dc *DebtCalculator) mapShares() { - for _, share := range dc.Expense.Shares { - dc.Shares[share.User] = share.Share - dc.Payments[share.User] = decimal.NewFromInt(0) - } -} +// func (dc *DebtCalculator) mapShares() { +// for _, share := range dc.Expense.Shares { +// dc.Shares[share.User] = share.Share +// dc.Payments[share.User] = decimal.NewFromInt(0) +// } +// } -func (dc *DebtCalculator) mapPayments() { - for _, payment := range dc.Expense.Payments { - dc.Payments[payment.User] = dc.Payments[payment.User].Add(payment.PayedAmount) - } -} +// func (dc *DebtCalculator) mapPayments() { +// for _, payment := range dc.Expense.Payments { +// dc.Payments[payment.User] = dc.Payments[payment.User].Add(payment.PayedAmount) +// } +// } -func (dc *DebtCalculator) getDebts() []mod.Debt { - debts := []mod.Debt{} - - for user := range dc.Payments { - // debt := (dc.Shares[user] * dc.Expense.Value) - dc.Payments[user] - debt := (dc.Shares[user].Mul(dc.Expense.Value)).Sub(dc.Payments[user]) - - if debt.GreaterThan(decimal.NewFromInt(0)) { - debts = append(debts, mod.Debt{Debtor: user, Sum: debt}) - } - } - - return debts -} +// func (dc *DebtCalculator) getDebts() []mod.Debt { +// debts := []mod.Debt{} +// +// for user := range dc.Payments { +// // debt := (dc.Shares[user] * dc.Expense.Value) - dc.Payments[user] +// debt := (dc.Shares[user].Mul(dc.Expense.Value)).Sub(dc.Payments[user]) +// +// if debt.GreaterThan(decimal.NewFromInt(0)) { +// debts = append(debts, mod.Debt{Debtor: user, Sum: debt}) +// } +// } +// +// return debts +// } diff --git a/src/expenses/expenseDebts_aux_test.go b/src/expenses/expenseDebts_aux_test.go index 2ecb9b5..e67ee12 100644 --- a/src/expenses/expenseDebts_aux_test.go +++ b/src/expenses/expenseDebts_aux_test.go @@ -143,20 +143,20 @@ var ( }, } - expense4 = mod.Expense{ - ExpID: 7, - Value: dec.NewFromFloat(0.50), - Shares: []mod.Share{ - {ExpShareID: 0, User: user1, Share: dec.NewFromFloat(0.34)}, - {ExpShareID: 1, User: user2, Share: dec.NewFromFloat(0.33)}, - {ExpShareID: 2, User: user3, Share: dec.NewFromFloat(0.33)}, - }, - Payments: []mod.Payment{ - {ExpPaymID: 0, User: user1, PayedAmount: dec.NewFromFloat(0.18)}, - {ExpPaymID: 1, User: user1, PayedAmount: dec.NewFromFloat(0.16)}, - {ExpPaymID: 2, User: user2, PayedAmount: dec.NewFromFloat(0.16)}, - }, - } + // expense4 = mod.Expense{ + // ExpID: 7, + // Value: dec.NewFromFloat(0.50), + // Shares: []mod.Share{ + // {ExpShareID: 0, User: user1, Share: dec.NewFromFloat(0.34)}, + // {ExpShareID: 1, User: user2, Share: dec.NewFromFloat(0.33)}, + // {ExpShareID: 2, User: user3, Share: dec.NewFromFloat(0.33)}, + // }, + // Payments: []mod.Payment{ + // {ExpPaymID: 0, User: user1, PayedAmount: dec.NewFromFloat(0.18)}, + // {ExpPaymID: 1, User: user1, PayedAmount: dec.NewFromFloat(0.16)}, + // {ExpPaymID: 2, User: user2, PayedAmount: dec.NewFromFloat(0.16)}, + // }, + // } expense5 = mod.Expense{ ExpID: 9, diff --git a/src/expenses/expenseDebts_test.go b/src/expenses/expenseDebts_test.go index b6fc73a..764bd2d 100644 --- a/src/expenses/expenseDebts_test.go +++ b/src/expenses/expenseDebts_test.go @@ -12,17 +12,17 @@ func TestFilterExpenseParticipants(t *testing.T) { testCases := []struct { name string exp *mod.Expense - expectedDebtors UserTabs - expectedCreditors UserTabs + expectedDebtors userTabs + expectedCreditors userTabs }{ { name: "Expense something something", exp: &expense2, - expectedCreditors: UserTabs{ + expectedCreditors: userTabs{ {User: user1, Sum: dec.NewFromFloat(32.0)}, {User: user3, Sum: dec.NewFromFloat(22.0)}, }, - expectedDebtors: UserTabs{ + expectedDebtors: userTabs{ {User: user2, Sum: dec.NewFromFloat(43.0)}, {User: user4, Sum: dec.NewFromFloat(11.0)}, }, @@ -30,10 +30,10 @@ func TestFilterExpenseParticipants(t *testing.T) { { name: "Expense cents", exp: &expense6, - expectedCreditors: UserTabs{ + expectedCreditors: userTabs{ {User: user1, Sum: dec.NewFromFloat(0.32)}, }, - expectedDebtors: UserTabs{ + expectedDebtors: userTabs{ {User: user2, Sum: dec.NewFromFloat(0.16)}, {User: user3, Sum: dec.NewFromFloat(0.16)}, }, @@ -59,18 +59,18 @@ func TestFilterExpenseParticipants(t *testing.T) { func TestResolveDebt_ExactDebtsForCredit(t *testing.T) { // Test1: // Debt is solvable - debtors := UserTabs{ + debtors := userTabs{ {User: user1, Sum: dec.NewFromFloat(10.0)}, {User: user2, Sum: dec.NewFromFloat(10.0)}, {User: user3, Sum: dec.NewFromFloat(10.0)}, } - creditor := UserTab{User: user4, Sum: dec.NewFromFloat(30.0)} + creditor := userTab{User: user4, Sum: dec.NewFromFloat(30.0)} expectedDebts := mod.Debts{ {Creditor: user4, Debtor: user1, Sum: dec.NewFromFloat(10.0)}, {Creditor: user4, Debtor: user2, Sum: dec.NewFromFloat(10.0)}, {Creditor: user4, Debtor: user3, Sum: dec.NewFromFloat(10.0)}, } - expectedDebtors := UserTabs{ + expectedDebtors := userTabs{ {User: user1, Sum: dec.NewFromFloat(0.0)}, {User: user2, Sum: dec.NewFromFloat(0.0)}, {User: user3, Sum: dec.NewFromFloat(0.0)}, @@ -92,11 +92,11 @@ func TestResolveDebt_ExactDebtsForCredit(t *testing.T) { func TestResolveDebt_LessDebtsThanCredit(t *testing.T) { // Test2: // Debt is not solvable: - debtors := UserTabs{ + debtors := userTabs{ {User: user1, Sum: dec.NewFromFloat(10.0)}, {User: user2, Sum: dec.NewFromFloat(10.0)}, } - creditor := UserTab{User: user4, Sum: dec.NewFromFloat(30.0)} + creditor := userTab{User: user4, Sum: dec.NewFromFloat(30.0)} expectedDebts := mod.Debts{ {Creditor: user4, Debtor: user1, Sum: dec.NewFromFloat(10.0)}, {Creditor: user4, Debtor: user2, Sum: dec.NewFromFloat(10.0)}, @@ -111,12 +111,12 @@ func TestResolveDebt_LessDebtsThanCredit(t *testing.T) { } func TestResolveDebt_EnoughDebtsForCredit(t *testing.T) { - debtors := UserTabs{ + debtors := userTabs{ {User: user1, Sum: dec.NewFromFloat(10.0)}, {User: user2, Sum: dec.NewFromFloat(10.0)}, {User: user3, Sum: dec.NewFromFloat(10.0)}, } - creditor := UserTab{User: user4, Sum: dec.NewFromFloat(10.0)} + creditor := userTab{User: user4, Sum: dec.NewFromFloat(10.0)} expectedDebts := mod.Debts{ {Creditor: user4, Debtor: user1, Sum: dec.NewFromFloat(10.0)}, } @@ -130,13 +130,13 @@ func TestResolveDebt_EnoughDebtsForCredit(t *testing.T) { } func TestResolveDebt_RenameMe(t *testing.T) { - debtors := UserTabs{ + debtors := userTabs{ {User: user1, Sum: dec.NewFromFloat(10.0)}, } - expectedDebtors := UserTabs{ + expectedDebtors := userTabs{ {User: user1, Sum: dec.NewFromFloat(3.0)}, } - creditor := UserTab{User: user4, Sum: dec.NewFromFloat(7.0)} + creditor := userTab{User: user4, Sum: dec.NewFromFloat(7.0)} expectedDebts := mod.Debts{ {Creditor: user4, Debtor: user1, Sum: dec.NewFromFloat(7.0)}, } diff --git a/src/expenses/expensePayments.go b/src/expenses/expensePayments.go index 996dacf..9cc0d48 100644 --- a/src/expenses/expensePayments.go +++ b/src/expenses/expensePayments.go @@ -46,7 +46,7 @@ func ParseFormPayments(userIDs []string, paymentsIDs []string, return payments, nil } -func (a *ExpensesApp) GetExpensePaymentByUserID(eId int32, uId int32, +func (a *ExpApp) GetExpensePaymentByUserID(eId int32, uId int32, ) (mod.Payment, error) { ctx := context.Background() return a.ExpRepo.GetExpensePaymentByUserID(ctx, eId, uId) @@ -54,22 +54,22 @@ func (a *ExpensesApp) GetExpensePaymentByUserID(eId int32, uId int32, // insertPayment allows us to insert a payment manually // for now its private, need to figure out if it needs to be public -func (a *ExpensesApp) insertPayment(payment mod.Payment, eIdx int32) error { +func (a *ExpApp) insertPayment(payment mod.Payment, eIdx int32) error { ctx := context.Background() return a.ExpRepo.InsertPayment(ctx, eIdx, payment) } -func (a *ExpensesApp) DeletePayment(id int32) error { +func (a *ExpApp) DeletePayment(id int32) error { ctx := context.Background() return a.ExpRepo.DeletePayment(ctx, id) } -func (a *ExpensesApp) UpdatePayment(payment mod.Payment) error { +func (a *ExpApp) UpdatePayment(payment mod.Payment) error { ctx := context.Background() return a.ExpRepo.UpdatePayment(ctx, payment) } -func (a *ExpensesApp) AddPayment(expID int32, userID int32, sum dec.Decimal) error { +func (a *ExpApp) AddPayment(expID int32, userID int32, sum dec.Decimal) error { payment := mod.Payment{ User: mod.User{ UserID: userID, diff --git a/src/expenses/expensePayments_lua.go b/src/expenses/expensePayments_lua.go index d412142..d3d51f9 100644 --- a/src/expenses/expensePayments_lua.go +++ b/src/expenses/expensePayments_lua.go @@ -5,7 +5,7 @@ import ( lua "github.com/yuin/gopher-lua" ) -func (a *ExpensesApp) luaInsertPayment(L *lua.LState) int { +func (a *ExpApp) luaInsertPayment(L *lua.LState) int { paymentJSON := L.CheckString(1) expenseID := L.CheckInt(2) diff --git a/src/expenses/expenseShares.go b/src/expenses/expenseShares.go index 833f060..7aceb28 100644 --- a/src/expenses/expenseShares.go +++ b/src/expenses/expenseShares.go @@ -48,7 +48,7 @@ func ParseFormShares(userIDs []string, shares []string, sharesIDs []string, // NormalizeShares will take the total of an expense and the proposed shares // and calculate how much each user actually has to pay - avoids fracd cents -func (a *ExpensesApp) NormalizeShares(e *mod.Expense) error { +func (a *ExpApp) NormalizeShares(e *mod.Expense) error { excess := dec.NewFromFloat(0.0) ownerShIdx := -1 for k := range e.Shares { @@ -69,12 +69,13 @@ func (a *ExpensesApp) NormalizeShares(e *mod.Expense) error { // insertShare allows us to insert a share manually // for now its private, need to figure out if it needs to be public -func (a *ExpensesApp) insertShare(share mod.Share, eIdx int32) error { +func (a *ExpApp) insertShare(share mod.Share, eIdx int32) error { ctx := context.Background() return a.ExpRepo.InsertShare(ctx, eIdx, share) } -func (a *ExpensesApp) DeleteShare(id int32) error { +// DeleteShare will delete a share by its `id`. +func (a *ExpApp) DeleteShare(id int32) error { ctx := context.Background() return a.ExpRepo.DeleteShare(ctx, id) } diff --git a/src/expenses/expenseShares_lua.go b/src/expenses/expenseShares_lua.go index 3ed46e3..30f3014 100644 --- a/src/expenses/expenseShares_lua.go +++ b/src/expenses/expenseShares_lua.go @@ -5,7 +5,7 @@ import ( lua "github.com/yuin/gopher-lua" ) -func (a *ExpensesApp) luaInsertShare(L *lua.LState) int { +func (a *ExpApp) luaInsertShare(L *lua.LState) int { shareJson := L.CheckString(1) expenseID := L.CheckInt(2) diff --git a/src/expenses/expenseShares_test.go b/src/expenses/expenseShares_test.go index ba59e85..c4f9f3c 100644 --- a/src/expenses/expenseShares_test.go +++ b/src/expenses/expenseShares_test.go @@ -44,7 +44,7 @@ func TestNormalizeShares(t *testing.T) { } // dummy service to call it - app := ExpensesApp{} + app := ExpApp{} for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { err := app.NormalizeShares(tc.exp) diff --git a/src/expenses/expenses.go b/src/expenses/expenses.go index c1e0791..015901e 100644 --- a/src/expenses/expenses.go +++ b/src/expenses/expenses.go @@ -3,12 +3,14 @@ package expenses import ( "context" mod "expenses/expenses/models" - "github.com/shopspring/decimal" "log" "time" + + "github.com/shopspring/decimal" ) -func (a *ExpensesApp) GetAllExpenses(ctx context.Context) ([]mod.Expense, error) { +// GetAllExpenses returns the list of Expenses in which the 'user' participates +func (a *ExpApp) GetAllExpenses(ctx context.Context) ([]mod.Expense, error) { user := *ctx.Value("user").(*mod.User) expenses, err := a.ExpRepo.GetAll(ctx, user.UserID) @@ -19,7 +21,9 @@ func (a *ExpensesApp) GetAllExpenses(ctx context.Context) ([]mod.Expense, error) return expenses, nil } -func (a *ExpensesApp) GetExpensesRanged( +// TODO - make the GetAllExpenses and this function be only one +// GetExpensesRanged returns the list of Expenses in which the 'user' participates +func (a *ExpApp) GetExpensesRanged( ctx context.Context, startDate string, endDate string) ([]mod.Expense, error) { startDateTime, err := time.ParseInLocation("02-Jan-2006 15:04:05", startDate, time.UTC) if err != nil { @@ -37,7 +41,9 @@ func (a *ExpensesApp) GetExpensesRanged( return a.ExpRepo.GetExpensesRange(ctx, startDateTime, endDateTime, user.UserID) } -func (a *ExpensesApp) GetExpense(id int32) (mod.Expense, error) { +// TODO - we should only be able to access them if the user participates in them +// GetExpense returns a given expense by ID +func (a *ExpApp) GetExpense(id int32) (mod.Expense, error) { ctx := context.Background() expense, err := a.ExpRepo.Get(ctx, id) @@ -48,7 +54,8 @@ func (a *ExpensesApp) GetExpense(id int32) (mod.Expense, error) { return expense, nil } -func (a *ExpensesApp) LoadExpenseShares(e *mod.Expense) error { +// LoadExpenseShares populates the Expense with its shares from the DB +func (a *ExpApp) LoadExpenseShares(e *mod.Expense) error { ctx := context.Background() var err error @@ -57,7 +64,8 @@ func (a *ExpensesApp) LoadExpenseShares(e *mod.Expense) error { return err } -func (a *ExpensesApp) LoadExpensePayments(e *mod.Expense) error { +// LoadExpensePayments populates the Expense with its payments from the DB +func (a *ExpApp) LoadExpensePayments(e *mod.Expense) error { ctx := context.Background() var err error @@ -66,14 +74,17 @@ func (a *ExpensesApp) LoadExpensePayments(e *mod.Expense) error { return err } -func (a *ExpensesApp) LoadExpenseDebts(e *mod.Expense) error { +// LoadExpenseDebts populates the Expense with its debts from the DB +func (a *ExpApp) LoadExpenseDebts(e *mod.Expense) error { debts, _ := CalculateDebts(e) e.Debts = debts return nil } -func (a *ExpensesApp) DeleteExpense(id int32) error { +// TODO - only expenses the user participates in +// DeleteExpense deletes a given expense +func (a *ExpApp) DeleteExpense(id int32) error { ctx := context.Background() err := a.ExpRepo.Delete(ctx, id) return err @@ -126,7 +137,7 @@ func ExpenseIsEvenlyShared(exp *mod.Expense) bool { return true } -func (a *ExpensesApp) analyzeExpense(e *mod.Expense) { +func (a *ExpApp) analyzeExpense(e *mod.Expense) { // Figure out if its paid off or not by adding the existing payments e.PaidOff = e.Value.Equal(ExpenseTotalPayed(e)) @@ -137,13 +148,13 @@ func (a *ExpensesApp) analyzeExpense(e *mod.Expense) { a.NormalizeShares(e) } -func (a *ExpensesApp) NewExpense(ctx context.Context, exp mod.Expense) error { +func (a *ExpApp) NewExpense(ctx context.Context, exp mod.Expense) error { a.analyzeExpense(&exp) return a.ExpRepo.Insert(ctx, exp) } -func (a *ExpensesApp) UpdateExpense(exp mod.Expense) error { +func (a *ExpApp) UpdateExpense(exp mod.Expense) error { ctx := context.Background() // TODO diff --git a/src/expenses/expenses_lua.go b/src/expenses/expenses_lua.go index 7414ee7..3470b0b 100644 --- a/src/expenses/expenses_lua.go +++ b/src/expenses/expenses_lua.go @@ -7,7 +7,7 @@ import ( lua "github.com/yuin/gopher-lua" ) -func (a *ExpensesApp) prepareExpense(exp *mod.Expense) error { +func (a *ExpApp) prepareExpense(exp *mod.Expense) error { err := a.LoadExpensePayments(exp) if err != nil { return err @@ -21,35 +21,38 @@ func (a *ExpensesApp) prepareExpense(exp *mod.Expense) error { return nil } -func (a *ExpensesApp) luaGetAllExpenses(L *lua.LState) int { +func (a *ExpApp) luaGetAllExpenses(l *lua.LState) int { ctx := context.Background() // TODO - what do we do about the LUA API expenses, err := a.ExpRepo.GetAll(ctx, 1) + if err != nil { + return returnWithError(l, err.Error()) + } - tbl := L.NewTable() + tbl := l.NewTable() for _, e := range expenses { err = a.prepareExpense(&e) if err != nil { - return returnWithError(L, err.Error()) + return returnWithError(l, err.Error()) } jsonData, err := json.Marshal(&e) if err != nil { - return returnWithError(L, err.Error()) + return returnWithError(l, err.Error()) } - et := L.NewTable() + et := l.NewTable() et.RawSetString("expense", lua.LString(jsonData)) tbl.Append(et) } - L.Push(lua.LBool(true)) - L.Push(tbl) + l.Push(lua.LBool(true)) + l.Push(tbl) return 2 } -func (a *ExpensesApp) luaGetExpense(L *lua.LState) int { - expId := L.CheckInt(1) +func (a *ExpApp) luaGetExpense(l *lua.LState) int { + expId := l.CheckInt(1) // TODO // This also doesnt make sense @@ -57,25 +60,25 @@ func (a *ExpensesApp) luaGetExpense(L *lua.LState) int { expense, err := a.ExpRepo.Get(ctx, int32(expId)) if err != nil { - return returnWithError(L, err.Error()) + return returnWithError(l, err.Error()) } err = a.prepareExpense(&expense) if err != nil { - return returnWithError(L, err.Error()) + return returnWithError(l, err.Error()) } jsonData, err := json.Marshal(&expense) if err != nil { - return returnWithError(L, err.Error()) + return returnWithError(l, err.Error()) } - L.Push(lua.LBool(true)) - L.Push(lua.LString(jsonData)) + l.Push(lua.LBool(true)) + l.Push(lua.LString(jsonData)) return 2 } -func (a *ExpensesApp) luaUpdateExpense(L *lua.LState) int { +func (a *ExpApp) luaUpdateExpense(L *lua.LState) int { expJson := L.CheckString(1) exp, err := mod.ExpenseFromJSON([]byte(expJson)) @@ -93,7 +96,7 @@ func (a *ExpensesApp) luaUpdateExpense(L *lua.LState) int { return 2 } -func (a *ExpensesApp) luaNormalizeShares(L *lua.LState) int { +func (a *ExpApp) luaNormalizeShares(L *lua.LState) int { expenseJson := L.CheckString(1) expense, err := mod.ExpenseFromJSON([]byte(expenseJson)) diff --git a/src/expenses/lua.go b/src/expenses/lua.go index a41d682..8fedc91 100644 --- a/src/expenses/lua.go +++ b/src/expenses/lua.go @@ -7,7 +7,7 @@ import ( lua "github.com/yuin/gopher-lua" ) -func (a *ExpensesApp) registerLuaBinds(L *lua.LState) { +func (a *ExpApp) registerLuaBinds(L *lua.LState) { ljson.Preload(L) // Add the decimal.Decimal operations L.SetGlobal("AddDecimal", L.NewFunction(luadec.AddDecimal)) diff --git a/src/expenses/repo/expenseRepo.go.go b/src/expenses/repo/expenseRepo.go.go index 21215bf..f006664 100644 --- a/src/expenses/repo/expenseRepo.go.go +++ b/src/expenses/repo/expenseRepo.go.go @@ -9,31 +9,31 @@ import ( type ExpenseRepository interface { // Direct expense methods Get(ctx context.Context, id int32) (mod.Expense, error) - GetAll(ctx context.Context, uId int32) (mod.Expenses, error) + GetAll(ctx context.Context, uID int32) (mod.Expenses, error) GetExpensesRange(ctx context.Context, start time.Time, - end time.Time, uId int32) (mod.Expenses, error) + end time.Time, uID int32) (mod.Expenses, error) Update(ctx context.Context, exp mod.Expense) error Insert(ctx context.Context, exp mod.Expense) error Delete(ctx context.Context, id int32) error // Share methods - GetShares(ctx context.Context, eId int32) (mod.Shares, error) + GetShares(ctx context.Context, eID int32) (mod.Shares, error) UpdateShare(ctx context.Context, sh mod.Share) error - InsertShare(ctx context.Context, eId int32, sh mod.Share) error - InsertShares(ctx context.Context, eId int32, sh mod.Shares) error + InsertShare(ctx context.Context, eID int32, sh mod.Share) error + InsertShares(ctx context.Context, eID int32, sh mod.Shares) error DeleteShare(ctx context.Context, id int32) error // Payment methods - GetPayments(ctx context.Context, eId int32) (mod.Payments, error) - GetExpensePaymentByUserID(ctx context.Context, eId int32, - uId int32) (mod.Payment, error) + GetPayments(ctx context.Context, eID int32) (mod.Payments, error) + GetExpensePaymentByUserID(ctx context.Context, eID int32, + uID int32) (mod.Payment, error) UpdatePayment(ctx context.Context, pm mod.Payment) error - InsertPayment(ctx context.Context, eId int32, pm mod.Payment) error - InsertPayments(ctx context.Context, eId int32, pm mod.Payments) error + InsertPayment(ctx context.Context, eID int32, pm mod.Payment) error + InsertPayments(ctx context.Context, eID int32, pm mod.Payments) error DeletePayment(ctx context.Context, id int32) error // Debts - SettleDebt(ctx context.Context, eId int32, + SettleDebt(ctx context.Context, eID int32, payment mod.Payment, credit mod.Payment) error Close() diff --git a/src/expenses/stores.go b/src/expenses/stores.go index 6340177..ebecc83 100644 --- a/src/expenses/stores.go +++ b/src/expenses/stores.go @@ -5,16 +5,16 @@ import ( mod "expenses/expenses/models" ) -func (a *ExpensesApp) GetAllStores(ctx context.Context) ([]mod.Store, error) { +func (a *ExpApp) GetAllStores(ctx context.Context) ([]mod.Store, error) { return a.StoreRepo.GetAll(ctx) } -func (a *ExpensesApp) GetStore(id int32) (mod.Store, error) { +func (a *ExpApp) GetStore(id int32) (mod.Store, error) { ctx := context.Background() return a.StoreRepo.Get(ctx, id) } -func (a *ExpensesApp) NewStore(name string, nif string) error { +func (a *ExpApp) NewStore(name string, nif string) error { ctx := context.Background() newStore := mod.Store{ @@ -25,7 +25,7 @@ func (a *ExpensesApp) NewStore(name string, nif string) error { return a.StoreRepo.Insert(ctx, newStore) } -func (a *ExpensesApp) UpdateStore(id int32, name string, nif string) error { +func (a *ExpApp) UpdateStore(id int32, name string, nif string) error { ctx := context.Background() store := mod.Store{ @@ -37,12 +37,12 @@ func (a *ExpensesApp) UpdateStore(id int32, name string, nif string) error { return a.StoreRepo.Update(ctx, store) } -func (a *ExpensesApp) DeleteStore(id int32) error { +func (a *ExpApp) DeleteStore(id int32) error { ctx := context.Background() return a.StoreRepo.Delete(ctx, id) } -func (a *ExpensesApp) GetStoreIDFromNIF(nif string) (int32, error) { +func (a *ExpApp) GetStoreIDFromNIF(nif string) (int32, error) { ctx := context.Background() store, err := a.StoreRepo.GetByNIF(ctx, nif) diff --git a/src/expenses/types.go b/src/expenses/types.go index 900409b..446bd1c 100644 --- a/src/expenses/types.go +++ b/src/expenses/types.go @@ -5,16 +5,19 @@ import ( mod "expenses/expenses/models" ) -func (a *ExpensesApp) GetAllTypes(ctx context.Context) (mod.Types, error) { +// GetAllTypes returns all types +func (a *ExpApp) GetAllTypes(ctx context.Context) (mod.Types, error) { return a.TypeRepo.GetAll(ctx) } -func (a *ExpensesApp) GetType(id int32) (mod.Type, error) { +// GetType returns a type by its `id` +func (a *ExpApp) GetType(id int32) (mod.Type, error) { ctx := context.Background() return a.TypeRepo.Get(ctx, id) } -func (a *ExpensesApp) NewType(name string) error { +// NewType creates a new type in the DB, or fails with error +func (a *ExpApp) NewType(name string) error { ctx := context.Background() newTyp := mod.Type{ @@ -24,12 +27,14 @@ func (a *ExpensesApp) NewType(name string) error { return a.TypeRepo.Insert(ctx, newTyp) } -func (a *ExpensesApp) DeleteType(id int32) error { +// DeleteType deletes a type by its `id`, or fails with error +func (a *ExpApp) DeleteType(id int32) error { ctx := context.Background() return a.TypeRepo.Delete(ctx, id) } -func (a *ExpensesApp) UpdateType(id int32, name string) error { +// UpdateType updates a type by its `id`, or fails with error +func (a *ExpApp) UpdateType(id int32, name string) error { ctx := context.Background() updatedType := mod.Type{ diff --git a/src/expenses/users.go b/src/expenses/users.go index b035b4b..75a3d13 100644 --- a/src/expenses/users.go +++ b/src/expenses/users.go @@ -3,24 +3,29 @@ package expenses import ( "context" mod "expenses/expenses/models" + "golang.org/x/crypto/bcrypt" ) -func (a *ExpensesApp) GetUser(id int32) (*mod.User, error) { +// GetUser returns an user by its `id` +func (a *ExpApp) GetUser(id int32) (*mod.User, error) { ctx := context.Background() return a.UserRepo.Get(ctx, id) } -func (a *ExpensesApp) GetUserByName(name string) (*mod.User, error) { +// GetUserByName returns a user by its `name` +func (a *ExpApp) GetUserByName(name string) (*mod.User, error) { ctx := context.Background() return a.UserRepo.GetByName(ctx, name) } -func (a *ExpensesApp) GetAllUsers(ctx context.Context) ([]mod.User, error) { +// GetAllUsers returns all the users +func (a *ExpApp) GetAllUsers(ctx context.Context) ([]mod.User, error) { return a.UserRepo.GetAll(ctx) } -func (a *ExpensesApp) ValidateCredentials(name string, pass string) (*mod.User, error) { +// ValidateCredentials validates the input credentials against the database +func (a *ExpApp) ValidateCredentials(name string, pass string) (*mod.User, error) { ctx := context.Background() user, err := a.UserRepo.GetByName(ctx, name) diff --git a/src/luadec/luadec.go b/src/luadec/luadec.go index 27b81a7..12af56b 100644 --- a/src/luadec/luadec.go +++ b/src/luadec/luadec.go @@ -1,3 +1,4 @@ +// Package luadec holds shopspring/decimal binds to be used on lua scripts package luadec import ( @@ -5,6 +6,7 @@ import ( lua "github.com/yuin/gopher-lua" ) +// AddDecimal adds to decimal numbers passed as strings func AddDecimal(L *lua.LState) int { decA, _ := decimal.NewFromString(L.CheckString(1)) decB, _ := decimal.NewFromString(L.CheckString(2)) diff --git a/src/main.go b/src/main.go index 26493f9..89a101c 100644 --- a/src/main.go +++ b/src/main.go @@ -1,3 +1,4 @@ +// main will start the expenses app package main import ( diff --git a/src/pages/categories.go b/src/pages/categories.go index 7b23ffa..f22c966 100644 --- a/src/pages/categories.go +++ b/src/pages/categories.go @@ -1,3 +1,4 @@ +// Package pages is the HTTP frontend for this application package pages import ( diff --git a/src/pages/expenses.go b/src/pages/expenses.go index 4e2ed71..d5d74b9 100644 --- a/src/pages/expenses.go +++ b/src/pages/expenses.go @@ -44,8 +44,8 @@ func ExpensesGlobalPage(c *gin.Context) { expenses, err := exp.App.GetAllExpenses(ctx) if err != nil { - log.Panicln("error:", err) - c.Header("HX-Redirect", "/500") + log.Println("error:", err) + ServerErrorView(c, "Could not get logged in user") return } diff --git a/src/pages/storesHelper.go b/src/pages/storesHelper.go index aa24afb..87d15cf 100644 --- a/src/pages/storesHelper.go +++ b/src/pages/storesHelper.go @@ -1,19 +1,14 @@ package pages -import ( - mod "expenses/expenses/models" - - "github.com/gin-gonic/gin" -) - -func storeFromForm(c *gin.Context) (*mod.Store, error) { - name := c.PostForm("store-name") - nif := c.PostForm("store-nif") - - store := mod.Store{ - StoreName: name, - StoreNIF: nif, - } - - return &store, nil -} +// func storeFromForm(c *gin.Context) (*mod.Store, error) { +// name := c.PostForm("store-name") +// nif := c.PostForm("store-nif") +// +// store := mod.Store{ +// StoreName: name, +// StoreNIF: nif, +// } +// +// return &store, nil +// } +// diff --git a/src/pgImage/expenses_pg_2025-09-06_00:16:43.bak b/src/pgImage/expenses_pg_2025-09-06_00:16:43.bak new file mode 100644 index 0000000..69f7052 --- /dev/null +++ b/src/pgImage/expenses_pg_2025-09-06_00:16:43.bak @@ -0,0 +1,1043 @@ +-- +-- PostgreSQL database dump +-- + +\restrict YD6WOUPNPjmsw55mlY0y3tJ8W2L6YjUXHMPUkdckfUq4elWGHIrGHkeyf7x1D0N + +-- Dumped from database version 16.10 +-- Dumped by pg_dump version 16.10 + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +-- +-- Data for Name: categories; Type: TABLE DATA; Schema: public; Owner: expdbuser +-- + +COPY public.categories ("CategoryID", "CategoryName") FROM stdin; +0 No Category +1 Forester +2 Starlet +3 Restaurant +4 Tools +5 Hardware +6 Recibo +7 Finanças +8 Casa +9 Karting +10 3DP +11 Server +12 Renda +13 Groceries +14 Electricity +15 Simracing +16 Internet +17 Hotels +18 Entretenimento +19 Investements +20 Prenda +21 Tap Water +22 Office +25 Health +\. + + +-- +-- Data for Name: expenseTypes; Type: TABLE DATA; Schema: public; Owner: expdbuser +-- + +COPY public."expenseTypes" ("TypeID", "TypeName") FROM stdin; +0 Despesa +1 Salário +2 Cartão Refeição +3 Reembolso +4 Prenda +5 Investment +\. + + +-- +-- Data for Name: stores; Type: TABLE DATA; Schema: public; Owner: expdbuser +-- + +COPY public.stores ("StoreID", "StoreName") FROM stdin; +0 No Store +1 Velocix +2 Estado +3 Borges e Almeida +4 Kartódromo Viana +5 Cabo do Mundo +6 Kartcenter Matosinhos +7 Decathlon +8 Landlord +9 Nortenha +10 Via Verde +11 Galp +12 Endesa +13 Evolt +14 iRacing +15 UZO +16 Aliexpress +17 Sportzone +18 OLX +19 Norauto +20 Prio +21 BP +22 Cinemax +23 Degiro +24 Leroy Merlin +25 About You +26 BK +27 Pasta e Basta +28 Penafiel Verde +29 Continente +30 Mercadona +31 Auto Irmãos Ferreira +32 Note +33 Subarak +34 Escape6 +35 Tranquilidade +36 LIDL +37 OZ Energia +38 Q8 +39 Prio +40 La Trattoria Di +41 IKEA +42 Hugo Atlantis +43 Wells +44 Gumroad +45 Inovpeças +\. + + +-- +-- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: expdbuser +-- + +COPY public.users ("UserID", "UserName", "UserPass") FROM stdin; +1 esilva $2y$10$P1sAIsnyD6byXzwPaXay9uP8Rmddz9BQkjl0fiEDHSktzj4ATyrfK +2 kika $2y$10$P1sAIsnyD6byXzwPaXay9uP8Rmddz9BQkjl0fiEDHSktzj4ATyrfK +\. + + +-- +-- Data for Name: expenses; Type: TABLE DATA; Schema: public; Owner: expdbuser +-- + +COPY public.expenses ("ExpID", "Description", "Value", "StoreID", "CategoryID", "OwnerUserID", "TypeID", "ExpDate", "CreationDate", "PaidOff", "SharesEven") FROM stdin; +1 Oil 93.47 0 0 1 0 2025-01-02 00:00:00 2025-07-21 00:00:00 t t +2 Karting 32.00 5 9 1 0 2025-01-02 00:00:00 2025-07-21 00:00:00 t t +3 Dinner 9.98 26 3 1 0 2025-01-02 00:00:00 2025-07-21 00:00:00 t t +4 LPG 40.43 0 1 1 0 2025-01-02 00:00:00 2025-07-21 00:00:00 t t +5 Anti-Fog 11.00 0 9 1 0 2025-01-02 00:00:00 2025-07-21 00:00:00 t t +6 Decathlon 5.90 0 0 1 0 2025-01-03 00:00:00 2025-07-21 00:00:00 t t +7 Casaco Impermeável 19.99 17 9 1 0 2025-01-03 00:00:00 2025-07-21 00:00:00 t t +8 Water 14.00 0 13 1 0 2025-01-04 00:00:00 2025-07-21 00:00:00 t t +9 Lunch 12.62 0 3 1 0 2025-01-04 00:00:00 2025-07-21 00:00:00 t t +10 GoPro 230.00 18 9 1 0 2025-01-04 00:00:00 2025-07-21 00:00:00 t t +11 LPG 45.39 0 1 1 0 2025-01-09 00:00:00 2025-07-21 00:00:00 t t +12 Groceries 197.99 0 13 1 0 2025-01-10 00:00:00 2025-07-21 00:00:00 t t +13 Internet Janeiro 2025 35.00 15 16 1 0 2025-01-10 00:00:00 2025-07-21 00:00:00 t t +14 Karting 32.00 5 9 1 0 2025-01-12 00:00:00 2025-07-21 00:00:00 t t +15 Petrol 64.45 0 0 1 0 2025-01-12 00:00:00 2025-07-21 00:00:00 t t +16 AutoDetailing 163.08 0 0 1 0 2025-01-16 00:00:00 2025-07-21 00:00:00 t t +17 Parking 10.50 0 0 1 0 2025-01-21 00:00:00 2025-07-21 00:00:00 t t +18 Luz Janeiro 2025 133.15 12 14 1 0 2025-01-22 00:00:00 2025-07-21 00:00:00 t t +19 Forester 9.84 0 0 1 0 2025-01-22 00:00:00 2025-07-21 00:00:00 t t +20 LPG 38.72 0 1 1 0 2025-01-22 00:00:00 2025-07-21 00:00:00 t t +21 Parking 7.20 0 0 1 0 2025-01-23 00:00:00 2025-07-21 00:00:00 t t +22 Hardware 5.52 0 0 1 0 2025-01-23 00:00:00 2025-07-21 00:00:00 t t +23 Forester 7.95 0 0 1 0 2025-01-23 00:00:00 2025-07-21 00:00:00 t t +24 Renda Janeiro 2025 450.00 8 12 1 0 2025-01-24 00:00:00 2025-07-21 00:00:00 t t +25 Parking 10.50 0 0 1 0 2025-01-27 00:00:00 2025-07-21 00:00:00 t t +26 Petrol 73.38 0 0 1 0 2025-01-27 00:00:00 2025-07-21 00:00:00 t t +27 Hotel SKO 2025 14.00 0 17 1 0 2025-01-28 00:00:00 2025-07-21 00:00:00 t t +28 LPG 41.31 0 1 1 0 2025-01-28 00:00:00 2025-07-21 00:00:00 t t +29 Salary 1769.64 1 6 1 1 2025-01-29 00:00:00 2025-07-21 00:00:00 t t +30 Parking 15.00 0 0 1 0 2025-01-29 00:00:00 2025-07-21 00:00:00 t t +31 LPG 45.40 0 1 1 0 2025-01-29 00:00:00 2025-07-21 00:00:00 t t +32 Dinner 20.49 0 0 1 0 2025-01-29 00:00:00 2025-07-21 00:00:00 t t +33 Cartão Refeição 165.00 1 6 1 2 2025-01-29 00:00:00 2025-07-21 00:00:00 t t +34 Calças/casaco impermeável 38.50 7 9 1 0 2025-01-31 00:00:00 2025-07-21 00:00:00 t t +35 Forester 32.73 0 0 1 0 2025-01-31 00:00:00 2025-07-21 00:00:00 t t +36 Forester 49.20 0 0 1 0 2025-01-31 00:00:00 2025-07-21 00:00:00 t t +37 Petrol 59.09 0 0 1 0 2025-01-31 00:00:00 2025-07-21 00:00:00 t t +38 Legal 50.00 0 0 1 0 2025-01-31 00:00:00 2025-07-21 00:00:00 t t +39 Breakfast 6.00 0 0 1 0 2025-01-31 00:00:00 2025-07-21 00:00:00 t t +40 ViaVerde 44.25 0 0 1 0 2025-01-31 00:00:00 2025-07-21 00:00:00 t t +41 Ikea 12.98 0 0 1 0 2025-02-01 00:00:00 2025-07-21 00:00:00 t t +42 Lunch 18.20 0 0 1 0 2025-02-01 00:00:00 2025-07-21 00:00:00 t t +43 Karting 25.00 0 0 1 0 2025-02-01 00:00:00 2025-07-21 00:00:00 t t +44 Water 17.51 0 0 1 0 2025-02-04 00:00:00 2025-07-21 00:00:00 t t +45 Forester 316.45 0 0 1 0 2025-02-05 00:00:00 2025-07-21 00:00:00 t t +46 Groceries 232.55 0 0 1 0 2025-02-05 00:00:00 2025-07-21 00:00:00 t t +47 Dinner 9.98 0 0 1 0 2025-02-06 00:00:00 2025-07-21 00:00:00 t t +48 Forester 68.57 0 0 1 0 2025-02-06 00:00:00 2025-07-21 00:00:00 t t +49 Karting 49.00 0 0 1 0 2025-02-08 00:00:00 2025-07-21 00:00:00 t t +50 Lunch 31.00 0 0 1 0 2025-02-08 00:00:00 2025-07-21 00:00:00 t t +51 Tools 14.99 0 0 1 0 2025-02-10 00:00:00 2025-07-21 00:00:00 t t +52 Hardware 21.07 0 0 1 0 2025-02-10 00:00:00 2025-07-21 00:00:00 t t +53 Petrol 84.66 0 0 1 0 2025-02-10 00:00:00 2025-07-21 00:00:00 t t +54 Tools 5.00 0 0 1 0 2025-02-12 00:00:00 2025-07-21 00:00:00 t t +55 Hardawre 27.95 0 0 1 0 2025-02-12 00:00:00 2025-07-21 00:00:00 t t +56 Hardaware 7.95 0 0 1 0 2025-02-13 00:00:00 2025-07-21 00:00:00 t t +57 Karting 50.00 0 0 1 0 2025-02-14 00:00:00 2025-07-21 00:00:00 t t +58 Tools 136.97 0 0 1 0 2025-02-14 00:00:00 2025-07-21 00:00:00 t t +59 Hardware 17.85 0 0 1 0 2025-02-16 00:00:00 2025-07-21 00:00:00 t t +60 Hardware 36.90 0 0 1 0 2025-02-17 00:00:00 2025-07-21 00:00:00 t t +61 Renda Fevereiro 2025 450.00 8 12 1 0 2025-02-18 00:00:00 2025-07-21 00:00:00 t t +62 Forester 104.00 0 0 1 0 2025-02-19 00:00:00 2025-07-21 00:00:00 t t +63 Starlet 63.55 0 0 1 0 2025-02-20 00:00:00 2025-07-21 00:00:00 t t +64 Hardware 19.95 0 0 1 0 2025-02-20 00:00:00 2025-07-21 00:00:00 t t +65 Brake Fluid 17.97 0 0 1 0 2025-02-20 00:00:00 2025-07-21 00:00:00 t t +66 Endesa 148.05 12 14 1 0 2025-02-21 00:00:00 2025-07-21 00:00:00 t t +67 Tools 23.43 0 0 1 0 2025-02-21 00:00:00 2025-07-21 00:00:00 t t +68 Karting 32.00 0 0 1 0 2025-02-22 00:00:00 2025-07-21 00:00:00 t t +69 Petrol 57.23 0 0 1 0 2025-02-22 00:00:00 2025-07-21 00:00:00 t t +70 Dinner 70.70 0 0 1 0 2025-02-25 00:00:00 2025-07-21 00:00:00 t t +71 Salary 1867.06 1 6 1 1 2025-02-27 00:00:00 2025-07-21 00:00:00 t t +72 Cartão Refeição 150.00 1 6 1 2 2025-02-27 00:00:00 2025-07-21 00:00:00 t t +73 Parking 8.40 0 0 1 0 2025-02-28 00:00:00 2025-07-21 00:00:00 t t +74 ViaVerde 28.65 0 0 1 0 2025-02-28 00:00:00 2025-07-21 00:00:00 t t +75 Petrol 73.00 0 1 1 0 2025-03-01 00:00:00 2025-07-21 00:00:00 t t +76 Lunch 12.62 0 0 1 0 2025-03-01 00:00:00 2025-07-21 00:00:00 t t +77 Endesa 78.90 12 14 1 0 2025-03-03 00:00:00 2025-07-21 00:00:00 t t +78 Groceries 233.00 0 0 1 0 2025-03-05 00:00:00 2025-07-21 00:00:00 t t +79 Water 14.60 0 0 1 0 2025-03-05 00:00:00 2025-07-21 00:00:00 t t +80 Forester 70.00 0 0 1 0 2025-03-07 00:00:00 2025-07-21 00:00:00 t t +81 Breakfast 5.70 0 0 1 0 2025-03-07 00:00:00 2025-07-21 00:00:00 t t +82 iRacing 39.64 0 0 1 0 2025-03-12 00:00:00 2025-07-21 00:00:00 t t +83 Internet 35.00 15 16 1 0 2025-03-12 00:00:00 2025-07-21 00:00:00 t t +84 Petrol 30.47 0 0 1 0 2025-03-15 00:00:00 2025-07-21 00:00:00 t t +85 Lunch 15.75 0 0 1 0 2025-03-15 00:00:00 2025-07-21 00:00:00 t t +86 Karting 40.00 0 0 1 0 2025-03-16 00:00:00 2025-07-21 00:00:00 t t +87 Starletu 29.85 0 0 1 0 2025-03-16 00:00:00 2025-07-21 00:00:00 t t +88 Petrol 47.12 0 0 1 0 2025-03-16 00:00:00 2025-07-21 00:00:00 t t +89 Starlet 10.00 0 0 1 0 2025-03-20 00:00:00 2025-07-21 00:00:00 t t +90 Starlet 81.01 0 0 1 0 2025-03-20 00:00:00 2025-07-21 00:00:00 t t +91 Galp 31.10 0 0 1 0 2025-03-21 00:00:00 2025-07-21 00:00:00 t t +92 Rent 450.00 0 0 1 0 2025-03-21 00:00:00 2025-07-21 00:00:00 t t +93 Starlet 105.74 0 0 1 0 2025-03-24 00:00:00 2025-07-21 00:00:00 t t +94 Karting 50.00 0 0 1 0 2025-03-24 00:00:00 2025-07-21 00:00:00 t t +95 Lunch 15.75 0 0 1 0 2025-03-27 00:00:00 2025-07-21 00:00:00 t t +96 Cartão Refeição 157.50 1 0 1 2 2025-03-27 00:00:00 2025-07-21 00:00:00 t t +97 Salary 3077.19 1 6 1 1 2025-03-28 00:00:00 2025-07-21 00:00:00 t t +98 Hardware 67.50 0 0 1 0 2025-03-29 00:00:00 2025-07-21 00:00:00 t t +99 Lunch 10.98 0 0 1 0 2025-03-29 00:00:00 2025-07-21 00:00:00 t t +100 Starlet 145.00 0 0 1 0 2025-03-29 00:00:00 2025-07-21 00:00:00 t t +101 Karting 40.00 0 0 1 0 2025-03-30 00:00:00 2025-07-21 00:00:00 t t +102 Petrol 40.95 0 0 1 0 2025-03-30 00:00:00 2025-07-21 00:00:00 t t +103 ViaVerde 31.99 0 0 1 0 2025-03-31 00:00:00 2025-07-21 00:00:00 t t +104 Groceries 245.97 0 0 1 0 2025-04-02 00:00:00 2025-07-21 00:00:00 t t +105 Hardware 27.00 0 0 1 0 2025-04-03 00:00:00 2025-07-21 00:00:00 t t +106 Water 12.90 0 0 1 0 2025-04-03 00:00:00 2025-07-21 00:00:00 t t +107 Petrol 26.30 0 0 1 0 2025-04-04 00:00:00 2025-07-21 00:00:00 t t +108 Lunch 34.00 0 0 1 0 2025-04-05 00:00:00 2025-07-21 00:00:00 t t +109 Glasses 199.00 0 0 1 0 2025-04-08 00:00:00 2025-07-21 00:00:00 t t +110 Petrol 43.70 0 0 1 0 2025-04-13 00:00:00 2025-07-21 00:00:00 t t +111 IRS 1370.64 2 7 1 3 2025-04-14 00:00:00 2025-07-21 00:00:00 t t +112 Battery 34.75 0 0 1 0 2025-04-14 00:00:00 2025-07-21 00:00:00 t t +113 Dinner 11.82 0 3 1 0 2025-04-14 00:00:00 2025-07-21 00:00:00 t t +114 Karting 32.00 0 0 1 0 2025-04-16 00:00:00 2025-07-21 00:00:00 t t +115 Karting 50.00 0 0 1 0 2025-04-17 00:00:00 2025-07-21 00:00:00 t t +116 Parking 24.90 0 0 1 0 2025-04-17 00:00:00 2025-07-21 00:00:00 t t +117 Petrol 46.64 0 0 1 0 2025-04-19 00:00:00 2025-07-21 00:00:00 t t +118 Galp 96.89 0 0 1 0 2025-04-21 00:00:00 2025-07-21 00:00:00 t t +119 Pharmacy 9.94 0 0 1 0 2025-04-23 00:00:00 2025-07-21 00:00:00 t t +120 Rent 480.00 0 0 1 0 2025-04-24 00:00:00 2025-07-21 00:00:00 t t +121 Karting 50.00 0 0 1 0 2025-04-24 00:00:00 2025-07-21 00:00:00 t t +122 Groceries 17.06 0 0 1 0 2025-04-24 00:00:00 2025-07-21 00:00:00 t t +123 Office Supplies 75.20 0 0 1 0 2025-04-24 00:00:00 2025-07-21 00:00:00 t t +124 Lunch 13.90 0 0 1 0 2025-04-25 00:00:00 2025-07-21 00:00:00 t t +125 Petrol 48.06 0 0 1 0 2025-04-29 00:00:00 2025-07-21 00:00:00 t t +126 Salary 1710.81 1 6 1 1 2025-04-29 00:00:00 2025-07-21 00:00:00 t t +127 Cartão Refeição 150.00 1 6 1 2 2025-04-29 00:00:00 2025-07-21 00:00:00 t t +128 Starlet 36.64 0 0 1 0 2025-04-30 00:00:00 2025-07-21 00:00:00 t t +129 Groceries 122.99 0 0 1 0 2025-04-30 00:00:00 2025-07-21 00:00:00 t t +130 ViaVerde 31.69 0 0 1 0 2025-04-30 00:00:00 2025-07-21 00:00:00 t t +131 Reimbursment – Kika 398.63 0 8 1 3 2025-05-01 00:00:00 2025-07-21 00:00:00 t t +132 Fidelidade 357.75 0 0 1 0 2025-05-02 00:00:00 2025-07-21 00:00:00 t t +133 UAB 162.50 0 0 1 0 2025-05-05 00:00:00 2025-07-21 00:00:00 t t +134 PTServidor 12.00 0 0 1 0 2025-05-12 00:00:00 2025-07-21 00:00:00 t t +135 Internet Maio 2025 23.76 15 16 1 0 2025-05-14 00:00:00 2025-07-21 00:00:00 t t +136 Water 15.94 0 0 1 0 2025-05-15 00:00:00 2025-07-21 00:00:00 t t +137 Petrol 43.74 0 0 1 0 2025-05-15 00:00:00 2025-07-21 00:00:00 t t +138 karting 40.00 0 0 1 0 2025-05-16 00:00:00 2025-07-21 00:00:00 t t +139 Petrol 45.25 0 0 1 0 2025-05-17 00:00:00 2025-07-21 00:00:00 t t +140 Festa da Terra 10.00 0 0 1 0 2025-05-19 00:00:00 2025-07-21 00:00:00 t t +141 Rent 480.00 0 0 1 0 2025-05-20 00:00:00 2025-07-21 00:00:00 t t +142 Galp 87.65 0 0 1 0 2025-05-20 00:00:00 2025-07-21 00:00:00 t t +143 Server 118.49 0 0 1 0 2025-05-20 00:00:00 2025-07-21 00:00:00 t t +144 Groceries 4.77 0 0 1 0 2025-05-22 00:00:00 2025-07-21 00:00:00 t t +145 Groceries 11.08 0 0 1 0 2025-05-24 00:00:00 2025-07-21 00:00:00 t t +146 IUC 12.55 2 2 1 0 2025-05-26 00:00:00 2025-07-21 00:00:00 t t +147 Filamentos 53.43 13 10 1 0 2025-05-26 00:00:00 2025-07-21 00:00:00 t t +148 Salary 1832.91 1 6 1 1 2025-05-29 00:00:00 2025-07-21 00:00:00 t t +149 Cartão Refeição 157.50 1 6 1 2 2025-05-30 00:00:00 2025-07-21 00:00:00 t t +150 ViaVerde 40.33 0 0 1 0 2025-05-31 00:00:00 2025-07-21 00:00:00 t t +151 iRacing - Car 13.00 14 15 1 0 2025-06-01 00:00:00 2025-07-21 00:00:00 t t +152 Reimbursment – Kika 641.11 0 8 1 3 2025-06-02 00:00:00 2025-07-21 00:00:00 t t +153 Server 388.82 0 0 1 0 2025-06-02 00:00:00 2025-07-21 00:00:00 t t +154 Petrol 40.96 0 0 1 0 2025-06-02 00:00:00 2025-07-21 00:00:00 t t +155 Groceries 20.52 0 0 1 0 2025-06-03 00:00:00 2025-07-21 00:00:00 t t +156 Karting - CMC 50.00 5 9 1 0 2025-06-04 00:00:00 2025-07-21 00:00:00 t t +157 Kitchen 13.00 0 0 1 0 2025-06-04 00:00:00 2025-07-21 00:00:00 t t +158 Forester 1200.00 0 0 1 0 2025-06-05 00:00:00 2025-07-21 00:00:00 t t +159 Domain 22.90 0 11 1 0 2025-06-07 00:00:00 2025-07-21 00:00:00 t t +160 Hostinger 129.56 0 11 1 0 2025-06-07 00:00:00 2025-07-21 00:00:00 t t +161 Petrol 47.78 0 0 1 0 2025-06-07 00:00:00 2025-07-21 00:00:00 t t +162 Water 14.60 0 0 1 0 2025-06-10 00:00:00 2025-07-21 00:00:00 t t +163 Internet Junho 2025 23.00 15 16 1 0 2025-06-11 00:00:00 2025-07-21 00:00:00 t t +164 Mobo Z370M Servidor 76.14 16 11 1 0 2025-06-16 00:00:00 2025-07-21 00:00:00 t t +165 Luz Junho 2025 68.26 11 14 1 0 2025-06-23 00:00:00 2025-07-21 00:00:00 t t +166 Renda Junho 2025 480.00 8 12 1 0 2025-06-25 00:00:00 2025-07-21 00:00:00 t t +167 Petrol 31.36 0 2 1 0 2025-06-25 00:00:00 2025-07-21 00:00:00 t t +168 Salário Jun 2025 1710.81 1 6 1 1 2025-06-27 00:00:00 2025-07-21 00:00:00 t t +169 Cartão Refeição 135.00 1 6 1 2 2025-06-27 00:00:00 2025-07-21 00:00:00 t t +170 Petrol 34.56 0 2 1 0 2025-06-30 00:00:00 2025-07-21 00:00:00 t t +171 Petrol 47.50 0 2 1 0 2025-07-01 00:00:00 2025-07-21 00:00:00 t t +172 Starlet 20.00 0 0 1 0 2025-07-01 00:00:00 2025-07-21 00:00:00 t t +173 Petrol 78.95 0 1 1 0 2025-07-02 00:00:00 2025-07-21 00:00:00 t t +174 Forester 1300.00 3 1 1 0 2025-07-02 00:00:00 2025-07-21 00:00:00 t t +175 Starlet Problemas Ignição 120.00 3 2 1 0 2025-07-02 00:00:00 2025-07-21 00:00:00 t t +176 Forester 729.51 9 1 1 0 2025-07-02 00:00:00 2025-07-21 00:00:00 t t +178 Reimbursment – Kika 989.95 0 8 1 3 2025-07-03 00:00:00 2025-07-21 00:00:00 t t +179 Dinner 19.60 0 3 1 0 2025-07-03 00:00:00 2025-07-21 00:00:00 t t +180 Água Junho 2025 16.82 28 21 1 0 2025-07-07 00:00:00 2025-07-21 00:00:00 t t +181 Renda Julho 2025 480.00 8 12 1 0 2025-07-10 00:00:00 2025-07-21 00:00:00 t t +182 Petrol 86.38 0 1 1 0 2025-07-08 00:00:00 2025-07-21 00:00:00 t t +183 Dinner 16.00 0 3 1 0 2025-07-10 00:00:00 2025-07-21 00:00:00 t t +184 Forester 94.88 33 1 1 0 2025-07-11 00:00:00 2025-07-21 00:00:00 t t +185 Forester 57.47 34 1 1 0 2025-07-12 00:00:00 2025-07-21 00:00:00 t t +186 Medidor Pressão Pneus 14.99 19 4 1 0 2025-07-19 00:00:00 1970-01-01 00:00:00 t t +187 Petrol Forester 80.00 20 1 1 0 2025-07-17 00:00:00 1970-01-01 00:00:00 t t +188 Petrol Forester 81.16 21 1 1 0 2025-07-14 00:00:00 1970-01-01 00:00:00 t t +189 Snacks e Molas 13.75 0 8 1 0 2025-07-12 00:00:00 1970-01-01 00:00:00 t t +190 Cinema - F1 22.55 22 18 1 0 2025-07-17 00:00:00 1970-01-01 00:00:00 t t +191 ETF 391.00 23 19 1 5 2025-07-15 00:00:00 1970-01-01 00:00:00 t t +192 Peças Mangueira 7.49 24 5 1 0 2025-07-14 00:00:00 1970-01-01 00:00:00 t t +193 Sapatos Castanhos Kika 89.90 25 20 1 0 2025-07-12 00:00:00 1970-01-01 00:00:00 t t +194 Pizza 13.50 27 3 1 0 2025-07-19 00:00:00 1970-01-01 00:00:00 t t +195 Lunch 19.94 26 3 1 0 2025-07-19 00:00:00 1970-01-01 00:00:00 t t +196 Continente 97.08 29 13 1 0 2025-07-02 00:00:00 1970-01-01 00:00:00 t t +197 Mercadona 141.94 30 13 1 0 2025-07-02 00:00:00 1970-01-01 00:00:00 t t +198 Revisão LPG Forester 125.56 31 1 1 0 2025-07-23 00:00:00 2025-07-23 00:00:00 t t +199 LGP Forester 33.89 31 1 1 0 2025-07-23 00:00:00 2025-07-23 00:00:00 t t +200 Groceries 19.38 29 13 1 0 2025-07-23 00:00:00 2025-07-25 00:00:00 t t +201 Notebook 11.88 32 22 1 0 2025-07-24 00:00:00 2025-07-25 00:00:00 t t +202 Cooling Sys Stuff 76.77 3 2 1 0 2025-07-18 00:00:00 2025-07-25 00:00:00 t t +203 Seguro Starlet 81.47 35 2 1 0 2025-07-16 00:00:00 2025-07-25 00:00:00 t t +204 Prenda Avó 10.00 0 20 1 4 2025-07-24 00:00:00 2025-07-25 00:00:00 t t +205 Prenda Mãe 60.00 0 20 1 4 2025-07-24 00:00:00 2025-07-25 00:00:00 t t +206 Internet Julho 2025 23.00 15 16 1 0 2025-07-09 00:00:00 2025-07-25 00:00:00 t t +207 Luz Julho 2025 79.87 11 14 1 0 2025-07-21 00:00:00 2025-07-25 00:00:00 t t +209 Salário Jul 2025 3410.62 0 6 1 1 2025-07-30 00:00:00 2025-07-30 00:00:00 t t +210 CRefeição Jul 2025 172.25 0 6 1 2 2025-07-30 00:00:00 2025-07-30 00:00:00 f f +211 Groceries Mercadona 119.45 30 13 1 0 2025-07-31 00:00:00 2025-07-31 00:00:00 t t +212 Groceries Continente 121.81 29 13 1 0 2025-07-31 00:00:00 2025-07-31 00:00:00 t t +213 Reimb. - Torres Vedras 91.35 0 0 1 3 2025-07-31 00:00:00 2025-07-31 00:00:00 t t +214 iRacing - Porsche GT3 12.77 14 15 1 0 2025-07-30 00:00:00 2025-08-01 00:00:00 t t +215 ETF 2175.00 23 19 1 5 2025-07-30 00:00:00 2025-08-01 00:00:00 t t +216 ETF 1000.00 23 19 1 5 2025-08-01 00:00:00 2025-08-01 00:00:00 t t +217 Alicates 51.45 36 4 1 0 2025-07-31 00:00:00 2025-08-01 00:00:00 t t +218 Petrol 50.00 39 1 1 0 2025-07-29 00:00:00 2025-08-01 00:00:00 t t +219 LPG 34.93 37 1 1 0 2025-07-29 00:00:00 2025-08-01 00:00:00 t t +220 Dinner AMI 16.60 40 3 1 0 2025-08-07 00:00:00 2025-08-08 00:00:00 t t +221 Internet Aug 2025 23.00 15 16 1 0 2025-08-08 00:00:00 2025-08-08 00:00:00 t t +222 Armário Escritório 260.00 41 8 1 0 2025-08-05 00:00:00 2025-08-08 00:00:00 t t +223 LPG Fozzie 30.08 37 1 1 0 2025-08-07 00:00:00 2025-08-08 00:00:00 t t +224 Dinner 14.10 41 3 1 0 2025-08-05 00:00:00 2025-08-08 00:00:00 t t +225 Água Julho 2025 17.49 28 21 1 0 2025-08-11 00:00:00 2025-08-09 00:00:00 t t +226 Stereo Starlet 124.00 19 2 1 0 2025-07-29 00:00:00 2025-08-10 00:00:00 t t +227 Petrol 46.28 39 2 1 0 2025-08-02 00:00:00 2025-08-18 00:00:00 t t +228 Florester 250.80 42 1 1 0 2025-08-22 00:00:00 2025-08-22 00:00:00 t t +229 Glasses 108.10 43 25 1 0 2025-08-21 00:00:00 2025-08-22 00:00:00 t t +230 Dinner AMI 19.85 40 3 1 0 2025-08-21 00:00:00 2025-08-22 00:00:00 t t +231 Luz Aug 2025 88.91 11 14 1 0 2025-08-18 00:00:00 2025-08-22 00:00:00 t t +232 Beamng Cars 10.89 44 15 1 0 2025-08-21 00:00:00 2025-08-22 00:00:00 t t +233 Groceries 34.01 29 13 1 0 2025-08-20 00:00:00 2025-08-22 00:00:00 t t +234 Rent Aug 2025 480.00 8 12 1 0 2025-08-22 00:00:00 2025-08-22 00:00:00 t t +235 Óleo DA 12.85 45 1 1 0 2025-08-25 00:00:00 2025-08-27 00:00:00 t t +236 Salário Aug 2025 1798.81 1 6 1 1 2025-08-28 00:00:00 2025-08-28 00:00:00 t t +237 CRefeição Aug 2025 150.00 1 6 1 2 2025-08-28 00:00:00 2025-08-28 00:00:00 t t +238 Degiro ETF 535.00 23 19 1 0 2025-08-29 00:00:00 2025-08-29 00:00:00 t f +240 Petrol Starlet 46.67 38 2 1 0 2025-08-28 00:00:00 2025-08-31 00:00:00 t f +241 Dinner AMI 13.00 0 3 1 0 2025-08-28 00:00:00 2025-08-31 00:00:00 t f +242 Degiro ETF 965.00 23 19 1 0 2025-09-01 00:00:00 2025-09-01 00:00:00 t f +243 Água Agosto 2025 14.93 28 21 1 0 2025-09-03 00:00:00 2025-09-03 15:05:34.566841 t f +244 Luz Sep 2025 108.03 11 14 1 0 2025-09-18 00:00:00 2025-09-03 15:18:59.046393 t f +245 Dinner AMI 13.40 0 3 1 0 2025-09-04 00:00:00 2025-09-05 10:37:35.120408 t f +\. + + +-- +-- Data for Name: expensesPayments; Type: TABLE DATA; Schema: public; Owner: expdbuser +-- + +COPY public."expensesPayments" ("ExpPaymID", "ExpID", "UserID", "Payed") FROM stdin; +1 1 1 93.47 +2 2 1 32.00 +3 3 1 9.98 +4 4 1 40.43 +5 5 1 11.00 +6 6 1 5.90 +7 7 1 19.99 +8 8 1 7.00 +9 8 2 7.00 +10 9 1 12.62 +11 10 1 230.00 +12 11 1 45.39 +13 12 1 99.00 +14 12 2 98.99 +15 13 1 17.50 +16 13 2 17.50 +17 14 1 32.00 +18 15 1 64.45 +19 16 1 163.08 +20 17 1 10.50 +21 18 1 66.58 +22 18 2 66.57 +23 19 1 9.84 +24 20 1 38.72 +25 21 1 7.20 +26 22 1 5.52 +27 23 1 7.95 +28 24 1 225.00 +29 24 2 225.00 +30 25 1 10.50 +31 26 1 73.38 +32 27 1 14.00 +33 28 1 41.31 +34 29 1 1769.64 +35 30 1 15.00 +36 31 1 45.40 +37 32 1 20.49 +38 33 1 165.00 +39 34 1 38.50 +40 35 1 32.73 +41 36 1 49.20 +42 37 1 59.09 +43 38 1 50.00 +44 39 1 6.00 +45 40 1 44.25 +46 41 1 12.98 +47 42 1 18.20 +48 43 1 25.00 +49 44 1 8.76 +50 44 2 8.75 +51 45 1 316.45 +52 46 1 116.28 +53 46 2 116.27 +54 47 1 9.98 +55 48 1 68.57 +56 49 1 49.00 +57 50 1 31.00 +58 51 1 14.99 +59 52 1 21.07 +60 53 1 84.66 +61 54 1 5.00 +62 55 1 27.95 +63 56 1 7.95 +64 57 1 50.00 +65 58 1 136.97 +66 59 1 17.85 +67 60 1 36.90 +68 61 1 225.00 +69 61 2 225.00 +70 62 1 104.00 +71 63 1 63.55 +72 64 1 19.95 +73 65 1 17.97 +74 66 1 74.03 +75 66 2 74.02 +76 67 1 23.43 +77 68 1 32.00 +78 69 1 57.23 +79 70 1 70.70 +80 71 1 1867.06 +81 72 1 150.00 +82 73 1 8.40 +83 74 1 28.65 +84 75 1 73.00 +85 76 1 12.62 +86 77 1 39.45 +87 77 2 39.45 +88 78 1 116.50 +89 78 2 116.50 +90 79 1 7.30 +91 79 2 7.30 +92 80 1 70.00 +93 81 1 5.70 +94 82 1 39.64 +95 83 1 17.50 +96 83 2 17.50 +97 84 1 30.47 +98 85 1 15.75 +99 86 1 40.00 +100 87 1 29.85 +101 88 1 47.12 +102 89 1 10.00 +103 90 1 81.01 +104 91 1 15.55 +105 91 2 15.55 +106 92 1 225.00 +107 92 2 225.00 +108 93 1 105.74 +109 94 1 50.00 +110 95 1 15.75 +111 96 1 157.50 +112 97 1 3077.19 +113 98 1 67.50 +114 99 1 10.98 +115 100 1 145.00 +116 101 1 40.00 +117 102 1 40.95 +118 103 1 31.99 +119 104 1 122.99 +120 104 2 122.98 +121 105 1 27.00 +122 106 1 6.45 +123 106 2 6.45 +124 107 1 26.30 +125 108 1 34.00 +126 109 1 199.00 +127 110 1 43.70 +128 111 1 1370.64 +129 112 1 34.75 +130 113 1 11.82 +131 114 1 32.00 +132 115 1 50.00 +133 116 1 24.90 +134 117 1 46.64 +135 118 1 48.45 +136 118 2 48.44 +137 119 1 9.94 +138 120 1 240.00 +139 120 2 240.00 +140 121 1 50.00 +141 122 1 8.53 +142 122 2 8.53 +143 123 1 75.20 +144 124 1 13.90 +145 125 1 48.06 +146 126 1 1710.81 +147 127 1 150.00 +148 128 1 36.64 +149 129 1 61.50 +150 129 2 61.49 +151 130 1 31.69 +152 131 2 398.63 +153 132 1 357.75 +154 133 1 162.50 +155 134 1 12.00 +156 135 1 11.88 +157 135 2 11.88 +158 136 1 7.97 +159 136 2 7.97 +160 137 1 43.74 +161 138 1 40.00 +162 139 1 45.25 +163 140 1 10.00 +164 141 1 240.00 +165 141 2 240.00 +166 142 1 43.83 +167 142 2 43.82 +168 143 1 118.49 +169 144 1 4.77 +170 145 1 11.08 +171 146 1 12.55 +172 147 1 53.43 +173 148 1 1832.91 +174 149 1 157.50 +175 150 1 40.33 +176 151 1 13.00 +177 152 2 641.11 +178 153 1 388.82 +179 154 1 40.96 +180 155 1 10.26 +181 155 2 10.26 +182 156 1 50.00 +183 157 1 13.00 +184 158 1 1200.00 +185 159 1 22.90 +186 160 1 129.56 +187 161 1 47.78 +188 162 1 7.30 +189 162 2 7.30 +190 163 1 11.50 +191 163 2 11.50 +192 164 1 76.14 +193 165 1 34.13 +194 165 2 34.13 +195 166 1 240.00 +196 166 2 240.00 +197 167 1 31.36 +198 168 1 1710.81 +199 169 1 135.00 +200 170 1 34.56 +201 171 1 47.50 +202 172 1 20.00 +203 173 1 78.95 +204 174 1 1300.00 +205 175 1 120.00 +206 176 1 729.51 +209 178 2 989.95 +210 179 1 19.60 +211 180 1 8.41 +212 180 2 8.41 +213 181 1 240.00 +214 181 2 240.00 +215 182 1 86.38 +216 183 1 16.00 +217 184 1 94.88 +218 185 1 57.47 +219 186 1 14.99 +220 187 1 80.00 +221 188 1 81.16 +222 189 1 13.75 +223 190 1 22.55 +224 191 1 391.00 +225 192 1 7.49 +226 193 1 89.90 +227 194 1 13.50 +228 195 1 19.94 +229 196 1 48.54 +230 196 2 48.54 +231 197 1 70.97 +232 197 2 70.97 +233 198 1 125.56 +234 199 1 33.89 +235 200 1 19.38 +236 201 1 11.88 +237 202 1 76.77 +238 203 1 81.47 +239 204 1 10.00 +240 205 1 60.00 +241 206 1 11.50 +242 206 2 11.50 +243 207 1 39.94 +244 207 2 39.93 +246 211 1 59.73 +247 211 2 59.72 +248 212 1 60.91 +249 212 2 60.90 +250 213 2 91.35 +251 214 1 12.77 +252 215 1 2175.00 +253 216 1 1000.00 +254 217 1 51.45 +255 218 1 50.00 +256 219 1 34.93 +257 220 1 16.60 +258 221 1 11.50 +259 221 2 11.50 +260 222 1 130.00 +261 222 2 130.00 +262 223 1 30.08 +263 224 1 14.10 +264 225 1 8.75 +265 225 2 8.74 +266 226 1 124.00 +267 209 1 3410.62 +268 227 1 46.28 +269 228 1 250.80 +270 229 1 108.10 +271 230 1 19.85 +272 231 1 44.46 +273 231 2 44.45 +274 232 1 10.89 +275 233 1 17.01 +276 233 2 17.00 +277 234 1 240.00 +278 234 2 240.00 +279 235 1 12.85 +280 236 1 1798.81 +281 237 1 150.00 +282 238 1 535.00 +284 131 1 0.00 +285 152 1 0.00 +286 178 1 0.00 +287 210 1 0.00 +288 213 1 0.00 +289 240 1 46.67 +290 241 1 13.00 +291 242 1 965.00 +292 243 1 14.93 +293 243 2 0.00 +294 244 1 108.03 +295 244 2 0.00 +296 245 1 13.40 +\. + + +-- +-- Data for Name: expensesShares; Type: TABLE DATA; Schema: public; Owner: expdbuser +-- + +COPY public."expensesShares" ("ExpShareID", "ExpID", "UserID", "Share", "Calculated") FROM stdin; +1 1 1 1.00 93.47 +2 2 1 1.00 32.00 +3 3 1 1.00 9.98 +4 4 1 1.00 40.43 +5 5 1 1.00 11.00 +6 6 1 1.00 5.90 +7 7 1 1.00 19.99 +8 8 1 0.50 7.00 +9 8 2 0.50 7.00 +10 9 1 1.00 12.62 +11 10 1 1.00 230.00 +12 11 1 1.00 45.39 +13 12 1 0.50 99.00 +14 12 2 0.50 98.99 +15 13 1 0.50 17.50 +16 13 2 0.50 17.50 +17 14 1 1.00 32.00 +18 15 1 1.00 64.45 +19 16 1 1.00 163.08 +20 17 1 1.00 10.50 +21 18 1 0.50 66.58 +22 18 2 0.50 66.57 +23 19 1 1.00 9.84 +24 20 1 1.00 38.72 +25 21 1 1.00 7.20 +26 22 1 1.00 5.52 +27 23 1 1.00 7.95 +28 24 1 0.50 225.00 +29 24 2 0.50 225.00 +30 25 1 1.00 10.50 +31 26 1 1.00 73.38 +32 27 1 1.00 14.00 +33 28 1 1.00 41.31 +34 29 1 1.00 1769.64 +35 30 1 1.00 15.00 +36 31 1 1.00 45.40 +37 32 1 1.00 20.49 +38 33 1 1.00 165.00 +39 34 1 1.00 38.50 +40 35 1 1.00 32.73 +41 36 1 1.00 49.20 +42 37 1 1.00 59.09 +43 38 1 1.00 50.00 +44 39 1 1.00 6.00 +45 40 1 1.00 44.25 +46 41 1 1.00 12.98 +47 42 1 1.00 18.20 +48 43 1 1.00 25.00 +49 44 1 0.50 8.76 +50 44 2 0.50 8.75 +51 45 1 1.00 316.45 +52 46 1 0.50 116.28 +53 46 2 0.50 116.27 +54 47 1 1.00 9.98 +55 48 1 1.00 68.57 +56 49 1 1.00 49.00 +57 50 1 1.00 31.00 +58 51 1 1.00 14.99 +59 52 1 1.00 21.07 +60 53 1 1.00 84.66 +61 54 1 1.00 5.00 +62 55 1 1.00 27.95 +63 56 1 1.00 7.95 +64 57 1 1.00 50.00 +65 58 1 1.00 136.97 +66 59 1 1.00 17.85 +67 60 1 1.00 36.90 +68 61 1 0.50 225.00 +69 61 2 0.50 225.00 +70 62 1 1.00 104.00 +71 63 1 1.00 63.55 +72 64 1 1.00 19.95 +73 65 1 1.00 17.97 +74 66 1 0.50 74.03 +75 66 2 0.50 74.02 +76 67 1 1.00 23.43 +77 68 1 1.00 32.00 +78 69 1 1.00 57.23 +79 70 1 1.00 70.70 +80 71 1 1.00 1867.06 +81 72 1 1.00 150.00 +82 73 1 1.00 8.40 +83 74 1 1.00 28.65 +84 75 1 1.00 73.00 +85 76 1 1.00 12.62 +86 77 1 0.50 39.45 +87 77 2 0.50 39.45 +88 78 1 0.50 116.50 +89 78 2 0.50 116.50 +90 79 1 0.50 7.30 +91 79 2 0.50 7.30 +92 80 1 1.00 70.00 +93 81 1 1.00 5.70 +94 82 1 1.00 39.64 +95 83 1 0.50 17.50 +96 83 2 0.50 17.50 +97 84 1 1.00 30.47 +98 85 1 1.00 15.75 +99 86 1 1.00 40.00 +100 87 1 1.00 29.85 +101 88 1 1.00 47.12 +102 89 1 1.00 10.00 +103 90 1 1.00 81.01 +104 91 1 0.50 15.55 +105 91 2 0.50 15.55 +106 92 1 0.50 225.00 +107 92 2 0.50 225.00 +108 93 1 1.00 105.74 +109 94 1 1.00 50.00 +110 95 1 1.00 15.75 +111 96 1 1.00 157.50 +112 97 1 1.00 3077.19 +113 98 1 1.00 67.50 +114 99 1 1.00 10.98 +115 100 1 1.00 145.00 +116 101 1 1.00 40.00 +117 102 1 1.00 40.95 +118 103 1 1.00 31.99 +119 104 1 0.50 122.99 +120 104 2 0.50 122.98 +121 105 1 1.00 27.00 +122 106 1 0.50 6.45 +123 106 2 0.50 6.45 +124 107 1 1.00 26.30 +125 108 1 1.00 34.00 +126 109 1 1.00 199.00 +127 110 1 1.00 43.70 +128 111 1 1.00 1370.64 +129 112 1 1.00 34.75 +130 113 1 1.00 11.82 +131 114 1 1.00 32.00 +132 115 1 1.00 50.00 +133 116 1 1.00 24.90 +134 117 1 1.00 46.64 +135 118 1 0.50 48.45 +136 118 2 0.50 48.44 +137 119 1 1.00 9.94 +138 120 1 0.50 240.00 +139 120 2 0.50 240.00 +140 121 1 1.00 50.00 +141 122 1 0.50 8.53 +142 122 2 0.50 8.53 +143 123 1 1.00 75.20 +144 124 1 1.00 13.90 +145 125 1 1.00 48.06 +146 126 1 1.00 1710.81 +147 127 1 1.00 150.00 +148 128 1 1.00 36.64 +149 129 1 0.50 61.50 +150 129 2 0.50 61.49 +151 130 1 1.00 31.69 +152 131 2 1.00 398.63 +153 132 1 1.00 357.75 +154 133 1 1.00 162.50 +155 134 1 1.00 12.00 +156 135 1 0.50 11.88 +157 135 2 0.50 11.88 +158 136 1 0.50 7.97 +159 136 2 0.50 7.97 +160 137 1 1.00 43.74 +161 138 1 1.00 40.00 +162 139 1 1.00 45.25 +163 140 1 1.00 10.00 +164 141 1 0.50 240.00 +165 141 2 0.50 240.00 +166 142 1 0.50 43.83 +167 142 2 0.50 43.82 +168 143 1 1.00 118.49 +169 144 1 1.00 4.77 +170 145 1 1.00 11.08 +171 146 1 1.00 12.55 +172 147 1 1.00 53.43 +173 148 1 1.00 1832.91 +174 149 1 1.00 157.50 +175 150 1 1.00 40.33 +176 151 1 1.00 13.00 +177 152 2 1.00 641.11 +178 153 1 1.00 388.82 +179 154 1 1.00 40.96 +180 155 1 0.50 10.26 +181 155 2 0.50 10.26 +182 156 1 1.00 50.00 +183 157 1 1.00 13.00 +184 158 1 1.00 1200.00 +185 159 1 1.00 22.90 +186 160 1 1.00 129.56 +187 161 1 1.00 47.78 +188 162 1 0.50 7.30 +189 162 2 0.50 7.30 +190 163 1 0.50 11.50 +191 163 2 0.50 11.50 +192 164 1 1.00 76.14 +193 165 1 0.50 34.13 +194 165 2 0.50 34.13 +195 166 1 0.50 240.00 +196 166 2 0.50 240.00 +197 167 1 1.00 31.36 +198 168 1 1.00 1710.81 +199 169 1 1.00 135.00 +200 170 1 1.00 34.56 +201 171 1 1.00 47.50 +202 172 1 1.00 20.00 +203 173 1 1.00 78.95 +204 174 1 1.00 1300.00 +205 175 1 1.00 120.00 +206 176 1 1.00 729.51 +209 178 2 1.00 989.95 +210 179 1 1.00 19.60 +211 180 1 0.50 8.41 +212 180 2 0.50 8.41 +213 181 1 0.50 240.00 +214 181 2 0.50 240.00 +215 182 1 1.00 86.38 +216 183 1 1.00 16.00 +217 184 1 1.00 94.88 +218 185 1 1.00 57.47 +219 186 1 1.00 14.99 +220 187 1 1.00 80.00 +221 188 1 1.00 81.16 +222 189 1 1.00 13.75 +223 190 1 1.00 22.55 +224 191 1 1.00 391.00 +225 192 1 1.00 7.49 +226 193 1 1.00 89.90 +227 194 1 1.00 13.50 +228 195 1 1.00 19.94 +229 196 1 0.50 48.54 +230 196 2 0.50 48.54 +231 197 1 0.50 70.97 +232 197 2 0.50 70.97 +233 198 1 1.00 125.56 +234 199 1 1.00 33.89 +235 200 1 1.00 19.38 +236 201 1 1.00 11.88 +237 202 1 1.00 76.77 +238 203 1 1.00 81.47 +239 204 1 1.00 10.00 +240 205 1 1.00 60.00 +241 206 1 0.50 11.50 +242 206 2 0.50 11.50 +243 207 1 0.50 39.94 +244 207 2 0.50 39.93 +246 211 1 0.50 59.73 +247 211 2 0.50 59.72 +248 212 1 0.50 60.91 +249 212 2 0.50 60.90 +250 213 2 1.00 91.35 +251 214 1 1.00 12.77 +252 215 1 1.00 2175.00 +253 216 1 1.00 1000.00 +254 217 1 1.00 51.45 +255 218 1 1.00 50.00 +257 219 1 1.00 34.93 +259 220 1 1.00 16.60 +260 221 1 0.50 11.50 +261 221 2 0.50 11.50 +262 222 1 0.50 130.00 +263 222 2 0.50 130.00 +264 223 1 1.00 30.08 +265 224 1 1.00 14.10 +266 225 1 0.50 8.75 +267 225 2 0.50 8.74 +268 226 1 1.00 124.00 +269 209 1 1.00 3410.62 +270 227 1 1.00 46.28 +271 228 1 1.00 250.80 +272 229 1 1.00 108.10 +273 230 1 1.00 19.85 +274 231 1 0.50 44.46 +275 231 2 0.50 44.45 +276 232 1 1.00 10.89 +277 233 1 0.50 17.01 +278 233 2 0.50 17.00 +279 234 1 0.50 240.00 +280 234 2 0.50 240.00 +281 235 1 1.00 12.85 +282 236 1 1.00 1798.81 +283 237 1 1.00 150.00 +284 238 1 1.00 535.00 +286 131 1 0.00 0.00 +287 152 1 0.00 0.00 +288 178 1 0.00 0.00 +289 210 1 0.00 0.00 +290 213 1 0.00 0.00 +291 240 1 1.00 46.67 +292 241 1 1.00 13.00 +293 242 1 1.00 965.00 +294 243 1 0.50 7.47 +295 243 2 0.50 7.46 +296 244 1 0.50 54.02 +297 244 2 0.50 54.01 +298 245 1 1.00 13.40 +\. + + +-- +-- Data for Name: schema_migrations; Type: TABLE DATA; Schema: public; Owner: expdbuser +-- + +COPY public.schema_migrations (version, dirty) FROM stdin; +\. + + +-- +-- Name: categories_CategoryID_seq; Type: SEQUENCE SET; Schema: public; Owner: expdbuser +-- + +SELECT pg_catalog.setval('public."categories_CategoryID_seq"', 25, true); + + +-- +-- Name: expenseTypes_TypeID_seq; Type: SEQUENCE SET; Schema: public; Owner: expdbuser +-- + +SELECT pg_catalog.setval('public."expenseTypes_TypeID_seq"', 5, true); + + +-- +-- Name: expensesPayments_ExpPaymID_seq; Type: SEQUENCE SET; Schema: public; Owner: expdbuser +-- + +SELECT pg_catalog.setval('public."expensesPayments_ExpPaymID_seq"', 296, true); + + +-- +-- Name: expensesShares_ExpShareID_seq; Type: SEQUENCE SET; Schema: public; Owner: expdbuser +-- + +SELECT pg_catalog.setval('public."expensesShares_ExpShareID_seq"', 298, true); + + +-- +-- Name: expenses_ExpID_seq; Type: SEQUENCE SET; Schema: public; Owner: expdbuser +-- + +SELECT pg_catalog.setval('public."expenses_ExpID_seq"', 245, true); + + +-- +-- Name: stores_StoreID_seq; Type: SEQUENCE SET; Schema: public; Owner: expdbuser +-- + +SELECT pg_catalog.setval('public."stores_StoreID_seq"', 45, true); + + +-- +-- Name: users_UserID_seq; Type: SEQUENCE SET; Schema: public; Owner: expdbuser +-- + +SELECT pg_catalog.setval('public."users_UserID_seq"', 2, true); + + +-- +-- PostgreSQL database dump complete +-- + +\unrestrict YD6WOUPNPjmsw55mlY0y3tJ8W2L6YjUXHMPUkdckfUq4elWGHIrGHkeyf7x1D0N +