mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-03 05:11:31 -05:00
working search with flat endpoint
This commit is contained in:
@@ -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,15 +13,49 @@
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import type { FoodPropertiesInnerPropertyType } from './FoodPropertiesInnerPropertyType';
|
||||
import type { PropertyType } from './PropertyType';
|
||||
import {
|
||||
FoodPropertiesInnerPropertyTypeFromJSON,
|
||||
FoodPropertiesInnerPropertyTypeFromJSONTyped,
|
||||
FoodPropertiesInnerPropertyTypeToJSON,
|
||||
} from './FoodPropertiesInnerPropertyType';
|
||||
PropertyTypeFromJSON,
|
||||
PropertyTypeFromJSONTyped,
|
||||
PropertyTypeToJSON,
|
||||
} from './PropertyType';
|
||||
|
||||
/**
|
||||
* 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 Property
|
||||
*/
|
||||
@@ -31,7 +65,7 @@ export interface Property {
|
||||
* @type {number}
|
||||
* @memberof Property
|
||||
*/
|
||||
readonly id?: number;
|
||||
readonly id: number;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@@ -40,10 +74,10 @@ export interface Property {
|
||||
propertyAmount: string | null;
|
||||
/**
|
||||
*
|
||||
* @type {FoodPropertiesInnerPropertyType}
|
||||
* @type {PropertyType}
|
||||
* @memberof Property
|
||||
*/
|
||||
propertyType: FoodPropertiesInnerPropertyType;
|
||||
propertyType: PropertyType;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -51,6 +85,7 @@ export interface Property {
|
||||
*/
|
||||
export function instanceOfProperty(value: object): boolean {
|
||||
let isInstance = true;
|
||||
isInstance = isInstance && "id" in value;
|
||||
isInstance = isInstance && "propertyAmount" in value;
|
||||
isInstance = isInstance && "propertyType" in value;
|
||||
|
||||
@@ -67,9 +102,9 @@ export function PropertyFromJSONTyped(json: any, ignoreDiscriminator: boolean):
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'id': json['id'],
|
||||
'propertyAmount': json['property_amount'],
|
||||
'propertyType': FoodPropertiesInnerPropertyTypeFromJSON(json['property_type']),
|
||||
'propertyType': PropertyTypeFromJSON(json['property_type']),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -83,7 +118,7 @@ export function PropertyToJSON(value?: Property | null): any {
|
||||
return {
|
||||
|
||||
'property_amount': value.propertyAmount,
|
||||
'property_type': FoodPropertiesInnerPropertyTypeToJSON(value.propertyType),
|
||||
'property_type': PropertyTypeToJSON(value.propertyType),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user