mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2025-12-24 02:39:20 -05:00
311 lines
9.4 KiB
TypeScript
311 lines
9.4 KiB
TypeScript
/* tslint:disable */
|
|
/* eslint-disable */
|
|
/**
|
|
* Tandoor
|
|
* Tandoor API Docs
|
|
*
|
|
* The version of the OpenAPI document: 0.0.0
|
|
*
|
|
*
|
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
* https://openapi-generator.tech
|
|
* Do not edit the class manually.
|
|
*/
|
|
|
|
import { mapValues } from '../runtime';
|
|
import type { FoodInheritField } from './FoodInheritField';
|
|
import {
|
|
FoodInheritFieldFromJSON,
|
|
FoodInheritFieldFromJSONTyped,
|
|
FoodInheritFieldToJSON,
|
|
} from './FoodInheritField';
|
|
import type { FoodSimple } from './FoodSimple';
|
|
import {
|
|
FoodSimpleFromJSON,
|
|
FoodSimpleFromJSONTyped,
|
|
FoodSimpleToJSON,
|
|
} from './FoodSimple';
|
|
import type { Property } from './Property';
|
|
import {
|
|
PropertyFromJSON,
|
|
PropertyFromJSONTyped,
|
|
PropertyToJSON,
|
|
} from './Property';
|
|
import type { RecipeSimple } from './RecipeSimple';
|
|
import {
|
|
RecipeSimpleFromJSON,
|
|
RecipeSimpleFromJSONTyped,
|
|
RecipeSimpleToJSON,
|
|
} from './RecipeSimple';
|
|
import type { SupermarketCategory } from './SupermarketCategory';
|
|
import {
|
|
SupermarketCategoryFromJSON,
|
|
SupermarketCategoryFromJSONTyped,
|
|
SupermarketCategoryToJSON,
|
|
} from './SupermarketCategory';
|
|
import type { Unit } from './Unit';
|
|
import {
|
|
UnitFromJSON,
|
|
UnitFromJSONTyped,
|
|
UnitToJSON,
|
|
} from './Unit';
|
|
|
|
/**
|
|
* Moves `UniqueValidator`'s from the validation stage to the save stage.
|
|
* It solves the problem with nested validation for unique fields on update.
|
|
*
|
|
* If you want more details, you can read related issues and articles:
|
|
* https://github.com/beda-software/drf-writable-nested/issues/1
|
|
* http://www.django-rest-framework.org/api-guide/validators/#updating-nested-serializers
|
|
*
|
|
* Example of usage:
|
|
* ```
|
|
* class Child(models.Model):
|
|
* field = models.CharField(unique=True)
|
|
*
|
|
*
|
|
* class Parent(models.Model):
|
|
* child = models.ForeignKey('Child')
|
|
*
|
|
*
|
|
* class ChildSerializer(UniqueFieldsMixin, serializers.ModelSerializer):
|
|
* class Meta:
|
|
* model = Child
|
|
*
|
|
*
|
|
* class ParentSerializer(NestedUpdateMixin, serializers.ModelSerializer):
|
|
* child = ChildSerializer()
|
|
*
|
|
* class Meta:
|
|
* model = Parent
|
|
* ```
|
|
*
|
|
* Note: `UniqueFieldsMixin` must be applied only on the serializer
|
|
* which has unique fields.
|
|
*
|
|
* Note: When you are using both mixins
|
|
* (`UniqueFieldsMixin` and `NestedCreateMixin` or `NestedUpdateMixin`)
|
|
* you should put `UniqueFieldsMixin` ahead.
|
|
* @export
|
|
* @interface PatchedFood
|
|
*/
|
|
export interface PatchedFood {
|
|
/**
|
|
*
|
|
* @type {number}
|
|
* @memberof PatchedFood
|
|
*/
|
|
readonly id?: number;
|
|
/**
|
|
*
|
|
* @type {string}
|
|
* @memberof PatchedFood
|
|
*/
|
|
name?: string;
|
|
/**
|
|
*
|
|
* @type {string}
|
|
* @memberof PatchedFood
|
|
*/
|
|
pluralName?: string;
|
|
/**
|
|
*
|
|
* @type {string}
|
|
* @memberof PatchedFood
|
|
*/
|
|
description?: string;
|
|
/**
|
|
*
|
|
* @type {string}
|
|
* @memberof PatchedFood
|
|
*/
|
|
readonly shopping?: string;
|
|
/**
|
|
*
|
|
* @type {RecipeSimple}
|
|
* @memberof PatchedFood
|
|
*/
|
|
recipe?: RecipeSimple;
|
|
/**
|
|
*
|
|
* @type {string}
|
|
* @memberof PatchedFood
|
|
*/
|
|
url?: string;
|
|
/**
|
|
*
|
|
* @type {Array<Property>}
|
|
* @memberof PatchedFood
|
|
*/
|
|
properties?: Array<Property>;
|
|
/**
|
|
*
|
|
* @type {number}
|
|
* @memberof PatchedFood
|
|
*/
|
|
propertiesFoodAmount?: number;
|
|
/**
|
|
*
|
|
* @type {Unit}
|
|
* @memberof PatchedFood
|
|
*/
|
|
propertiesFoodUnit?: Unit;
|
|
/**
|
|
*
|
|
* @type {number}
|
|
* @memberof PatchedFood
|
|
*/
|
|
fdcId?: number;
|
|
/**
|
|
*
|
|
* @type {boolean}
|
|
* @memberof PatchedFood
|
|
*/
|
|
foodOnhand?: boolean;
|
|
/**
|
|
*
|
|
* @type {SupermarketCategory}
|
|
* @memberof PatchedFood
|
|
*/
|
|
supermarketCategory?: SupermarketCategory;
|
|
/**
|
|
*
|
|
* @type {number}
|
|
* @memberof PatchedFood
|
|
*/
|
|
readonly parent?: number;
|
|
/**
|
|
*
|
|
* @type {number}
|
|
* @memberof PatchedFood
|
|
*/
|
|
readonly numchild?: number;
|
|
/**
|
|
*
|
|
* @type {Array<FoodInheritField>}
|
|
* @memberof PatchedFood
|
|
*/
|
|
inheritFields?: Array<FoodInheritField>;
|
|
/**
|
|
* Returns a string representation of a tree node and it's ancestors,
|
|
* e.g. 'Cuisine > Asian > Chinese > Catonese'.
|
|
* @type {string}
|
|
* @memberof PatchedFood
|
|
*/
|
|
readonly fullName?: string;
|
|
/**
|
|
*
|
|
* @type {boolean}
|
|
* @memberof PatchedFood
|
|
*/
|
|
ignoreShopping?: boolean;
|
|
/**
|
|
*
|
|
* @type {Array<FoodSimple>}
|
|
* @memberof PatchedFood
|
|
*/
|
|
substitute?: Array<FoodSimple>;
|
|
/**
|
|
*
|
|
* @type {boolean}
|
|
* @memberof PatchedFood
|
|
*/
|
|
substituteSiblings?: boolean;
|
|
/**
|
|
*
|
|
* @type {boolean}
|
|
* @memberof PatchedFood
|
|
*/
|
|
substituteChildren?: boolean;
|
|
/**
|
|
*
|
|
* @type {boolean}
|
|
* @memberof PatchedFood
|
|
*/
|
|
readonly substituteOnhand?: boolean;
|
|
/**
|
|
*
|
|
* @type {Array<FoodInheritField>}
|
|
* @memberof PatchedFood
|
|
*/
|
|
childInheritFields?: Array<FoodInheritField>;
|
|
/**
|
|
*
|
|
* @type {string}
|
|
* @memberof PatchedFood
|
|
*/
|
|
openDataSlug?: string;
|
|
}
|
|
|
|
/**
|
|
* Check if a given object implements the PatchedFood interface.
|
|
*/
|
|
export function instanceOfPatchedFood(value: object): boolean {
|
|
return true;
|
|
}
|
|
|
|
export function PatchedFoodFromJSON(json: any): PatchedFood {
|
|
return PatchedFoodFromJSONTyped(json, false);
|
|
}
|
|
|
|
export function PatchedFoodFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedFood {
|
|
if (json == null) {
|
|
return json;
|
|
}
|
|
return {
|
|
|
|
'id': json['id'] == null ? undefined : json['id'],
|
|
'name': json['name'] == null ? undefined : json['name'],
|
|
'pluralName': json['plural_name'] == null ? undefined : json['plural_name'],
|
|
'description': json['description'] == null ? undefined : json['description'],
|
|
'shopping': json['shopping'] == null ? undefined : json['shopping'],
|
|
'recipe': json['recipe'] == null ? undefined : RecipeSimpleFromJSON(json['recipe']),
|
|
'url': json['url'] == null ? undefined : json['url'],
|
|
'properties': json['properties'] == null ? undefined : ((json['properties'] as Array<any>).map(PropertyFromJSON)),
|
|
'propertiesFoodAmount': json['properties_food_amount'] == null ? undefined : json['properties_food_amount'],
|
|
'propertiesFoodUnit': json['properties_food_unit'] == null ? undefined : UnitFromJSON(json['properties_food_unit']),
|
|
'fdcId': json['fdc_id'] == null ? undefined : json['fdc_id'],
|
|
'foodOnhand': json['food_onhand'] == null ? undefined : json['food_onhand'],
|
|
'supermarketCategory': json['supermarket_category'] == null ? undefined : SupermarketCategoryFromJSON(json['supermarket_category']),
|
|
'parent': json['parent'] == null ? undefined : json['parent'],
|
|
'numchild': json['numchild'] == null ? undefined : json['numchild'],
|
|
'inheritFields': json['inherit_fields'] == null ? undefined : ((json['inherit_fields'] as Array<any>).map(FoodInheritFieldFromJSON)),
|
|
'fullName': json['full_name'] == null ? undefined : json['full_name'],
|
|
'ignoreShopping': json['ignore_shopping'] == null ? undefined : json['ignore_shopping'],
|
|
'substitute': json['substitute'] == null ? undefined : ((json['substitute'] as Array<any>).map(FoodSimpleFromJSON)),
|
|
'substituteSiblings': json['substitute_siblings'] == null ? undefined : json['substitute_siblings'],
|
|
'substituteChildren': json['substitute_children'] == null ? undefined : json['substitute_children'],
|
|
'substituteOnhand': json['substitute_onhand'] == null ? undefined : json['substitute_onhand'],
|
|
'childInheritFields': json['child_inherit_fields'] == null ? undefined : ((json['child_inherit_fields'] as Array<any>).map(FoodInheritFieldFromJSON)),
|
|
'openDataSlug': json['open_data_slug'] == null ? undefined : json['open_data_slug'],
|
|
};
|
|
}
|
|
|
|
export function PatchedFoodToJSON(value?: Omit<PatchedFood, 'id'|'shopping'|'parent'|'numchild'|'full_name'|'substitute_onhand'> | null): any {
|
|
if (value == null) {
|
|
return value;
|
|
}
|
|
return {
|
|
|
|
'name': value['name'],
|
|
'plural_name': value['pluralName'],
|
|
'description': value['description'],
|
|
'recipe': RecipeSimpleToJSON(value['recipe']),
|
|
'url': value['url'],
|
|
'properties': value['properties'] == null ? undefined : ((value['properties'] as Array<any>).map(PropertyToJSON)),
|
|
'properties_food_amount': value['propertiesFoodAmount'],
|
|
'properties_food_unit': UnitToJSON(value['propertiesFoodUnit']),
|
|
'fdc_id': value['fdcId'],
|
|
'food_onhand': value['foodOnhand'],
|
|
'supermarket_category': SupermarketCategoryToJSON(value['supermarketCategory']),
|
|
'inherit_fields': value['inheritFields'] == null ? undefined : ((value['inheritFields'] as Array<any>).map(FoodInheritFieldToJSON)),
|
|
'ignore_shopping': value['ignoreShopping'],
|
|
'substitute': value['substitute'] == null ? undefined : ((value['substitute'] as Array<any>).map(FoodSimpleToJSON)),
|
|
'substitute_siblings': value['substituteSiblings'],
|
|
'substitute_children': value['substituteChildren'],
|
|
'child_inherit_fields': value['childInheritFields'] == null ? undefined : ((value['childInheritFields'] as Array<any>).map(FoodInheritFieldToJSON)),
|
|
'open_data_slug': value['openDataSlug'],
|
|
};
|
|
}
|
|
|