added models
This commit is contained in:
parent
27895bf211
commit
b625b3cf5e
17
internal/models/ActiveVoucherModel.go
Normal file
17
internal/models/ActiveVoucherModel.go
Normal file
@ -0,0 +1,17 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/gofrs/uuid"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type ActiveVoucher struct {
|
||||
gorm.Model
|
||||
ID uuid.UUID `gorm:"type:uuid;primary_key;default:uuid_generate_v4()"`
|
||||
UserID uuid.UUID
|
||||
VoucherID uuid.UUID
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
}
|
21
internal/models/TransactionModel.go
Normal file
21
internal/models/TransactionModel.go
Normal file
@ -0,0 +1,21 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/gofrs/uuid"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type Transaction struct {
|
||||
gorm.Model
|
||||
ID uuid.UUID `gorm:"type:uuid;primary_key;default:uuid_generate_v4()"`
|
||||
UserID uuid.UUID
|
||||
VoucherID uuid.UUID
|
||||
Amount string
|
||||
Sender string
|
||||
Receiver string
|
||||
Status string
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
}
|
31
internal/models/UserModel.go
Normal file
31
internal/models/UserModel.go
Normal file
@ -0,0 +1,31 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/gofrs/uuid"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type User struct {
|
||||
gorm.Model
|
||||
ID uuid.UUID `gorm:"type:uuid;primary_key;default:uuid_generate_v4()"`
|
||||
SessionID string `gorm:"unique"`
|
||||
PublicKey string
|
||||
CustodialID string
|
||||
TrackingID string
|
||||
FirstName string
|
||||
FamilyName string
|
||||
Offerings string
|
||||
Gender string
|
||||
YOB string
|
||||
Location string
|
||||
Status string
|
||||
AccountPIN string
|
||||
TemporaryPIN string
|
||||
ActiveVouchers []ActiveVoucher `gorm:"foreignKey:UserID"`
|
||||
Transactions []Transaction `gorm:"foreignKey:UserID"`
|
||||
Vouchers []Voucher `gorm:"foreignKey:UserID"`
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
}
|
22
internal/models/VoucherModel.go
Normal file
22
internal/models/VoucherModel.go
Normal file
@ -0,0 +1,22 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/gofrs/uuid"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type Voucher struct {
|
||||
gorm.Model
|
||||
ID uuid.UUID `gorm:"type:uuid;primary_key;default:uuid_generate_v4()"`
|
||||
UserID uuid.UUID
|
||||
ContractAddress string
|
||||
TokenSymbol string
|
||||
TokenDecimals int
|
||||
Balance float64
|
||||
ActiveVouchers []ActiveVoucher `gorm:"foreignKey:VoucherID"`
|
||||
Transactions []Transaction `gorm:"foreignKey:VoucherID"`
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
}
|
Loading…
Reference in New Issue
Block a user