preorder/users/models.go

34 lines
675 B
Go
Raw Permalink Normal View History

2024-06-20 02:49:55 +00:00
package users
2024-06-19 03:10:57 +00:00
import (
"time"
)
type User struct {
ID uint `json:"id" gorm:"primary_key"`
Username string `json:"username" gorm:"unique"`
Password string `json:"password"`
CreatedAt time.Time
UpdatedAt time.Time
}
type CreateUserInput struct {
Username string `json:"username" binding:"required"`
Password string `json:"password" binding:"required"`
}
type UpdateUserInput struct {
Username string `json:"username"`
}
func NewUser(id uint, username, password string, createdAt, updatedAt time.Time) User {
user := User{
2024-06-20 02:49:55 +00:00
ID: id,
Username: username,
Password: password,
2024-06-19 03:10:57 +00:00
CreatedAt: createdAt,
UpdatedAt: updatedAt,
}
return user
}