Added nutritional values, with backend loading function.
This commit is contained in:
1 parent
917f3dc640
commit
627564e8c6
10 files changed
+294
-3
No files matched your search
@@ -0,0 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -1,6 +1,7 @@
|
||||
import type {Variant} from "~/types/variant";
|
||||
import type {Origin} from "~/types/origin";
|
||||
import type {Unit} from "~/types/unit";
|
||||
import type {Nutritional} from "~/types/nutritional.ts";
|
||||
|
||||
export class Article {
|
||||
readonly id: number;
|
||||
@@ -17,11 +18,13 @@ export class Article {
|
||||
bio_info: string | null;
|
||||
topm_id: string | null;
|
||||
additional_name: string | null;
|
||||
nutritional: Nutritional | null;
|
||||
|
||||
constructor(id: number, name: string, bio: boolean, origin: Origin, description: string | null,
|
||||
ingredients: string | null, default_unit: Unit, variants: Array<Variant> | null,
|
||||
mhd: string | null, bio_origin: string | null, allergens_text: string | null,
|
||||
bio_info: string | null, topm_id: string | null, additional_name: string | null) {
|
||||
bio_info: string | null, topm_id: string | null, additional_name: string | null,
|
||||
nutritional: Nutritional | null) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.bio = bio;
|
||||
@@ -42,5 +45,6 @@ export class Article {
|
||||
this.bio_info = bio_info;
|
||||
this.topm_id = topm_id;
|
||||
this.additional_name = additional_name;
|
||||
this.nutritional = nutritional;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
export class Nutritional {
|
||||
id: number;
|
||||
calorific_value_kj: number;
|
||||
calorific_value_kcal: number;
|
||||
fat: number;
|
||||
saturated_fat: number;
|
||||
carbohydrates: number;
|
||||
sugar: number;
|
||||
fibers: number;
|
||||
protein: number;
|
||||
salt: number;
|
||||
|
||||
constructor(id: number, calorific_value_kj: number, calorific_value_kcal: number, fat: number,
|
||||
saturated_fat: number, carbohydrates: number, sugar: number,
|
||||
fibers: number, protein: number, salt: number) {
|
||||
this.id = id;
|
||||
this.calorific_value_kj = calorific_value_kj;
|
||||
this.calorific_value_kcal = calorific_value_kcal;
|
||||
this.fat = fat;
|
||||
this.saturated_fat = saturated_fat;
|
||||
this.carbohydrates = carbohydrates;
|
||||
this.sugar = sugar;
|
||||
this.fibers = fibers;
|
||||
this.protein = protein;
|
||||
this.salt = salt;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import type {Unit} from "~/types/unit";
|
||||
import type {Label} from "~/types/label";
|
||||
import type {Nutritional} from "~/types/nutritional.ts";
|
||||
|
||||
export class Variant {
|
||||
readonly id: number;
|
||||
@@ -12,10 +13,12 @@ export class Variant {
|
||||
label: Label | null;
|
||||
variant_description: string | null;
|
||||
topm_row: string | null;
|
||||
nutritional: Nutritional | null;
|
||||
|
||||
constructor(id: number, weight: string, ean: string|null, name: string|null,
|
||||
description:string|null, ingredients: string|null, unit: Unit,
|
||||
label: Label | null, variant_description: string | null, topm_row: string | null) {
|
||||
label: Label | null, variant_description: string | null, topm_row: string | null,
|
||||
nutritional: Nutritional | null) {
|
||||
this.id = id;
|
||||
this.weight = weight;
|
||||
this.ean = ean;
|
||||
@@ -26,5 +29,6 @@ export class Variant {
|
||||
this.label = label;
|
||||
this.variant_description = variant_description;
|
||||
this.topm_row = topm_row;
|
||||
this.nutritional = nutritional;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user