Rename Account->Card in db package

This commit is contained in:
qowevisa 2024-08-03 08:05:46 +03:00
parent cf09928a39
commit aa69960519
5 changed files with 16 additions and 16 deletions

View File

@ -2,8 +2,8 @@ package db
import "gorm.io/gorm" import "gorm.io/gorm"
// Account can be either card or wallet // Card can be either card or wallet
type Account struct { type Card struct {
gorm.Model gorm.Model
Name string Name string
Value uint64 Value uint64

View File

@ -42,7 +42,7 @@ func Connect() *gorm.DB {
log.Panic(err) log.Panic(err)
} }
newUDB := gormDB newUDB := gormDB
gormDB.AutoMigrate(&Account{}) gormDB.AutoMigrate(&Card{})
gormDB.AutoMigrate(&Category{}) gormDB.AutoMigrate(&Category{})
gormDB.AutoMigrate(&Item{}) gormDB.AutoMigrate(&Item{})
gormDB.AutoMigrate(&ItemPrice{}) gormDB.AutoMigrate(&ItemPrice{})

View File

@ -8,11 +8,11 @@ import (
type Debt struct { type Debt struct {
gorm.Model gorm.Model
AccountID uint CardID uint
Account *Account Card *Card
Value uint64 Value uint64
IOwe bool IOwe bool
Date time.Time Date time.Time
DateEnd time.Time DateEnd time.Time
Finished bool Finished bool
} }

View File

@ -8,8 +8,8 @@ import (
type Income struct { type Income struct {
gorm.Model gorm.Model
AccountID uint CardID uint
Account *Account Card *Card
Value uint64 Value uint64
Date time.Time Date time.Time
} }

View File

@ -9,8 +9,8 @@ import (
// For grocery payment // For grocery payment
type Payment struct { type Payment struct {
gorm.Model gorm.Model
AccountID uint CardID uint
Account *Account Card *Card
CategoryID uint CategoryID uint
Category *Category Category *Category
Name string Name string