added validation; DB is global now
This commit is contained in:
@@ -8,24 +8,24 @@ import (
|
||||
|
||||
type User struct {
|
||||
UpdatedAt time.Time
|
||||
DateOfBirth time.Time `gorm:"not null" json:"date_of_birth"`
|
||||
DateOfBirth time.Time `gorm:"not null" json:"date_of_birth" validate:"required,age"`
|
||||
CreatedAt time.Time
|
||||
Salt *string `json:"-"`
|
||||
Phone *string `json:"phone"`
|
||||
Phone string `json:"phone" validate:"omitempty,omitnil,e164"`
|
||||
Notes *string `json:"notes"`
|
||||
FirstName string `gorm:"not null" json:"first_name"`
|
||||
FirstName string `gorm:"not null" json:"first_name" validate:"required,alphaunicode"`
|
||||
Password string `json:"password"`
|
||||
Email string `gorm:"unique;not null" json:"email"`
|
||||
LastName string `gorm:"not null" json:"last_name"`
|
||||
ProfilePicture string `json:"profile_picture"`
|
||||
Address string `gorm:"not null" json:"address"`
|
||||
ZipCode string `gorm:"not null" json:"zip_code"`
|
||||
City string `form:"not null" json:"city"`
|
||||
Email string `gorm:"unique;not null" json:"email" validate:"required,email"`
|
||||
LastName string `gorm:"not null" json:"last_name" validate:"required,alphaunicode"`
|
||||
ProfilePicture string `json:"profile_picture" validate:"omitempty,image"`
|
||||
Address string `gorm:"not null" json:"address" validate:"required"`
|
||||
ZipCode string `gorm:"not null" json:"zip_code" validate:"required,alphanum"`
|
||||
City string `form:"not null" json:"city" validate:"required,alphaunicode"`
|
||||
Consents []Consent `gorm:"constraint:OnUpdate:CASCADE"`
|
||||
BankAccount BankAccount `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
|
||||
BankAccount BankAccount `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"bank_account"`
|
||||
Verification Verification `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
|
||||
Membership Membership `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
|
||||
ParentMemberID int64 `json:"parent_member_id"`
|
||||
Membership Membership `gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;" json:"membership"`
|
||||
ParentMemberID int64 `json:"parent_member_id" validate:"omitempty,number"`
|
||||
ID int64 `gorm:"primaryKey"`
|
||||
PaymentStatus int8 `json:"payment_status"`
|
||||
Status int8 `json:"status"`
|
||||
|
||||
Reference in New Issue
Block a user