This repository has been archived by the owner on Nov 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #71 from yoshihiro-shu/update/api/get-articles
add: get articles by tag
- Loading branch information
Showing
18 changed files
with
273 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package usecase | ||
|
||
import ( | ||
"github.com/yoshihiro-shu/draft-backend/backend/domain/model" | ||
"github.com/yoshihiro-shu/draft-backend/backend/domain/repository" | ||
) | ||
|
||
type ArticlesUseCase interface { | ||
GetArticlesByCategory(articles *[]model.Article, slug string) error | ||
GetArticlesByTag(articles *[]model.Article, slug string) error | ||
} | ||
|
||
type articlesUseCase struct { | ||
articleRepo repository.ArticleRepository | ||
} | ||
|
||
func NewArticlesUseCase(articleRepo repository.ArticleRepository) ArticlesUseCase { | ||
return &articlesUseCase{articleRepo: articleRepo} | ||
} | ||
|
||
func (au *articlesUseCase) GetArticlesByCategory(articles *[]model.Article, slug string) error { | ||
return au.articleRepo.GetArticlesByCategory(articles, slug) | ||
} | ||
|
||
func (au *articlesUseCase) GetArticlesByTag(articles *[]model.Article, slug string) error { | ||
return au.articleRepo.GetArticlesByTag(articles, slug) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use std::collections::HashMap; | ||
|
||
pub fn create_map() -> HashMap<&'static str, &'static str> { | ||
let mut tag_category: HashMap<&str, &str> = HashMap::new(); | ||
|
||
tag_category.insert("インフラ", "Infrastructure"); | ||
tag_category.insert("アジャイル", "Agile"); | ||
tag_category.insert("ビジネス", "Bussiness"); | ||
tag_category.insert("マーケティング", "Marketing"); | ||
tag_category.insert("kubernetes", "Infrastructure"); | ||
tag_category.insert("Docker", "Infrastructure"); | ||
tag_category.insert("要件定義", "System Design"); | ||
tag_category.insert("ワイヤーフレーム", "System Design"); | ||
tag_category.insert("googlecloud", "Infrastructure"); | ||
tag_category.insert("Nuxt", "Frontend"); | ||
|
||
tag_category | ||
} |
Oops, something went wrong.