Skip to content

Commit

Permalink
PortfolioControllerを作成
Browse files Browse the repository at this point in the history
  • Loading branch information
piny940 committed Sep 28, 2023
1 parent 7af0c13 commit f4c505a
Showing 1 changed file with 15 additions and 35 deletions.
50 changes: 15 additions & 35 deletions src/controllers/portfolio_controller.ts
Original file line number Diff line number Diff line change
@@ -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)
}
}

0 comments on commit f4c505a

Please sign in to comment.