22 lines
648 B
Go
22 lines
648 B
Go
package entity
|
|
|
|
import (
|
|
"time"
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type User struct {
|
|
ID uuid.UUID `json:"id" gorm:"type:uuid;primaryKey"`
|
|
NomorInduk *string `json:"nomor_induk,omitempty" gorm:"unique"` // Add this field
|
|
RoleID uuid.UUID `json:"role_id" gorm:"type:uuid"`
|
|
Role Role `json:"role" gorm:"foreignKey:RoleID"`
|
|
Name string `json:"name"`
|
|
Username string `json:"username" gorm:"unique"`
|
|
Password string `json:"password"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
func (User) TableName() string {
|
|
return "users"
|
|
} |