From 5fc0371f5fc0215f48b9f27ac216a359da6997e9 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 25 Nov 2019 10:07:30 -0500 Subject: Added data models. --- recipeBuddy/src/app/DataModels/ingredients.spec.ts | 7 +++ recipeBuddy/src/app/DataModels/ingredients.ts | 29 ++++++++++ recipeBuddy/src/app/DataModels/recipe.spec.ts | 7 +++ recipeBuddy/src/app/DataModels/recipe.ts | 62 ++++++++++++++++++++++ recipeBuddy/src/app/DataModels/steps.spec.ts | 7 +++ recipeBuddy/src/app/DataModels/steps.ts | 18 +++++++ 6 files changed, 130 insertions(+) create mode 100644 recipeBuddy/src/app/DataModels/ingredients.spec.ts create mode 100644 recipeBuddy/src/app/DataModels/ingredients.ts create mode 100644 recipeBuddy/src/app/DataModels/recipe.spec.ts create mode 100644 recipeBuddy/src/app/DataModels/recipe.ts create mode 100644 recipeBuddy/src/app/DataModels/steps.spec.ts create mode 100644 recipeBuddy/src/app/DataModels/steps.ts (limited to 'recipeBuddy/src/app/DataModels') diff --git a/recipeBuddy/src/app/DataModels/ingredients.spec.ts b/recipeBuddy/src/app/DataModels/ingredients.spec.ts new file mode 100644 index 0000000..17b5858 --- /dev/null +++ b/recipeBuddy/src/app/DataModels/ingredients.spec.ts @@ -0,0 +1,7 @@ +import { Ingredients } from './ingredients'; + +describe('Ingredients', () => { + it('should create an instance', () => { + expect(new Ingredients()).toBeTruthy(); + }); +}); diff --git a/recipeBuddy/src/app/DataModels/ingredients.ts b/recipeBuddy/src/app/DataModels/ingredients.ts new file mode 100644 index 0000000..6f96e69 --- /dev/null +++ b/recipeBuddy/src/app/DataModels/ingredients.ts @@ -0,0 +1,29 @@ +export class Ingredients { + private names: string[]; + private amounts: number[]; + private units: string[]; + private types: string[]; + + public constructor(names: string[], amounts: number[], units: string[], types: string[]) { + this.names = names; + this.amounts = amounts; + this.units = units; + this.types = types; + } + + public getNames(): string[] { + return this.names; + } + + public getAmounts(): number[] { + return this.amounts; + } + + public getUnits(): string[] { + return this.units; + } + + public getTypes(): string[] { + return this.types; + } +} diff --git a/recipeBuddy/src/app/DataModels/recipe.spec.ts b/recipeBuddy/src/app/DataModels/recipe.spec.ts new file mode 100644 index 0000000..af34608 --- /dev/null +++ b/recipeBuddy/src/app/DataModels/recipe.spec.ts @@ -0,0 +1,7 @@ +import { Recipe } from './recipe'; + +describe('Recipe', () => { + it('should create an instance', () => { + expect(new Recipe()).toBeTruthy(); + }); +}); diff --git a/recipeBuddy/src/app/DataModels/recipe.ts b/recipeBuddy/src/app/DataModels/recipe.ts new file mode 100644 index 0000000..82e4a73 --- /dev/null +++ b/recipeBuddy/src/app/DataModels/recipe.ts @@ -0,0 +1,62 @@ +import {Steps} from "./steps" +import {Ingredients} from "./ingredients" + +export class Recipe { + private id: number; + private name: string; + private description: string; + private ingredients: Ingredients; + private steps: Steps; + private servingSize: number; + private cookTime: number; + private rating: number; + private tags: string[]; + + public constructor(id: number, name: string, description: string, ingredients: Ingredients, steps: Steps, servingSize: number, cookTime: number, rating: number, tags: string[]) { + this.id = id; + this.name = name; + this.description = description; + this.ingredients = ingredients; + this.steps = steps; + this.servingSize = servingSize; + this.cookTime = cookTime; + this.rating = rating; + this.tags = tags; + } + + public getId(): number { + return this.id; + } + + public getName(): string { + return this.name; + } + + public getDescription(): string { + return this.description; + } + + public getIngredients(): Ingredients { + return this.ingredients; + } + + public getSteps(): Steps { + return this.steps; + } + + public getServingSize(): number { + return this.servingSize; + } + + public getCookTime(): number { + return this.cookTime; + } + + public getRating(): number { + return this.rating; + } + + public getTags(): string[] { + return this.tags; + } +} diff --git a/recipeBuddy/src/app/DataModels/steps.spec.ts b/recipeBuddy/src/app/DataModels/steps.spec.ts new file mode 100644 index 0000000..e315565 --- /dev/null +++ b/recipeBuddy/src/app/DataModels/steps.spec.ts @@ -0,0 +1,7 @@ +import { Steps } from './steps'; + +describe('Steps', () => { + it('should create an instance', () => { + expect(new Steps()).toBeTruthy(); + }); +}); diff --git a/recipeBuddy/src/app/DataModels/steps.ts b/recipeBuddy/src/app/DataModels/steps.ts new file mode 100644 index 0000000..9061dc2 --- /dev/null +++ b/recipeBuddy/src/app/DataModels/steps.ts @@ -0,0 +1,18 @@ +export class Steps { + private instructions: string[]; + private timers: number[]; + + public contructor(instructions: string[], timers: number[]) { + this.instructions = instructions; + this.timers = timers; + } + + public getInstructions(): string[] { + return this.instructions; + } + + public getTimers(): number[] { + return this.timers; + } + +} -- cgit v1.1