diff --git a/batch-service/cmd/article-company-crawler/usecase/batch_crawl_article_contents.go b/batch-service/cmd/article-company-crawler/usecase/batch_crawl_company_article_contents.go similarity index 100% rename from batch-service/cmd/article-company-crawler/usecase/batch_crawl_article_contents.go rename to batch-service/cmd/article-company-crawler/usecase/batch_crawl_company_article_contents.go diff --git a/batch-service/cmd/article-company-crawler/usecase/batch_crawl_company_article_contents_test.go b/batch-service/cmd/article-company-crawler/usecase/batch_crawl_company_article_contents_test.go new file mode 100644 index 00000000..771674c2 --- /dev/null +++ b/batch-service/cmd/article-company-crawler/usecase/batch_crawl_company_article_contents_test.go @@ -0,0 +1,11 @@ +package usecase + +import "testing" + +func Test_Usecase_BatchCrawlCompanyArticleContents(t *testing.T) { + // 1. feed , same platform 2, deletedAr 1, trend + // rss 1件、 2件 10件 + // 2. rss 0件 + // 2. feed 0 件 + t.Parallel() +} diff --git a/batch-service/cmd/article-company-crawler/usecase/package_test.go b/batch-service/cmd/article-company-crawler/usecase/package_test.go new file mode 100644 index 00000000..e7a66fbc --- /dev/null +++ b/batch-service/cmd/article-company-crawler/usecase/package_test.go @@ -0,0 +1,14 @@ +package usecase + +import ( + "os" + "testing" + + "github.com/YukiOnishi1129/techpicks/batch-service/testutil" +) + +func TestMain(m *testing.M) { + testutil.BeforeAllTest() + // This is a test runner + os.Exit(m.Run()) +} diff --git a/batch-service/cmd/article-site-and-summary-crawler/usecase/batch_crawl_article_contents.go b/batch-service/cmd/article-site-and-summary-crawler/usecase/batch_crawl_site_and_summary_article_contents.go similarity index 100% rename from batch-service/cmd/article-site-and-summary-crawler/usecase/batch_crawl_article_contents.go rename to batch-service/cmd/article-site-and-summary-crawler/usecase/batch_crawl_site_and_summary_article_contents.go diff --git a/batch-service/cmd/article-site-and-summary-crawler/usecase/batch_crawl_site_and_summary_article_contents_test.go b/batch-service/cmd/article-site-and-summary-crawler/usecase/batch_crawl_site_and_summary_article_contents_test.go new file mode 100644 index 00000000..771674c2 --- /dev/null +++ b/batch-service/cmd/article-site-and-summary-crawler/usecase/batch_crawl_site_and_summary_article_contents_test.go @@ -0,0 +1,11 @@ +package usecase + +import "testing" + +func Test_Usecase_BatchCrawlCompanyArticleContents(t *testing.T) { + // 1. feed , same platform 2, deletedAr 1, trend + // rss 1件、 2件 10件 + // 2. rss 0件 + // 2. feed 0 件 + t.Parallel() +} diff --git a/batch-service/cmd/article-site-and-summary-crawler/usecase/package_test.go b/batch-service/cmd/article-site-and-summary-crawler/usecase/package_test.go new file mode 100644 index 00000000..e7a66fbc --- /dev/null +++ b/batch-service/cmd/article-site-and-summary-crawler/usecase/package_test.go @@ -0,0 +1,14 @@ +package usecase + +import ( + "os" + "testing" + + "github.com/YukiOnishi1129/techpicks/batch-service/testutil" +) + +func TestMain(m *testing.M) { + testutil.BeforeAllTest() + // This is a test runner + os.Exit(m.Run()) +} diff --git a/batch-service/cmd/trend-article-crawler/usecase/batch_crawl_trend_article_contents_test.go b/batch-service/cmd/trend-article-crawler/usecase/batch_crawl_trend_article_contents_test.go new file mode 100644 index 00000000..eab9f476 --- /dev/null +++ b/batch-service/cmd/trend-article-crawler/usecase/batch_crawl_trend_article_contents_test.go @@ -0,0 +1,10 @@ +package usecase + +import "testing" + +func Test_Usecase_BatchCrawlTrendArticleContents(t *testing.T) { + // 1. feed , same platform 2, deletedAr 1, trend + // rss 1件、 2件 10件 + // 2. rss 0件 + // 2. feed 0 件 +} diff --git a/batch-service/cmd/trend-article-crawler/usecase/dev_community_article_crawler.go b/batch-service/cmd/trend-article-crawler/usecase/dev_community_article_crawler.go index d41b937d..928cb67f 100644 --- a/batch-service/cmd/trend-article-crawler/usecase/dev_community_article_crawler.go +++ b/batch-service/cmd/trend-article-crawler/usecase/dev_community_article_crawler.go @@ -44,6 +44,7 @@ func (u *Usecase) devCommunityArticleCrawler(ctx context.Context, feed *entity.F ArticleAuthorName: &d.User.UserName, ArticleTags: &d.Tags, ArticleOGPImageURL: d.CoverImage, + IsEng: feed.R.Platform.IsEng, }) if err != nil && res.IsRollback { log.Printf("【error rollback transaction】: %s", err) diff --git a/batch-service/cmd/trend-article-crawler/usecase/hashnode_article_crawler.go b/batch-service/cmd/trend-article-crawler/usecase/hashnode_article_crawler.go index 061cbd4a..418c651e 100644 --- a/batch-service/cmd/trend-article-crawler/usecase/hashnode_article_crawler.go +++ b/batch-service/cmd/trend-article-crawler/usecase/hashnode_article_crawler.go @@ -52,6 +52,7 @@ func (u *Usecase) hashnodeArticleCrawler(ctx context.Context, feed *entity.Feed) ArticleAuthorName: &d.Node.Author.Name, ArticleTags: &articleTags, ArticleOGPImageURL: d.Node.CoverImage.URL, + IsEng: feed.R.Platform.IsEng, }) if err != nil && res.IsRollback { log.Printf("【error rollback transaction】: %s", err) diff --git a/batch-service/cmd/trend-article-crawler/usecase/hatena_article_crawler.go b/batch-service/cmd/trend-article-crawler/usecase/hatena_article_crawler.go index 2191065a..f870a225 100644 --- a/batch-service/cmd/trend-article-crawler/usecase/hatena_article_crawler.go +++ b/batch-service/cmd/trend-article-crawler/usecase/hatena_article_crawler.go @@ -44,6 +44,7 @@ func (u *Usecase) hatenaArticleCrawler(ctx context.Context, feed *entity.Feed) e ArticleAuthorName: &r.AuthorName, ArticleTags: &r.Tags, ArticleOGPImageURL: r.ImageURL, + IsEng: feed.R.Platform.IsEng, }) if err != nil && res.IsRollback { log.Printf("【error rollback transaction】: %s", err) diff --git a/batch-service/cmd/trend-article-crawler/usecase/package_test.go b/batch-service/cmd/trend-article-crawler/usecase/package_test.go new file mode 100644 index 00000000..e7a66fbc --- /dev/null +++ b/batch-service/cmd/trend-article-crawler/usecase/package_test.go @@ -0,0 +1,14 @@ +package usecase + +import ( + "os" + "testing" + + "github.com/YukiOnishi1129/techpicks/batch-service/testutil" +) + +func TestMain(m *testing.M) { + testutil.BeforeAllTest() + // This is a test runner + os.Exit(m.Run()) +} diff --git a/batch-service/cmd/trend-article-crawler/usecase/qiita_article_crawler.go b/batch-service/cmd/trend-article-crawler/usecase/qiita_article_crawler.go index e64ef79e..0c09da65 100644 --- a/batch-service/cmd/trend-article-crawler/usecase/qiita_article_crawler.go +++ b/batch-service/cmd/trend-article-crawler/usecase/qiita_article_crawler.go @@ -58,6 +58,7 @@ func (u *Usecase) qiitaArticleCrawler(ctx context.Context, feed *entity.Feed) er ArticleAuthorName: &r.AuthorName, ArticleTags: &r.Tags, ArticleOGPImageURL: r.ImageURL, + IsEng: feed.R.Platform.IsEng, }) if err != nil && res.IsRollback { log.Printf("【error rollback transaction】: %s", err) diff --git a/batch-service/cmd/trend-article-crawler/usecase/zenn_article_crawler.go b/batch-service/cmd/trend-article-crawler/usecase/zenn_article_crawler.go index f80443f8..6dc8a800 100644 --- a/batch-service/cmd/trend-article-crawler/usecase/zenn_article_crawler.go +++ b/batch-service/cmd/trend-article-crawler/usecase/zenn_article_crawler.go @@ -52,6 +52,7 @@ func (u *Usecase) zennArticleCrawler(ctx context.Context, feed *entity.Feed) err ArticleAuthorName: nil, ArticleTags: nil, ArticleOGPImageURL: ogpImageURL, + IsEng: feed.R.Platform.IsEng, }) if err != nil && res.IsRollback { log.Printf("【error rollback transaction】: %s", err) diff --git a/batch-service/infrastructure/firestore/repository/rss_repository.go b/batch-service/infrastructure/firestore/repository/rss_repository.go deleted file mode 100644 index 0c2f97a6..00000000 --- a/batch-service/infrastructure/firestore/repository/rss_repository.go +++ /dev/null @@ -1,5 +0,0 @@ -package repository - -//type RssRepositoryInterface interface { -// GetRSS(url string) ([]RSS, error) -//} diff --git a/batch-service/infrastructure/firestore/repository/user_repository.go b/batch-service/infrastructure/firestore/repository/user_repository.go deleted file mode 100644 index 50a4378d..00000000 --- a/batch-service/infrastructure/firestore/repository/user_repository.go +++ /dev/null @@ -1 +0,0 @@ -package repository diff --git a/batch-service/internal/convert.go b/batch-service/internal/convert.go deleted file mode 100644 index 1b186e1c..00000000 --- a/batch-service/internal/convert.go +++ /dev/null @@ -1,10 +0,0 @@ -package internal - -import "time" - -var layout = "2006-01-02 15:04:05" - -func StringToTime(str string) time.Time { - t, _ := time.Parse(layout, str) - return t -}