mirror of
https://github.com/Floriansylvain/RenewCMS.git
synced 2026-08-19 11:43:22 +02:00
clean: removed use of "." in imports
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
package useCases
|
||||
|
||||
import (
|
||||
. "GohCMS2/adapters/secondary/gateways"
|
||||
. "GohCMS2/domain/article"
|
||||
"GohCMS2/adapters/secondary/gateways"
|
||||
"GohCMS2/domain/article"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type CreateArticleUseCase struct {
|
||||
articleRepository ArticleRepository
|
||||
articleRepository gateways.ArticleRepository
|
||||
}
|
||||
|
||||
type CreateArticleCommand struct {
|
||||
@@ -17,10 +17,13 @@ type CreateArticleCommand struct {
|
||||
|
||||
func NewCreateArticleUseCase(db *gorm.DB) *CreateArticleUseCase {
|
||||
return &CreateArticleUseCase{
|
||||
articleRepository: *NewArticleRepository(db),
|
||||
articleRepository: *gateways.NewArticleRepository(db),
|
||||
}
|
||||
}
|
||||
|
||||
func (g *CreateArticleUseCase) CreateArticle(article CreateArticleCommand) (Article, error) {
|
||||
return g.articleRepository.Create(FromApi(article.Title, article.Body))
|
||||
func (g *CreateArticleUseCase) CreateArticle(createArticle CreateArticleCommand) (article.Article, error) {
|
||||
return g.articleRepository.Create(article.FromApi(
|
||||
createArticle.Title,
|
||||
createArticle.Body,
|
||||
))
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package useCases
|
||||
|
||||
import (
|
||||
. "GohCMS2/adapters/secondary/gateways"
|
||||
. "GohCMS2/domain/user"
|
||||
"GohCMS2/adapters/secondary/gateways"
|
||||
"GohCMS2/domain/user"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type CreateUserUseCase struct {
|
||||
userRepository UserRepository
|
||||
userRepository gateways.UserRepository
|
||||
}
|
||||
|
||||
type CreateUserCommand struct {
|
||||
@@ -18,10 +18,14 @@ type CreateUserCommand struct {
|
||||
|
||||
func NewCreateUserUseCase(db *gorm.DB) *CreateUserUseCase {
|
||||
return &CreateUserUseCase{
|
||||
userRepository: *NewUserRepository(db),
|
||||
userRepository: *gateways.NewUserRepository(db),
|
||||
}
|
||||
}
|
||||
|
||||
func (g *CreateUserUseCase) CreateUser(user CreateUserCommand) (User, error) {
|
||||
return g.userRepository.Create(FromApi(user.Username, user.Password, user.Email))
|
||||
func (g *CreateUserUseCase) CreateUser(createUser CreateUserCommand) (user.User, error) {
|
||||
return g.userRepository.Create(user.FromApi(
|
||||
createUser.Username,
|
||||
createUser.Password,
|
||||
createUser.Email,
|
||||
))
|
||||
}
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
package useCases
|
||||
|
||||
import (
|
||||
. "GohCMS2/adapters/secondary/gateways"
|
||||
. "GohCMS2/domain/article"
|
||||
"GohCMS2/adapters/secondary/gateways"
|
||||
"GohCMS2/domain/article"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type GetArticleUseCase struct {
|
||||
articleRepository ArticleRepository
|
||||
articleRepository gateways.ArticleRepository
|
||||
}
|
||||
|
||||
func NewGetArticleUseCase(db *gorm.DB) *GetArticleUseCase {
|
||||
return &GetArticleUseCase{
|
||||
articleRepository: *NewArticleRepository(db),
|
||||
articleRepository: *gateways.NewArticleRepository(db),
|
||||
}
|
||||
}
|
||||
|
||||
func (g *GetArticleUseCase) GetArticle(id uint32) (Article, error) {
|
||||
func (g *GetArticleUseCase) GetArticle(id uint32) (article.Article, error) {
|
||||
return g.articleRepository.Get(id)
|
||||
}
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
package useCases
|
||||
|
||||
import (
|
||||
. "GohCMS2/adapters/secondary/gateways"
|
||||
"GohCMS2/adapters/secondary/gateways"
|
||||
)
|
||||
|
||||
type GetPageUseCase struct {
|
||||
pageRepository PageRepository
|
||||
pageRepository gateways.PageRepository
|
||||
}
|
||||
|
||||
func NewGetPageUseCase() *GetPageUseCase {
|
||||
return &GetPageUseCase{
|
||||
pageRepository: *NewPageRepository(),
|
||||
pageRepository: *gateways.NewPageRepository(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
package useCases
|
||||
|
||||
import (
|
||||
. "GohCMS2/adapters/secondary/gateways"
|
||||
. "GohCMS2/domain/user"
|
||||
"GohCMS2/adapters/secondary/gateways"
|
||||
"GohCMS2/domain/user"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type GetUserUseCase struct {
|
||||
userRepository UserRepository
|
||||
userRepository gateways.UserRepository
|
||||
}
|
||||
|
||||
func NewGetUserUseCase(db *gorm.DB) *GetUserUseCase {
|
||||
return &GetUserUseCase{
|
||||
userRepository: *NewUserRepository(db),
|
||||
userRepository: *gateways.NewUserRepository(db),
|
||||
}
|
||||
}
|
||||
|
||||
func (g *GetUserUseCase) GetUser(id uint32) (User, error) {
|
||||
func (g *GetUserUseCase) GetUser(id uint32) (user.User, error) {
|
||||
return g.userRepository.Get(id)
|
||||
}
|
||||
|
||||
func (g *GetUserUseCase) GetUserByUsername(username string) (User, error) {
|
||||
func (g *GetUserUseCase) GetUserByUsername(username string) (user.User, error) {
|
||||
return g.userRepository.GetByUsername(username)
|
||||
}
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
package useCases
|
||||
|
||||
import (
|
||||
. "GohCMS2/adapters/secondary/gateways"
|
||||
. "GohCMS2/domain/article"
|
||||
"GohCMS2/adapters/secondary/gateways"
|
||||
"GohCMS2/domain/article"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type ListArticlesUseCase struct {
|
||||
articleRepository ArticleRepository
|
||||
articleRepository gateways.ArticleRepository
|
||||
}
|
||||
|
||||
func NewListArticlesUseCase(db *gorm.DB) *ListArticlesUseCase {
|
||||
return &ListArticlesUseCase{
|
||||
articleRepository: *NewArticleRepository(db),
|
||||
articleRepository: *gateways.NewArticleRepository(db),
|
||||
}
|
||||
}
|
||||
|
||||
func (g *ListArticlesUseCase) ListArticles() []Article {
|
||||
func (g *ListArticlesUseCase) ListArticles() []article.Article {
|
||||
return g.articleRepository.GetAll()
|
||||
}
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
package useCases
|
||||
|
||||
import (
|
||||
. "GohCMS2/adapters/secondary/gateways"
|
||||
. "GohCMS2/domain/user"
|
||||
"GohCMS2/adapters/secondary/gateways"
|
||||
"GohCMS2/domain/user"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type ListUsersUseCase struct {
|
||||
userRepository UserRepository
|
||||
userRepository gateways.UserRepository
|
||||
}
|
||||
|
||||
func NewListUsersUseCase(db *gorm.DB) *ListUsersUseCase {
|
||||
return &ListUsersUseCase{
|
||||
userRepository: *NewUserRepository(db),
|
||||
userRepository: *gateways.NewUserRepository(db),
|
||||
}
|
||||
}
|
||||
|
||||
func (g *ListUsersUseCase) ListUsers() []User {
|
||||
func (g *ListUsersUseCase) ListUsers() []user.User {
|
||||
return g.userRepository.GetAll()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user