add driversLicence model

This commit is contained in:
Alex
2024-09-29 21:16:58 +02:00
parent 41738753f0
commit 8a581da1d8
9 changed files with 135 additions and 16 deletions

View File

@@ -0,0 +1,27 @@
package models
import (
"time"
"gorm.io/gorm"
)
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"`
LicenceCategories []LicenceCategory `json:"licence_categories" gorm:"many2many:licence_2_categories"`
}
type LicenceCategory struct {
gorm.Model
Category string `json:"licence_category" validate:"safe_content"`
}
// func (d *DriversLicence) BeforeCreate(tx *gorm.DB) (err error) {
// d.Status = constants.UnverifiedStatus
// return
// }