diff --git a/internal/models/ActiveVoucherModel.go b/internal/models/ActiveVoucherModel.go new file mode 100644 index 0000000..4eca12f --- /dev/null +++ b/internal/models/ActiveVoucherModel.go @@ -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 +} diff --git a/internal/models/TransactionModel.go b/internal/models/TransactionModel.go new file mode 100644 index 0000000..c1dcbd6 --- /dev/null +++ b/internal/models/TransactionModel.go @@ -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 +} diff --git a/internal/models/UserModel.go b/internal/models/UserModel.go new file mode 100644 index 0000000..4a375d1 --- /dev/null +++ b/internal/models/UserModel.go @@ -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 +} diff --git a/internal/models/VoucherModel.go b/internal/models/VoucherModel.go new file mode 100644 index 0000000..2878e9d --- /dev/null +++ b/internal/models/VoucherModel.go @@ -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 +}