Initial commit: Open sourcing all of the Maple Open Technologies code.
This commit is contained in:
commit
755d54a99d
2010 changed files with 448675 additions and 0 deletions
34
native/desktop/maplefile/internal/usecase/user/create.go
Normal file
34
native/desktop/maplefile/internal/usecase/user/create.go
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
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)
|
||||
}
|
||||
19
native/desktop/maplefile/internal/usecase/user/getbyemail.go
Normal file
19
native/desktop/maplefile/internal/usecase/user/getbyemail.go
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
package user
|
||||
|
||||
import (
|
||||
"codeberg.org/mapleopentech/monorepo/native/desktop/maplefile/internal/domain/user"
|
||||
)
|
||||
|
||||
type GetByEmailUseCase struct {
|
||||
userRepo user.Repository
|
||||
}
|
||||
|
||||
func ProvideGetByEmailUseCase(userRepo user.Repository) *GetByEmailUseCase {
|
||||
return &GetByEmailUseCase{
|
||||
userRepo: userRepo,
|
||||
}
|
||||
}
|
||||
|
||||
func (uc *GetByEmailUseCase) Execute(email string) (*user.User, error) {
|
||||
return uc.userRepo.GetByEmail(email)
|
||||
}
|
||||
19
native/desktop/maplefile/internal/usecase/user/getbyid.go
Normal file
19
native/desktop/maplefile/internal/usecase/user/getbyid.go
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
package user
|
||||
|
||||
import (
|
||||
"codeberg.org/mapleopentech/monorepo/native/desktop/maplefile/internal/domain/user"
|
||||
)
|
||||
|
||||
type GetByIdUseCase struct {
|
||||
userRepo user.Repository
|
||||
}
|
||||
|
||||
func ProvideGetByIdUseCase(userRepo user.Repository) *GetByIdUseCase {
|
||||
return &GetByIdUseCase{
|
||||
userRepo: userRepo,
|
||||
}
|
||||
}
|
||||
|
||||
func (uc *GetByIdUseCase) Execute(id string) (*user.User, error) {
|
||||
return uc.userRepo.GetByID(id)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue