mirror of
https://github.com/Floriansylvain/RenewCMS.git
synced 2026-08-19 11:43:22 +02:00
refac: mappers, file names
This commit is contained in:
@@ -18,8 +18,8 @@ func NewCreateArticleUseCase(articleRepository article.Repository) *CreateArticl
|
||||
}
|
||||
|
||||
func (g *CreateArticleUseCase) CreateArticle(createArticle CreateArticleCommand) (article.Article, error) {
|
||||
return g.articleRepository.Create(article.FromApi(
|
||||
createArticle.Title,
|
||||
createArticle.Body,
|
||||
))
|
||||
return g.articleRepository.Create(article.Article{
|
||||
Title: createArticle.Title,
|
||||
Body: createArticle.Body,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package useCases
|
||||
|
||||
import (
|
||||
"RenewCMS/internal/domain/user"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
@@ -23,13 +24,15 @@ func NewCreateUserUseCase(userRepository user.Repository) *CreateUserUseCase {
|
||||
func (g *CreateUserUseCase) CreateUser(createUser CreateUserCommand) (user.User, error) {
|
||||
rawUuid := uuid.NewString()
|
||||
|
||||
createdUser, err := g.userRepository.Create(user.FromApi(
|
||||
createUser.Username,
|
||||
createUser.Password,
|
||||
"",
|
||||
createUser.Email,
|
||||
rawUuid,
|
||||
))
|
||||
createdUser, err := g.userRepository.Create(user.User{
|
||||
Username: createUser.Username,
|
||||
Password: createUser.Password,
|
||||
PasswordResetCode: "",
|
||||
Email: createUser.Email,
|
||||
IsVerified: false,
|
||||
VerificationCode: rawUuid,
|
||||
VerificationExpiration: time.Now().Add(2 * time.Hour),
|
||||
})
|
||||
if err != nil {
|
||||
return user.User{}, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user