monorepo/native/desktop/maplefile/internal/usecase/user/create.go

34 lines
682 B
Go

package user
import (
"time"
"codeberg.org/mapleopentech/monorepo/native/desktop/maplefile/internal/domain/user"
)
type CreateUseCase struct {
userRepo user.Repository
}
func ProvideCreateUseCase(userRepo user.Repository) *CreateUseCase {
return &CreateUseCase{
userRepo: userRepo,
}
}
func (uc *CreateUseCase) Execute(
id, email, firstName, lastName string,
storageQuotaBytes int64,
) error {
u := &user.User{
ID: id,
Email: email,
FirstName: firstName,
LastName: lastName,
StorageQuotaBytes: storageQuotaBytes,
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
}
return uc.userRepo.Save(u)
}