diff --git a/initializers/syncDatabase.go b/initializers/syncDatabase.go index 67dcb0f..a0adb70 100644 --- a/initializers/syncDatabase.go +++ b/initializers/syncDatabase.go @@ -4,4 +4,5 @@ import "tugas1/models" func SyncDatabase() { DB.AutoMigrate(&models.Post{}) + DB.AutoMigrate(&models.LoginRecord{}) } diff --git a/models/loginRecord.go b/models/loginRecord.go new file mode 100644 index 0000000..307b322 --- /dev/null +++ b/models/loginRecord.go @@ -0,0 +1,15 @@ +package models + +import ( + "time" + + "gorm.io/gorm" +) + +type LoginRecord struct { + gorm.Model + LoginDate time.Time + + UserIDs string `gorm:"type:text"` + Users []Post `json:"users" gorm:"-"` +} diff --git a/models/postModel.go b/models/postModel.go index 3ea0e84..5c6f3a7 100644 --- a/models/postModel.go +++ b/models/postModel.go @@ -1,16 +1,29 @@ package models import ( + "time" + "gorm.io/gorm" ) type Post struct { gorm.Model - Name string - Email string `gorm:"unique"` - Password string - Gender string - Address string - Tempat string - TLahir string + Nik string + Name string + Photo string + Birthdate time.Time + JobTitle string + Email string `gorm:"unique"` + LastLoginAt time.Time + CreatedBy string + UpdatedBy string + DeletedBy string + Token string + Username string + RoleID int + Password string + Gender string + Address string + Tempat string + TLahir string } diff --git a/tugas1.exe b/tugas1.exe index 5bb1c14..c2a5d70 100644 Binary files a/tugas1.exe and b/tugas1.exe differ