From aa6996051927777c8b1bafe18c5a4cf7808d0e26 Mon Sep 17 00:00:00 2001 From: qowevisa Date: Sat, 3 Aug 2024 08:05:46 +0300 Subject: [PATCH] Rename Account->Card in db package --- db/{account.go => card.go} | 4 ++-- db/db.go | 2 +- db/debt.go | 14 +++++++------- db/income.go | 8 ++++---- db/payment.go | 4 ++-- 5 files changed, 16 insertions(+), 16 deletions(-) rename db/{account.go => card.go} (69%) diff --git a/db/account.go b/db/card.go similarity index 69% rename from db/account.go rename to db/card.go index e6178f7..8d13aa1 100644 --- a/db/account.go +++ b/db/card.go @@ -2,8 +2,8 @@ package db import "gorm.io/gorm" -// Account can be either card or wallet -type Account struct { +// Card can be either card or wallet +type Card struct { gorm.Model Name string Value uint64 diff --git a/db/db.go b/db/db.go index b9bacd2..cccc2b1 100644 --- a/db/db.go +++ b/db/db.go @@ -42,7 +42,7 @@ func Connect() *gorm.DB { log.Panic(err) } newUDB := gormDB - gormDB.AutoMigrate(&Account{}) + gormDB.AutoMigrate(&Card{}) gormDB.AutoMigrate(&Category{}) gormDB.AutoMigrate(&Item{}) gormDB.AutoMigrate(&ItemPrice{}) diff --git a/db/debt.go b/db/debt.go index 0e7f50b..b7d8558 100644 --- a/db/debt.go +++ b/db/debt.go @@ -8,11 +8,11 @@ import ( type Debt struct { gorm.Model - AccountID uint - Account *Account - Value uint64 - IOwe bool - Date time.Time - DateEnd time.Time - Finished bool + CardID uint + Card *Card + Value uint64 + IOwe bool + Date time.Time + DateEnd time.Time + Finished bool } diff --git a/db/income.go b/db/income.go index 0a5003f..5109f17 100644 --- a/db/income.go +++ b/db/income.go @@ -8,8 +8,8 @@ import ( type Income struct { gorm.Model - AccountID uint - Account *Account - Value uint64 - Date time.Time + CardID uint + Card *Card + Value uint64 + Date time.Time } diff --git a/db/payment.go b/db/payment.go index cbd16c6..fa48849 100644 --- a/db/payment.go +++ b/db/payment.go @@ -9,8 +9,8 @@ import ( // For grocery payment type Payment struct { gorm.Model - AccountID uint - Account *Account + CardID uint + Card *Card CategoryID uint Category *Category Name string