-
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.
Implement the usecase to get blogpost with m17n
- Loading branch information
1 parent
c97e4f5
commit 19e9d50
Showing
3 changed files
with
24 additions
and
4 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
packages/applications/turbo-blog/src/build/application/getBlogPost/getBlogPost.usecase.ts
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,16 @@ | ||
import type { BlogContent } from "../../model/blog/blog.entity"; | ||
import type { BlogRepository } from "../../model/blog/blog.repository"; | ||
import { M17NContents } from "../../model/m17n/m17n.entity"; | ||
|
||
export class GetBlogPostUsecase { | ||
constructor(private blogPostRepository: BlogRepository) {} | ||
|
||
async getBlogPost(id: string): Promise<M17NContents<BlogContent>> { | ||
const [ja, en] = await Promise.all([ | ||
this.blogPostRepository.getBlog(id, "ja"), | ||
this.blogPostRepository.getBlog(id, "en"), | ||
]); | ||
|
||
return new M17NContents(ja, en); | ||
} | ||
} |
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