Add user registration with password hashing and restructure handlers directory
This commit is contained in:
@@ -1 +1,18 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"CatsOfMastodonBotGo/internal/models"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type UserService struct {
|
||||
db *gorm.DB
|
||||
}
|
||||
|
||||
func NewUserService(db *gorm.DB) *UserService {
|
||||
return &UserService{db: db}
|
||||
}
|
||||
|
||||
func (us *UserService) CreateUser(user models.ComUser) int {
|
||||
return int(us.db.Create(&user).RowsAffected)
|
||||
}
|
||||
Reference in New Issue
Block a user