This commit is contained in:
vabene1111
2024-03-05 17:16:07 +01:00
parent aa5a87a1fc
commit c0c71c3967
138 changed files with 4367 additions and 3934 deletions

View File

@@ -1,8 +1,8 @@
/* tslint:disable */
/* eslint-disable */
/**
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
* Tandoor
* Tandoor API Docs
*
* The version of the OpenAPI document: 0.0.0
*
@@ -13,79 +13,69 @@
*/
import { exists, mapValues } from '../runtime';
import type { FoodInheritField } from './FoodInheritField';
import {
FoodInheritField,
FoodInheritFieldFromJSON,
FoodInheritFieldFromJSONTyped,
FoodInheritFieldToJSON,
} from './FoodInheritField';
import type { FoodSimple } from './FoodSimple';
import {
FoodSimple,
FoodSimpleFromJSON,
FoodSimpleFromJSONTyped,
FoodSimpleToJSON,
} from './FoodSimple';
import type { Property } from './Property';
import {
Property,
PropertyFromJSON,
PropertyFromJSONTyped,
PropertyToJSON,
} from './Property';
import type { RecipeSimple } from './RecipeSimple';
import {
RecipeSimple,
RecipeSimpleFromJSON,
RecipeSimpleFromJSONTyped,
RecipeSimpleToJSON,
} from './RecipeSimple';
import type { SupermarketCategory } from './SupermarketCategory';
import {
SupermarketCategory,
SupermarketCategoryFromJSON,
SupermarketCategoryFromJSONTyped,
SupermarketCategoryToJSON,
} from './SupermarketCategory';
import type { Unit } from './Unit';
import {
Unit,
UnitFromJSON,
UnitFromJSONTyped,
UnitToJSON,
} from './Unit';
} from './';
/**
* 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.
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
*/
@@ -236,15 +226,6 @@ export interface 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);
}
@@ -312,3 +293,4 @@ export function PatchedFoodToJSON(value?: PatchedFood | null): any {
};
}