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,61 +13,61 @@
*/
import { exists, mapValues } from '../runtime';
import type { OpenDataUnitBaseUnit } from './OpenDataUnitBaseUnit';
import {
OpenDataUnitBaseUnitFromJSON,
OpenDataUnitBaseUnitFromJSONTyped,
OpenDataUnitBaseUnitToJSON,
} from './OpenDataUnitBaseUnit';
import type { OpenDataUnitTypeEnum } from './OpenDataUnitTypeEnum';
import {
BaseUnitEnum,
BaseUnitEnumFromJSON,
BaseUnitEnumFromJSONTyped,
BaseUnitEnumToJSON,
BlankEnum,
BlankEnumFromJSON,
BlankEnumFromJSONTyped,
BlankEnumToJSON,
OpenDataUnitTypeEnum,
OpenDataUnitTypeEnumFromJSON,
OpenDataUnitTypeEnumFromJSONTyped,
OpenDataUnitTypeEnumToJSON,
} from './OpenDataUnitTypeEnum';
import type { OpenDataVersion } from './OpenDataVersion';
import {
OpenDataVersion,
OpenDataVersionFromJSON,
OpenDataVersionFromJSONTyped,
OpenDataVersionToJSON,
} from './OpenDataVersion';
} 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 PatchedOpenDataUnit
*/
@@ -104,10 +104,10 @@ export interface PatchedOpenDataUnit {
pluralName?: string;
/**
*
* @type {OpenDataUnitBaseUnit}
* @type {BaseUnitEnum | BlankEnum}
* @memberof PatchedOpenDataUnit
*/
baseUnit?: OpenDataUnitBaseUnit;
baseUnit?: BaseUnitEnum | BlankEnum;
/**
*
* @type {OpenDataUnitTypeEnum}
@@ -128,15 +128,6 @@ export interface PatchedOpenDataUnit {
readonly createdBy?: string;
}
/**
* Check if a given object implements the PatchedOpenDataUnit interface.
*/
export function instanceOfPatchedOpenDataUnit(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function PatchedOpenDataUnitFromJSON(json: any): PatchedOpenDataUnit {
return PatchedOpenDataUnitFromJSONTyped(json, false);
}
@@ -152,7 +143,7 @@ export function PatchedOpenDataUnitFromJSONTyped(json: any, ignoreDiscriminator:
'slug': !exists(json, 'slug') ? undefined : json['slug'],
'name': !exists(json, 'name') ? undefined : json['name'],
'pluralName': !exists(json, 'plural_name') ? undefined : json['plural_name'],
'baseUnit': !exists(json, 'base_unit') ? undefined : OpenDataUnitBaseUnitFromJSON(json['base_unit']),
'baseUnit': !exists(json, 'base_unit') ? undefined : BaseUnitEnum | BlankEnumFromJSON(json['base_unit']),
'type': !exists(json, 'type') ? undefined : OpenDataUnitTypeEnumFromJSON(json['type']),
'comment': !exists(json, 'comment') ? undefined : json['comment'],
'createdBy': !exists(json, 'created_by') ? undefined : json['created_by'],
@@ -172,9 +163,10 @@ export function PatchedOpenDataUnitToJSON(value?: PatchedOpenDataUnit | null): a
'slug': value.slug,
'name': value.name,
'plural_name': value.pluralName,
'base_unit': OpenDataUnitBaseUnitToJSON(value.baseUnit),
'base_unit': BaseUnitEnum | BlankEnumToJSON(value.baseUnit),
'type': OpenDataUnitTypeEnumToJSON(value.type),
'comment': value.comment,
};
}