From f4c505abdc019605789de1d2a03a62b07c9391a8 Mon Sep 17 00:00:00 2001 From: piny940 Date: Thu, 28 Sep 2023 10:07:15 +0900 Subject: [PATCH] =?UTF-8?q?PortfolioController=E3=82=92=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/portfolio_controller.ts | 50 ++++++++----------------- 1 file changed, 15 insertions(+), 35 deletions(-) diff --git a/src/controllers/portfolio_controller.ts b/src/controllers/portfolio_controller.ts index e781a04d..673f64fd 100644 --- a/src/controllers/portfolio_controller.ts +++ b/src/controllers/portfolio_controller.ts @@ -1,39 +1,19 @@ -import { YamlLoader } from '@/loader/_common' -import { ProfileLoader } from '@/loader/profile' -import { ProjectsLoader } from '@/loader/projects' -import { TechStacksLoader } from '@/loader/tech_stacks' -import { TechnologiesLoader } from '@/loader/technologies' -import { ProfileData } from '@/models/profile' -import { ProjectsData } from '@/models/project' -import { TechStacksData } from '@/models/tech_stack' -import { TechnologiesData } from '@/models/technology' +import { Profile } from '@/models/profile' +import { Projects } from '@/models/project' +import { TechStacks } from '@/models/tech_stack' +import { Technologies } from '@/models/technology' +import { PortfolioData } from './data_controller' -export interface PortfolioData { - profileData: ProfileData - projectsData: ProjectsData - technologiesData: TechnologiesData - techStacksData: TechStacksData -} - -class PortfolioController { - #data - - getPortfolioData = () => { - return this.#load() - } - - #load = (): PortfolioData => { - const yamlLoader = new YamlLoader() - const projectsData = new ProjectsLoader(yamlLoader).load() - const profileData = new ProfileLoader(yamlLoader).load() - const technologiesData = new TechnologiesLoader(yamlLoader).load() - const techStacksData = new TechStacksLoader(yamlLoader).load() +export class PortfolioController { + #profile: Profile + #projects: Projects + #technologies: Technologies + #techStacks: TechStacks - return { - projectsData, - profileData, - technologiesData, - techStacksData, - } + constructor(data: PortfolioData) { + this.#profile = new Profile(data.profileData) + this.#projects = new Projects(data.projectsData) + this.#technologies = new Technologies(data.technologiesData) + this.#techStacks = new TechStacks(data.techStacksData) } }