mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-20 00:23:03 +00:00
feat: add core
This commit is contained in:
174
src/core/things/Dish.ts
Normal file
174
src/core/things/Dish.ts
Normal file
@@ -0,0 +1,174 @@
|
||||
/*
|
||||
* Copyright (C) 2018 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCThingInPlace} from '../base/ThingInPlace';
|
||||
import {
|
||||
SCAcademicPriceGroup,
|
||||
SCThingThatCanBeOffered,
|
||||
SCThingThatCanBeOfferedTranslatableProperties,
|
||||
} from '../base/ThingThatCanBeOffered';
|
||||
import {
|
||||
SCThingWithCategoriesSpecificValues,
|
||||
SCThingWithCategoriesTranslatableProperties,
|
||||
SCThingWithCategoriesWithoutReferences,
|
||||
} from '../base/ThingWithCategories';
|
||||
import {SCThingMeta} from '../Thing';
|
||||
import {SCTranslations} from '../types/i18n';
|
||||
|
||||
/**
|
||||
* Type of a dish
|
||||
*/
|
||||
export type SCDishType = 'dish';
|
||||
|
||||
/**
|
||||
* A dish without references
|
||||
*/
|
||||
export interface SCDishWithoutReferences
|
||||
extends SCThingWithCategoriesWithoutReferences<SCDishCategories,
|
||||
SCThingWithCategoriesSpecificValues>,
|
||||
SCThingThatCanBeOffered<SCAcademicPriceGroup> {
|
||||
/**
|
||||
* Additives of the dish
|
||||
*/
|
||||
additives?: string[];
|
||||
|
||||
/**
|
||||
* Category of the dish
|
||||
*/
|
||||
categories: SCDishCategories[];
|
||||
|
||||
/**
|
||||
* Characteristics of the dish
|
||||
*/
|
||||
characteristics?: string[];
|
||||
|
||||
/**
|
||||
* Nutrition information (calories and nutrients with amounts)
|
||||
*/
|
||||
nutrition?: SCNutritionInformation;
|
||||
|
||||
/**
|
||||
* Translated fields of a dish
|
||||
*/
|
||||
translations?: SCTranslations<SCDishTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of a dish
|
||||
*/
|
||||
type: SCDishType;
|
||||
}
|
||||
|
||||
/**
|
||||
* A dish
|
||||
*/
|
||||
export interface SCDish extends SCDishWithoutReferences, SCThingInPlace {
|
||||
/**
|
||||
* Dishes ("Beilagen") that are served with the dish (if only certain supplement dishes can be taken with a dish)
|
||||
*/
|
||||
dishAddOns?: SCDishWithoutReferences[];
|
||||
|
||||
/**
|
||||
* Translated fields of a dish
|
||||
*/
|
||||
translations?: SCTranslations<SCDishTranslatableProperties>;
|
||||
|
||||
/**
|
||||
* Type of a dish
|
||||
*/
|
||||
type: SCDishType;
|
||||
}
|
||||
|
||||
export interface SCDishTranslatableProperties
|
||||
extends SCThingWithCategoriesTranslatableProperties, SCThingThatCanBeOfferedTranslatableProperties {
|
||||
}
|
||||
|
||||
/**
|
||||
* Dish meta data
|
||||
*/
|
||||
export class SCDishMeta extends SCThingMeta {
|
||||
static fieldTranslations = {
|
||||
...SCThingMeta.fieldTranslations,
|
||||
de: {
|
||||
categories: 'Kategorien',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of categories for dishes
|
||||
*/
|
||||
export type SCDishCategories =
|
||||
'appetizer'
|
||||
| 'salad'
|
||||
| 'main dish'
|
||||
| 'dessert'
|
||||
| 'soup'
|
||||
| 'side dish';
|
||||
|
||||
/**
|
||||
* A list of categories for drinks
|
||||
*/
|
||||
export type SCDrinkCategories =
|
||||
'wine'
|
||||
| 'beer'
|
||||
| 'coffee'
|
||||
| 'tea'
|
||||
| 'milk drink'
|
||||
| 'juice'
|
||||
| 'short drink'
|
||||
| 'sparkling wine'
|
||||
| 'water'
|
||||
| 'soft drink';
|
||||
|
||||
/**
|
||||
* Type definition for SCNutritionInformation
|
||||
*
|
||||
* @see https://schema.org/NutritionInformation
|
||||
*/
|
||||
export interface SCNutritionInformation {
|
||||
/**
|
||||
* Number of calories contained (in kcal)
|
||||
*/
|
||||
calories?: number;
|
||||
|
||||
/**
|
||||
* Content of carbohydrates (in grams)
|
||||
*/
|
||||
carbohydrateContent?: number;
|
||||
|
||||
/**
|
||||
* Content of fat (in grams)
|
||||
*/
|
||||
fatContent?: number;
|
||||
|
||||
/**
|
||||
* Content of proteins (in grams)
|
||||
*/
|
||||
proteinContent?: number;
|
||||
|
||||
/**
|
||||
* Content of salt (in grams)
|
||||
*/
|
||||
saltContent?: number;
|
||||
|
||||
/**
|
||||
* Content of saturated fat (in grams)
|
||||
*/
|
||||
saturatedFatContent?: number;
|
||||
|
||||
/**
|
||||
* Content of sugar (in grams)
|
||||
*/
|
||||
sugarContent?: number;
|
||||
}
|
||||
Reference in New Issue
Block a user