add checkbox styling, driverslicence handling and validation
This commit is contained in:
@@ -8,20 +8,15 @@ import (
|
||||
|
||||
type DriversLicence struct {
|
||||
gorm.Model
|
||||
Status int8 `json:"licence_status" validate:"omitempty,number"`
|
||||
LicenceNumber string `json:"licence_number" validate:"safe_content"`
|
||||
IssuedDate time.Time `json:"licence_issued_date" validate:"omitempty,lte"`
|
||||
ExpirationDate time.Time `json:"licence_expiration_date" validate:"omitempty,gt"`
|
||||
IssuingCountry string `json:"licence_country" validate:"safe_content"`
|
||||
Status int8 `json:"status" validate:"omitempty,number"`
|
||||
LicenceNumber string `json:"number" validate:"omitempty,euDriversLicence,safe_content"`
|
||||
IssuedDate time.Time `json:"issued_date" validate:"omitempty,lte"`
|
||||
ExpirationDate time.Time `json:"expiration_date" validate:"omitempty,gt"`
|
||||
IssuingCountry string `json:"country" validate:"safe_content"`
|
||||
LicenceCategories []LicenceCategory `json:"licence_categories" gorm:"many2many:licence_2_categories"`
|
||||
}
|
||||
|
||||
type LicenceCategory struct {
|
||||
gorm.Model
|
||||
Category string `json:"licence_category" validate:"safe_content"`
|
||||
Category string `json:"category" validate:"safe_content"`
|
||||
}
|
||||
|
||||
// func (d *DriversLicence) BeforeCreate(tx *gorm.DB) (err error) {
|
||||
// d.Status = constants.UnverifiedStatus
|
||||
// return
|
||||
// }
|
||||
|
||||
@@ -98,5 +98,13 @@ func (u *User) Safe() map[string]interface{} {
|
||||
"bic": u.BankAccount.BIC,
|
||||
"mandate_reference": u.BankAccount.MandateReference,
|
||||
},
|
||||
"drivers_licence": map[string]interface{}{
|
||||
"id": u.DriversLicence.ID,
|
||||
"status": u.DriversLicence.Status,
|
||||
"issued_date": u.DriversLicence.IssuedDate,
|
||||
"expiration_date": u.DriversLicence.ExpirationDate,
|
||||
"country": u.DriversLicence.IssuingCountry,
|
||||
"licence_categories": u.DriversLicence.LicenceCategories,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user