mirror of
https://github.com/FJurmanovic/wallet-go-api.git
synced 2026-02-06 06:08:16 +00:00
WA-9 - implemented wallet
This commit is contained in:
@@ -10,9 +10,12 @@ func Start(conn *pg.DB) {
|
||||
apiMigration := migrations.ApiMigration{Db: conn}
|
||||
usersMigration := migrations.UsersMigration{Db: conn}
|
||||
walletsMigration := migrations.WalletsMigration{Db: conn}
|
||||
transactionTypesMigration := migrations.TransactionTypesMigration{Db: conn}
|
||||
transactionsMigration := migrations.TransactionsMigration{Db: conn}
|
||||
|
||||
apiMigration.Create()
|
||||
usersMigration.Create()
|
||||
walletsMigration.Create()
|
||||
walletsMigration.PopulateTypes()
|
||||
transactionTypesMigration.Create()
|
||||
transactionsMigration.Create()
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ type UsersMigration struct {
|
||||
|
||||
func (am *UsersMigration) Create() {
|
||||
models := []interface{}{
|
||||
(*models.UserModel)(nil),
|
||||
(*models.User)(nil),
|
||||
}
|
||||
|
||||
for _, model := range models {
|
||||
|
||||
@@ -15,8 +15,7 @@ type WalletsMigration struct {
|
||||
|
||||
func (am *WalletsMigration) Create() {
|
||||
models := []interface{}{
|
||||
(*models.WalletTypeModel)(nil),
|
||||
(*models.WalletModel)(nil),
|
||||
(*models.Wallet)(nil),
|
||||
}
|
||||
|
||||
for _, model := range models {
|
||||
@@ -31,10 +30,3 @@ func (am *WalletsMigration) Create() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (am *WalletsMigration) PopulateTypes() {
|
||||
walletTypeModel := new(models.WalletTypeModel)
|
||||
walletTypeModel.Init()
|
||||
walletTypeModel.Name = "Test"
|
||||
am.Db.Model(walletTypeModel).Insert()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user