-
Notifications
You must be signed in to change notification settings - Fork 0
/
identity.go
61 lines (54 loc) · 1.63 KB
/
identity.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package account
import (
"time"
"github.com/google/uuid"
alira "github.com/ivohutasoit/alira"
"github.com/jinzhu/gorm"
)
type Identity struct {
alira.Model
Class string
UserID string
Code string
Email string `gorm:"default:null"`
NotBefore time.Time
NotAfter time.Time `gorm:"default:null"`
Valid bool `gorm:"default:true"`
}
func (model *Identity) BeforeCreate(scope *gorm.Scope) error {
scope.SetColumn("ID", uuid.New().String())
scope.SetColumn("NotBefore", time.Now())
return nil
}
func (Identity) TableName() string {
return "identities"
}
type NationalIdentity struct {
alira.Model
IdentityID string
UserID string
Document string
NationID string
Fullname string
BirthPlace string
BirthDate time.Time `gorm:"default:null"`
Address string `gorm:"default:null"`
City string `gorm:"default:null"`
State string `gorm:"default:null"`
Province string `gorm:"default:null"`
Country string `gorm:"default:null"`
PostalCode string `gorm:"default:null"`
BloodType string `gorm:"default:null"`
Religion string `gorm:"default:null"`
MarriedStatus string `gorm:"default:null"`
Type string `gorm:"default:null"`
Nationality string `gorm:"default:null"`
IssueDate time.Time `gorm:"default:null"`
ExpiryDate time.Time `gorm:"default:null"`
RegistrationNo string `gorm:"default:null"`
IssuedOffice string `gorm:"default:null"`
Nikim string `gorm:"default:null"`
}
func (NationalIdentity) TableName() string {
return "national_identities"
}