Documentation
¶
Index ¶
Constants ¶
View Source
const ( RoleMember = "member" RoleStudent = "student" )
Variables ¶
Functions ¶
func IsValidRole ¶
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
type LoginRequest ¶
type LoginRequest struct {
Email string `json:"email" binding:"required,email"`
Password string `json:"password" binding:"required"`
}
ورودیِ لاگین
type Repository ¶
func NewRepository ¶
func NewRepository(db *gorm.DB) Repository
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(repo Repository) *Service
type SignupRequest ¶
type SignupRequest struct {
Name string `json:"name" binding:"required"`
Email string `json:"email" binding:"required,email"`
Password string `json:"password" binding:"required,min=8"`
Role string `json:"role" binding:"required"` // member | student
}
ورودیِ ثبتنام
type User ¶
type User struct {
ID uint `gorm:"primaryKey" json:"id"`
Name string `gorm:"size:100;not null" json:"name"`
Email string `gorm:"size:190;not null;uniqueIndex" json:"email"`
PasswordHash string `gorm:"size:255;not null" json:"-"`
Role string `gorm:"size:20;not null;default:member" json:"role"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
}
مدل دیتابیسی کاربر
Click to show internal directories.
Click to hide internal directories.