feat: Authors feature backend (and upgraded deprecated mods)
This commit is contained in:
1 parent
a11338094e
commit
b34a173d83
103 files changed
+6454
-240
No files matched your search
@@ -0,0 +1,25 @@
|
||||
package useCases
|
||||
|
||||
import (
|
||||
"RenewCMS/internal/domain/author"
|
||||
"errors"
|
||||
)
|
||||
|
||||
type GetMyAuthorUseCase struct {
|
||||
authors author.Repository
|
||||
}
|
||||
|
||||
func NewGetMyAuthorUseCase(authors author.Repository) *GetMyAuthorUseCase {
|
||||
return &GetMyAuthorUseCase{authors: authors}
|
||||
}
|
||||
|
||||
func (u *GetMyAuthorUseCase) Get(userID uint32) (*author.Author, error) {
|
||||
found, err := u.authors.GetByUserID(userID)
|
||||
if errors.Is(err, author.ErrAuthorNotFound) {
|
||||
return nil, nil
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &found, nil
|
||||
}
|
||||
Reference in new issue
Block a user