working search with flat endpoint

This commit is contained in:
vabene1111
2024-02-29 20:08:37 +01:00
parent e47bdd043e
commit 1cac34d2a0
143 changed files with 18623 additions and 9992 deletions

View File

@@ -0,0 +1,314 @@
/* tslint:disable */
/* eslint-disable */
/**
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* 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 { exists, 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 | null;
/**
*
* @type {string}
* @memberof PatchedFood
*/
description?: string;
/**
*
* @type {string}
* @memberof PatchedFood
*/
readonly shopping?: string;
/**
*
* @type {RecipeSimple}
* @memberof PatchedFood
*/
recipe?: RecipeSimple | null;
/**
*
* @type {string}
* @memberof PatchedFood
*/
url?: string | null;
/**
*
* @type {Array<Property>}
* @memberof PatchedFood
*/
properties?: Array<Property> | null;
/**
*
* @type {string}
* @memberof PatchedFood
*/
propertiesFoodAmount?: string;
/**
*
* @type {Unit}
* @memberof PatchedFood
*/
propertiesFoodUnit?: Unit | null;
/**
*
* @type {number}
* @memberof PatchedFood
*/
fdcId?: number | null;
/**
*
* @type {string}
* @memberof PatchedFood
*/
foodOnhand?: string | null;
/**
*
* @type {SupermarketCategory}
* @memberof PatchedFood
*/
supermarketCategory?: SupermarketCategory | null;
/**
*
* @type {string}
* @memberof PatchedFood
*/
readonly parent?: string;
/**
*
* @type {number}
* @memberof PatchedFood
*/
readonly numchild?: number;
/**
*
* @type {Array<FoodInheritField>}
* @memberof PatchedFood
*/
inheritFields?: Array<FoodInheritField> | null;
/**
*
* @type {string}
* @memberof PatchedFood
*/
readonly fullName?: string;
/**
*
* @type {boolean}
* @memberof PatchedFood
*/
ignoreShopping?: boolean;
/**
*
* @type {Array<FoodSimple>}
* @memberof PatchedFood
*/
substitute?: Array<FoodSimple> | null;
/**
*
* @type {boolean}
* @memberof PatchedFood
*/
substituteSiblings?: boolean;
/**
*
* @type {boolean}
* @memberof PatchedFood
*/
substituteChildren?: boolean;
/**
*
* @type {string}
* @memberof PatchedFood
*/
readonly substituteOnhand?: string;
/**
*
* @type {Array<FoodInheritField>}
* @memberof PatchedFood
*/
childInheritFields?: Array<FoodInheritField> | null;
/**
*
* @type {string}
* @memberof PatchedFood
*/
openDataSlug?: string | null;
}
/**
* Check if a given object implements the PatchedFood interface.
*/
export function instanceOfPatchedFood(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function PatchedFoodFromJSON(json: any): PatchedFood {
return PatchedFoodFromJSONTyped(json, false);
}
export function PatchedFoodFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedFood {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'id': !exists(json, 'id') ? undefined : json['id'],
'name': !exists(json, 'name') ? undefined : 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 : 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(PropertyFromJSON)),
'propertiesFoodAmount': !exists(json, 'properties_food_amount') ? undefined : json['properties_food_amount'],
'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 : SupermarketCategoryFromJSON(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(FoodInheritFieldFromJSON)),
'fullName': !exists(json, 'full_name') ? undefined : 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(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(FoodInheritFieldFromJSON)),
'openDataSlug': !exists(json, 'open_data_slug') ? undefined : json['open_data_slug'],
};
}
export function PatchedFoodToJSON(value?: PatchedFood | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'name': value.name,
'plural_name': value.pluralName,
'description': value.description,
'recipe': RecipeSimpleToJSON(value.recipe),
'url': value.url,
'properties': value.properties === undefined ? undefined : (value.properties === null ? null : (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 === 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(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(FoodInheritFieldToJSON)),
'open_data_slug': value.openDataSlug,
};
}