diff --git a/packages/applications/turbo-blog/src/build/model/third-party-publish/third-party-publish.repository.ts b/packages/applications/turbo-blog/src/build/model/third-party-publish/third-party-publish.repository.ts index 169eb650..c698bffd 100644 --- a/packages/applications/turbo-blog/src/build/model/third-party-publish/third-party-publish.repository.ts +++ b/packages/applications/turbo-blog/src/build/model/third-party-publish/third-party-publish.repository.ts @@ -1,5 +1,7 @@ +import type { Result } from "option-t/esm/PlainResult"; import type { FileIOInfrastructureInterface } from "../../infrastructure/file-io/file-io.interface"; import type { FilePathInfrastructureInterface } from "../../infrastructure/file-path/file-path.interface"; +import { parseThirdPartyPublishContentsListJson } from "./parse-third-party-publish-contents-list-json"; import type { ThirdPartyPublishContent } from "./third-party-publish.entity"; export class ThirdPartyPublishContentRepository { @@ -8,17 +10,22 @@ export class ThirdPartyPublishContentRepository { private filePathInfrastructure: FilePathInfrastructureInterface, ) {} - public async getThirdPartyPublishContents(): Promise { + public async getThirdPartyPublishContents(): Promise< + Result + > { const thirdPartyPublishContentsListPath = this.filePathInfrastructure.resolve( process.cwd(), "src/articles/third-pirty.json", ); - const thirdPartyPublichContentsList = JSON.parse( - await this.fileIOInfrastructure.readFile( - thirdPartyPublishContentsListPath, - ), - ); + const thirdPartyPublichContentsList = + parseThirdPartyPublishContentsListJson( + await this.fileIOInfrastructure.readFile( + thirdPartyPublishContentsListPath, + ), + ); + + return thirdPartyPublichContentsList; } }