working search with flat endpoint

This commit is contained in:
vabene1111
2024-02-29 20:08:37 +01:00
committed by smilerz
parent 4a8ad3db1e
commit 17f875863c
143 changed files with 18624 additions and 9992 deletions

View File

@@ -1,10 +1,10 @@
/* tslint:disable */
/* eslint-disable */
/**
* Django Recipes
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document:
* The version of the OpenAPI document: 0.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -13,45 +13,79 @@
*/
import { exists, mapValues } from '../runtime';
import type { FoodInheritFieldsInner } from './FoodInheritFieldsInner';
import type { FoodInheritField } from './FoodInheritField';
import {
FoodInheritFieldsInnerFromJSON,
FoodInheritFieldsInnerFromJSONTyped,
FoodInheritFieldsInnerToJSON,
} from './FoodInheritFieldsInner';
import type { FoodPropertiesFoodUnit } from './FoodPropertiesFoodUnit';
FoodInheritFieldFromJSON,
FoodInheritFieldFromJSONTyped,
FoodInheritFieldToJSON,
} from './FoodInheritField';
import type { FoodSimple } from './FoodSimple';
import {
FoodPropertiesFoodUnitFromJSON,
FoodPropertiesFoodUnitFromJSONTyped,
FoodPropertiesFoodUnitToJSON,
} from './FoodPropertiesFoodUnit';
import type { FoodPropertiesInner } from './FoodPropertiesInner';
FoodSimpleFromJSON,
FoodSimpleFromJSONTyped,
FoodSimpleToJSON,
} from './FoodSimple';
import type { Property } from './Property';
import {
FoodPropertiesInnerFromJSON,
FoodPropertiesInnerFromJSONTyped,
FoodPropertiesInnerToJSON,
} from './FoodPropertiesInner';
import type { FoodRecipe } from './FoodRecipe';
PropertyFromJSON,
PropertyFromJSONTyped,
PropertyToJSON,
} from './Property';
import type { RecipeSimple } from './RecipeSimple';
import {
FoodRecipeFromJSON,
FoodRecipeFromJSONTyped,
FoodRecipeToJSON,
} from './FoodRecipe';
import type { FoodSubstituteInner } from './FoodSubstituteInner';
RecipeSimpleFromJSON,
RecipeSimpleFromJSONTyped,
RecipeSimpleToJSON,
} from './RecipeSimple';
import type { SupermarketCategory } from './SupermarketCategory';
import {
FoodSubstituteInnerFromJSON,
FoodSubstituteInnerFromJSONTyped,
FoodSubstituteInnerToJSON,
} from './FoodSubstituteInner';
import type { FoodSupermarketCategory } from './FoodSupermarketCategory';
SupermarketCategoryFromJSON,
SupermarketCategoryFromJSONTyped,
SupermarketCategoryToJSON,
} from './SupermarketCategory';
import type { Unit } from './Unit';
import {
FoodSupermarketCategoryFromJSON,
FoodSupermarketCategoryFromJSONTyped,
FoodSupermarketCategoryToJSON,
} from './FoodSupermarketCategory';
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 Food
*/
@@ -61,7 +95,7 @@ export interface Food {
* @type {number}
* @memberof Food
*/
readonly id?: number;
readonly id: number;
/**
*
* @type {string}
@@ -85,13 +119,13 @@ export interface Food {
* @type {string}
* @memberof Food
*/
readonly shopping?: string;
readonly shopping: string;
/**
*
* @type {FoodRecipe}
* @type {RecipeSimple}
* @memberof Food
*/
recipe?: FoodRecipe | null;
recipe?: RecipeSimple | null;
/**
*
* @type {string}
@@ -100,10 +134,10 @@ export interface Food {
url?: string | null;
/**
*
* @type {Array<FoodPropertiesInner>}
* @type {Array<Property>}
* @memberof Food
*/
properties?: Array<FoodPropertiesInner> | null;
properties?: Array<Property> | null;
/**
*
* @type {string}
@@ -112,10 +146,10 @@ export interface Food {
propertiesFoodAmount?: string;
/**
*
* @type {FoodPropertiesFoodUnit}
* @type {Unit}
* @memberof Food
*/
propertiesFoodUnit?: FoodPropertiesFoodUnit | null;
propertiesFoodUnit?: Unit | null;
/**
*
* @type {number}
@@ -130,34 +164,34 @@ export interface Food {
foodOnhand?: string | null;
/**
*
* @type {FoodSupermarketCategory}
* @type {SupermarketCategory}
* @memberof Food
*/
supermarketCategory?: FoodSupermarketCategory | null;
supermarketCategory?: SupermarketCategory | null;
/**
*
* @type {string}
* @memberof Food
*/
readonly parent?: string;
readonly parent: string;
/**
*
* @type {number}
* @memberof Food
*/
readonly numchild?: number;
readonly numchild: number;
/**
*
* @type {Array<FoodInheritFieldsInner>}
* @type {Array<FoodInheritField>}
* @memberof Food
*/
inheritFields?: Array<FoodInheritFieldsInner> | null;
inheritFields?: Array<FoodInheritField> | null;
/**
*
* @type {string}
* @memberof Food
*/
readonly fullName?: string;
readonly fullName: string;
/**
*
* @type {boolean}
@@ -166,10 +200,10 @@ export interface Food {
ignoreShopping?: boolean;
/**
*
* @type {Array<FoodSubstituteInner>}
* @type {Array<FoodSimple>}
* @memberof Food
*/
substitute?: Array<FoodSubstituteInner> | null;
substitute?: Array<FoodSimple> | null;
/**
*
* @type {boolean}
@@ -187,13 +221,13 @@ export interface Food {
* @type {string}
* @memberof Food
*/
readonly substituteOnhand?: string;
readonly substituteOnhand: string;
/**
*
* @type {Array<FoodInheritFieldsInner>}
* @type {Array<FoodInheritField>}
* @memberof Food
*/
childInheritFields?: Array<FoodInheritFieldsInner> | null;
childInheritFields?: Array<FoodInheritField> | null;
/**
*
* @type {string}
@@ -207,7 +241,13 @@ export interface Food {
*/
export function instanceOfFood(value: object): boolean {
let isInstance = true;
isInstance = isInstance && "id" in value;
isInstance = isInstance && "name" in value;
isInstance = isInstance && "shopping" in value;
isInstance = isInstance && "parent" in value;
isInstance = isInstance && "numchild" in value;
isInstance = isInstance && "fullName" in value;
isInstance = isInstance && "substituteOnhand" in value;
return isInstance;
}
@@ -222,29 +262,29 @@ export function FoodFromJSONTyped(json: any, ignoreDiscriminator: boolean): Food
}
return {
'id': !exists(json, 'id') ? undefined : json['id'],
'id': json['id'],
'name': json['name'],
'pluralName': !exists(json, 'plural_name') ? undefined : json['plural_name'],
'description': !exists(json, 'description') ? undefined : json['description'],
'shopping': !exists(json, 'shopping') ? undefined : json['shopping'],
'recipe': !exists(json, 'recipe') ? undefined : FoodRecipeFromJSON(json['recipe']),
'shopping': json['shopping'],
'recipe': !exists(json, 'recipe') ? undefined : RecipeSimpleFromJSON(json['recipe']),
'url': !exists(json, 'url') ? undefined : json['url'],
'properties': !exists(json, 'properties') ? undefined : (json['properties'] === null ? null : (json['properties'] as Array<any>).map(FoodPropertiesInnerFromJSON)),
'properties': !exists(json, 'properties') ? undefined : (json['properties'] === null ? null : (json['properties'] as Array<any>).map(PropertyFromJSON)),
'propertiesFoodAmount': !exists(json, 'properties_food_amount') ? undefined : json['properties_food_amount'],
'propertiesFoodUnit': !exists(json, 'properties_food_unit') ? undefined : FoodPropertiesFoodUnitFromJSON(json['properties_food_unit']),
'propertiesFoodUnit': !exists(json, 'properties_food_unit') ? undefined : UnitFromJSON(json['properties_food_unit']),
'fdcId': !exists(json, 'fdc_id') ? undefined : json['fdc_id'],
'foodOnhand': !exists(json, 'food_onhand') ? undefined : json['food_onhand'],
'supermarketCategory': !exists(json, 'supermarket_category') ? undefined : FoodSupermarketCategoryFromJSON(json['supermarket_category']),
'parent': !exists(json, 'parent') ? undefined : json['parent'],
'numchild': !exists(json, 'numchild') ? undefined : json['numchild'],
'inheritFields': !exists(json, 'inherit_fields') ? undefined : (json['inherit_fields'] === null ? null : (json['inherit_fields'] as Array<any>).map(FoodInheritFieldsInnerFromJSON)),
'fullName': !exists(json, 'full_name') ? undefined : json['full_name'],
'supermarketCategory': !exists(json, 'supermarket_category') ? undefined : SupermarketCategoryFromJSON(json['supermarket_category']),
'parent': json['parent'],
'numchild': json['numchild'],
'inheritFields': !exists(json, 'inherit_fields') ? undefined : (json['inherit_fields'] === null ? null : (json['inherit_fields'] as Array<any>).map(FoodInheritFieldFromJSON)),
'fullName': json['full_name'],
'ignoreShopping': !exists(json, 'ignore_shopping') ? undefined : json['ignore_shopping'],
'substitute': !exists(json, 'substitute') ? undefined : (json['substitute'] === null ? null : (json['substitute'] as Array<any>).map(FoodSubstituteInnerFromJSON)),
'substitute': !exists(json, 'substitute') ? undefined : (json['substitute'] === null ? null : (json['substitute'] as Array<any>).map(FoodSimpleFromJSON)),
'substituteSiblings': !exists(json, 'substitute_siblings') ? undefined : json['substitute_siblings'],
'substituteChildren': !exists(json, 'substitute_children') ? undefined : json['substitute_children'],
'substituteOnhand': !exists(json, 'substitute_onhand') ? undefined : json['substitute_onhand'],
'childInheritFields': !exists(json, 'child_inherit_fields') ? undefined : (json['child_inherit_fields'] === null ? null : (json['child_inherit_fields'] as Array<any>).map(FoodInheritFieldsInnerFromJSON)),
'substituteOnhand': json['substitute_onhand'],
'childInheritFields': !exists(json, 'child_inherit_fields') ? undefined : (json['child_inherit_fields'] === null ? null : (json['child_inherit_fields'] as Array<any>).map(FoodInheritFieldFromJSON)),
'openDataSlug': !exists(json, 'open_data_slug') ? undefined : json['open_data_slug'],
};
}
@@ -261,20 +301,20 @@ export function FoodToJSON(value?: Food | null): any {
'name': value.name,
'plural_name': value.pluralName,
'description': value.description,
'recipe': FoodRecipeToJSON(value.recipe),
'recipe': RecipeSimpleToJSON(value.recipe),
'url': value.url,
'properties': value.properties === undefined ? undefined : (value.properties === null ? null : (value.properties as Array<any>).map(FoodPropertiesInnerToJSON)),
'properties': value.properties === undefined ? undefined : (value.properties === null ? null : (value.properties as Array<any>).map(PropertyToJSON)),
'properties_food_amount': value.propertiesFoodAmount,
'properties_food_unit': FoodPropertiesFoodUnitToJSON(value.propertiesFoodUnit),
'properties_food_unit': UnitToJSON(value.propertiesFoodUnit),
'fdc_id': value.fdcId,
'food_onhand': value.foodOnhand,
'supermarket_category': FoodSupermarketCategoryToJSON(value.supermarketCategory),
'inherit_fields': value.inheritFields === undefined ? undefined : (value.inheritFields === null ? null : (value.inheritFields as Array<any>).map(FoodInheritFieldsInnerToJSON)),
'supermarket_category': SupermarketCategoryToJSON(value.supermarketCategory),
'inherit_fields': value.inheritFields === undefined ? undefined : (value.inheritFields === null ? null : (value.inheritFields as Array<any>).map(FoodInheritFieldToJSON)),
'ignore_shopping': value.ignoreShopping,
'substitute': value.substitute === undefined ? undefined : (value.substitute === null ? null : (value.substitute as Array<any>).map(FoodSubstituteInnerToJSON)),
'substitute': value.substitute === undefined ? undefined : (value.substitute === null ? null : (value.substitute as Array<any>).map(FoodSimpleToJSON)),
'substitute_siblings': value.substituteSiblings,
'substitute_children': value.substituteChildren,
'child_inherit_fields': value.childInheritFields === undefined ? undefined : (value.childInheritFields === null ? null : (value.childInheritFields as Array<any>).map(FoodInheritFieldsInnerToJSON)),
'child_inherit_fields': value.childInheritFields === undefined ? undefined : (value.childInheritFields === null ? null : (value.childInheritFields as Array<any>).map(FoodInheritFieldToJSON)),
'open_data_slug': value.openDataSlug,
};
}