@ -0,0 +1,9 @@
|
||||
import {Ingredient} from "../model/ingredient.model";
|
||||
|
||||
export var $INGREDIENTS : Ingredient[] = [
|
||||
{$id:1,$name:'Patate'},
|
||||
{$id:2,$name:'Gruyere'},
|
||||
{$id:3,$name:'Quenelle'},
|
||||
{$id:4,$name:'Faux-filet de Boeuf'},
|
||||
{$id:5,$name:'Concassé de tomates'}
|
||||
]
|
@ -0,0 +1,6 @@
|
||||
import {Link} from "../model/link.model";
|
||||
|
||||
export var LINKS :Link[] = [
|
||||
{$name:"Lien1",$link:"Lien1"},
|
||||
{$name:"Lien2",$link:'Lien2'}
|
||||
]
|
@ -0,0 +1,7 @@
|
||||
import {Recipe} from "../model/recipe.model";
|
||||
import {Unity} from "../model/unity";
|
||||
|
||||
export var $RECEPIES : Recipe[] = [
|
||||
{$id:1,$name:'Faux filets grillés et pommes sautées',$createdAt:new Date('2024-06-17'),$description:'Faites sautez les pommes de terres',$ingredients:[]},
|
||||
{$id:2,$name:'Quenelles gratinées à la sauce tomate',$createdAt:new Date('2024-06-16'),$description:'Faites gratiner',$ingredients:[{$quantity:5,$unit:Unity.serving,$ingredient:{$id:5,$name:'Concassé de tomates'}}]}
|
||||
]
|
@ -0,0 +1,5 @@
|
||||
|
||||
export interface Ingredient {
|
||||
$id : number,
|
||||
$name : string
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
export interface Link {
|
||||
$name : string,
|
||||
$link : string
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
import {Unite} from "./unity";
|
||||
import {Ingredient} from "./ingredient.model";
|
||||
|
||||
export interface QuantifiedIngredient {
|
||||
$quantity : number,
|
||||
$unit : Unite,
|
||||
$ingredient : Ingredient
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
import {QuantifiedIngredient} from "./quantified-ingredient.model";
|
||||
|
||||
export interface Recipe {
|
||||
$id : number,
|
||||
$name : string,
|
||||
$description: string,
|
||||
$createdAt : Date,
|
||||
$ingredients: QuantifiedIngredient[]
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
export enum Unity {
|
||||
'Kg' = 0,
|
||||
'g' = 1,
|
||||
'N/A' = 2,
|
||||
'tbsp' = 3,
|
||||
'tsp' = 4,
|
||||
'serving' = 5
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import {Ingredient} from "../model/ingredient.model";
|
||||
import {$INGREDIENTS} from "../data/ingredient.stub";
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class IngredientService {
|
||||
|
||||
constructor() { }
|
||||
|
||||
getAll() : Ingredient[] {
|
||||
return $INGREDIENTS;
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import {Link} from "../model/link.model";
|
||||
import {LINKS} from "../data/link.stub";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class LinkService {
|
||||
|
||||
constructor() { }
|
||||
|
||||
getLinks() : Link[]{
|
||||
return LINKS;
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import {Recipe} from "../model/recipe.model";
|
||||
import {$RECEPIES} from "../data/recipe.stub";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class RecipeService {
|
||||
|
||||
constructor() { }
|
||||
|
||||
getAll() : Recipe[]{
|
||||
return $RECEPIES;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { IngredientService } from '../../app/service/ingredient.service';
|
||||
|
||||
describe('IngredientService', () => {
|
||||
let service: IngredientService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(IngredientService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { LinkService } from '../../app/service/link.service';
|
||||
|
||||
describe('LinkService', () => {
|
||||
let service: LinkService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(LinkService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { RecipeService } from '../../app/service/recipe.service';
|
||||
|
||||
describe('RecetteService', () => {
|
||||
let service: RecipeService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(RecipeService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
Loading…
Reference in new issue