add missing files

This commit is contained in:
2025-03-02 20:35:53 +01:00
parent ca9417b750
commit d9bd3aa719
54 changed files with 60867 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
package services
import(
"golang.org/x/crypto/bcrypt"
"example.com/gin/test/models"
"example.com/gin/test/repositories"
)
var(
ShopItems ShopItemService = ShopItemService{}
)
type ShopItemService struct {}
func (u *ShopItemService) Create(name string, email string, password string) (models.User, error) {
//hash pw
hash, err := bcrypt.GenerateFromPassword([]byte(password), 10)
if err != nil {
return models.User{}, err
}
user := models.User{Name: name, Email: email, Password: string(hash)}
_, err = repositories.Users.Create(user)
if err != nil {
return models.User{}, err
}
return user, nil
}