mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-02 04:39:54 -05:00
working on model select
This commit is contained in:
@@ -8,7 +8,6 @@ models/AuthToken.ts
|
||||
models/Automation.ts
|
||||
models/AutomationTypeEnum.ts
|
||||
models/BaseUnitEnum.ts
|
||||
models/BlankEnum.ts
|
||||
models/BookmarkletImport.ts
|
||||
models/BookmarkletImportList.ts
|
||||
models/ConnectorConfigConfig.ts
|
||||
|
||||
@@ -1 +1 @@
|
||||
5.1.0
|
||||
7.4.0
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -22,7 +22,7 @@ export class ApiImportOpenDataApi extends runtime.BaseAPI {
|
||||
|
||||
/**
|
||||
*/
|
||||
async apiImportOpenDataCreateRaw(): Promise<runtime.ApiResponse<void>> {
|
||||
async apiImportOpenDataCreateRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
||||
const queryParameters: any = {};
|
||||
|
||||
const headerParameters: runtime.HTTPHeaders = {};
|
||||
@@ -35,20 +35,20 @@ export class ApiImportOpenDataApi extends runtime.BaseAPI {
|
||||
method: 'POST',
|
||||
headers: headerParameters,
|
||||
query: queryParameters,
|
||||
});
|
||||
}, initOverrides);
|
||||
|
||||
return new runtime.VoidApiResponse(response);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
async apiImportOpenDataCreate(): Promise<void> {
|
||||
await this.apiImportOpenDataCreateRaw();
|
||||
async apiImportOpenDataCreate(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
||||
await this.apiImportOpenDataCreateRaw(initOverrides);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
async apiImportOpenDataRetrieveRaw(): Promise<runtime.ApiResponse<void>> {
|
||||
async apiImportOpenDataRetrieveRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
||||
const queryParameters: any = {};
|
||||
|
||||
const headerParameters: runtime.HTTPHeaders = {};
|
||||
@@ -61,15 +61,15 @@ export class ApiImportOpenDataApi extends runtime.BaseAPI {
|
||||
method: 'GET',
|
||||
headers: headerParameters,
|
||||
query: queryParameters,
|
||||
});
|
||||
}, initOverrides);
|
||||
|
||||
return new runtime.VoidApiResponse(response);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
async apiImportOpenDataRetrieve(): Promise<void> {
|
||||
await this.apiImportOpenDataRetrieveRaw();
|
||||
async apiImportOpenDataRetrieve(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
||||
await this.apiImportOpenDataRetrieveRaw(initOverrides);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,11 +14,13 @@
|
||||
|
||||
|
||||
import * as runtime from '../runtime';
|
||||
import type {
|
||||
AuthToken,
|
||||
} from '../models/index';
|
||||
import {
|
||||
AuthToken,
|
||||
AuthTokenFromJSON,
|
||||
AuthTokenToJSON,
|
||||
} from '../models';
|
||||
} from '../models/index';
|
||||
|
||||
export interface ApiTokenAuthCreateRequest {
|
||||
username: string;
|
||||
@@ -33,17 +35,26 @@ export class ApiTokenAuthApi extends runtime.BaseAPI {
|
||||
|
||||
/**
|
||||
*/
|
||||
async apiTokenAuthCreateRaw(requestParameters: ApiTokenAuthCreateRequest): Promise<runtime.ApiResponse<AuthToken>> {
|
||||
if (requestParameters.username === null || requestParameters.username === undefined) {
|
||||
throw new runtime.RequiredError('username','Required parameter requestParameters.username was null or undefined when calling apiTokenAuthCreate.');
|
||||
async apiTokenAuthCreateRaw(requestParameters: ApiTokenAuthCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuthToken>> {
|
||||
if (requestParameters['username'] == null) {
|
||||
throw new runtime.RequiredError(
|
||||
'username',
|
||||
'Required parameter "username" was null or undefined when calling apiTokenAuthCreate().'
|
||||
);
|
||||
}
|
||||
|
||||
if (requestParameters.password === null || requestParameters.password === undefined) {
|
||||
throw new runtime.RequiredError('password','Required parameter requestParameters.password was null or undefined when calling apiTokenAuthCreate.');
|
||||
if (requestParameters['password'] == null) {
|
||||
throw new runtime.RequiredError(
|
||||
'password',
|
||||
'Required parameter "password" was null or undefined when calling apiTokenAuthCreate().'
|
||||
);
|
||||
}
|
||||
|
||||
if (requestParameters.token === null || requestParameters.token === undefined) {
|
||||
throw new runtime.RequiredError('token','Required parameter requestParameters.token was null or undefined when calling apiTokenAuthCreate.');
|
||||
if (requestParameters['token'] == null) {
|
||||
throw new runtime.RequiredError(
|
||||
'token',
|
||||
'Required parameter "token" was null or undefined when calling apiTokenAuthCreate().'
|
||||
);
|
||||
}
|
||||
|
||||
const queryParameters: any = {};
|
||||
@@ -69,16 +80,16 @@ export class ApiTokenAuthApi extends runtime.BaseAPI {
|
||||
formParams = new URLSearchParams();
|
||||
}
|
||||
|
||||
if (requestParameters.username !== undefined) {
|
||||
formParams.append('username', requestParameters.username as any);
|
||||
if (requestParameters['username'] != null) {
|
||||
formParams.append('username', requestParameters['username'] as any);
|
||||
}
|
||||
|
||||
if (requestParameters.password !== undefined) {
|
||||
formParams.append('password', requestParameters.password as any);
|
||||
if (requestParameters['password'] != null) {
|
||||
formParams.append('password', requestParameters['password'] as any);
|
||||
}
|
||||
|
||||
if (requestParameters.token !== undefined) {
|
||||
formParams.append('token', requestParameters.token as any);
|
||||
if (requestParameters['token'] != null) {
|
||||
formParams.append('token', requestParameters['token'] as any);
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
@@ -87,15 +98,15 @@ export class ApiTokenAuthApi extends runtime.BaseAPI {
|
||||
headers: headerParameters,
|
||||
query: queryParameters,
|
||||
body: formParams,
|
||||
});
|
||||
}, initOverrides);
|
||||
|
||||
return new runtime.JSONApiResponse(response, (jsonValue) => AuthTokenFromJSON(jsonValue));
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
async apiTokenAuthCreate(requestParameters: ApiTokenAuthCreateRequest): Promise<AuthToken> {
|
||||
const response = await this.apiTokenAuthCreateRaw(requestParameters);
|
||||
async apiTokenAuthCreate(requestParameters: ApiTokenAuthCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuthToken> {
|
||||
const response = await this.apiTokenAuthCreateRaw(requestParameters, initOverrides);
|
||||
return await response.value();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
export * from './ApiApi';
|
||||
export * from './ApiImportOpenDataApi';
|
||||
export * from './ApiTokenAuthApi';
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
export * from './runtime';
|
||||
export * from './apis';
|
||||
export * from './models';
|
||||
export * from './apis/index';
|
||||
export * from './models/index';
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
@@ -57,12 +57,24 @@ export interface AccessToken {
|
||||
readonly updated: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the AccessToken interface.
|
||||
*/
|
||||
export function instanceOfAccessToken(value: object): boolean {
|
||||
if (!('id' in value)) return false;
|
||||
if (!('token' in value)) return false;
|
||||
if (!('expires' in value)) return false;
|
||||
if (!('created' in value)) return false;
|
||||
if (!('updated' in value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function AccessTokenFromJSON(json: any): AccessToken {
|
||||
return AccessTokenFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function AccessTokenFromJSONTyped(json: any, ignoreDiscriminator: boolean): AccessToken {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
@@ -70,24 +82,20 @@ export function AccessTokenFromJSONTyped(json: any, ignoreDiscriminator: boolean
|
||||
'id': json['id'],
|
||||
'token': json['token'],
|
||||
'expires': (new Date(json['expires'])),
|
||||
'scope': !exists(json, 'scope') ? undefined : json['scope'],
|
||||
'scope': json['scope'] == null ? undefined : json['scope'],
|
||||
'created': (new Date(json['created'])),
|
||||
'updated': (new Date(json['updated'])),
|
||||
};
|
||||
}
|
||||
|
||||
export function AccessTokenToJSON(value?: AccessToken | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'expires': (value.expires.toISOString()),
|
||||
'scope': value.scope,
|
||||
'expires': ((value['expires']).toISOString()),
|
||||
'scope': value['scope'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
@@ -39,12 +39,22 @@ export interface AuthToken {
|
||||
readonly token: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the AuthToken interface.
|
||||
*/
|
||||
export function instanceOfAuthToken(value: object): boolean {
|
||||
if (!('username' in value)) return false;
|
||||
if (!('password' in value)) return false;
|
||||
if (!('token' in value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function AuthTokenFromJSON(json: any): AuthToken {
|
||||
return AuthTokenFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function AuthTokenFromJSONTyped(json: any, ignoreDiscriminator: boolean): AuthToken {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
@@ -56,17 +66,13 @@ export function AuthTokenFromJSONTyped(json: any, ignoreDiscriminator: boolean):
|
||||
}
|
||||
|
||||
export function AuthTokenToJSON(value?: AuthToken | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'username': value.username,
|
||||
'password': value.password,
|
||||
'username': value['username'],
|
||||
'password': value['password'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { AutomationTypeEnum } from './AutomationTypeEnum';
|
||||
import {
|
||||
AutomationTypeEnum,
|
||||
AutomationTypeEnumFromJSON,
|
||||
AutomationTypeEnumFromJSONTyped,
|
||||
AutomationTypeEnumToJSON,
|
||||
} from './';
|
||||
} from './AutomationTypeEnum';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -49,25 +49,25 @@ export interface Automation {
|
||||
* @type {string}
|
||||
* @memberof Automation
|
||||
*/
|
||||
description?: string | null;
|
||||
description?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Automation
|
||||
*/
|
||||
param1?: string | null;
|
||||
param1?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Automation
|
||||
*/
|
||||
param2?: string | null;
|
||||
param2?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Automation
|
||||
*/
|
||||
param3?: string | null;
|
||||
param3?: string;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
@@ -88,47 +88,53 @@ export interface Automation {
|
||||
readonly createdBy: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the Automation interface.
|
||||
*/
|
||||
export function instanceOfAutomation(value: object): boolean {
|
||||
if (!('id' in value)) return false;
|
||||
if (!('type' in value)) return false;
|
||||
if (!('createdBy' in value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function AutomationFromJSON(json: any): Automation {
|
||||
return AutomationFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function AutomationFromJSONTyped(json: any, ignoreDiscriminator: boolean): Automation {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': json['id'],
|
||||
'type': AutomationTypeEnumFromJSON(json['type']),
|
||||
'name': !exists(json, 'name') ? undefined : json['name'],
|
||||
'description': !exists(json, 'description') ? undefined : json['description'],
|
||||
'param1': !exists(json, 'param_1') ? undefined : json['param_1'],
|
||||
'param2': !exists(json, 'param_2') ? undefined : json['param_2'],
|
||||
'param3': !exists(json, 'param_3') ? undefined : json['param_3'],
|
||||
'order': !exists(json, 'order') ? undefined : json['order'],
|
||||
'disabled': !exists(json, 'disabled') ? undefined : json['disabled'],
|
||||
'name': json['name'] == null ? undefined : json['name'],
|
||||
'description': json['description'] == null ? undefined : json['description'],
|
||||
'param1': json['param_1'] == null ? undefined : json['param_1'],
|
||||
'param2': json['param_2'] == null ? undefined : json['param_2'],
|
||||
'param3': json['param_3'] == null ? undefined : json['param_3'],
|
||||
'order': json['order'] == null ? undefined : json['order'],
|
||||
'disabled': json['disabled'] == null ? undefined : json['disabled'],
|
||||
'createdBy': json['created_by'],
|
||||
};
|
||||
}
|
||||
|
||||
export function AutomationToJSON(value?: Automation | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'type': AutomationTypeEnumToJSON(value.type),
|
||||
'name': value.name,
|
||||
'description': value.description,
|
||||
'param_1': value.param1,
|
||||
'param_2': value.param2,
|
||||
'param_3': value.param3,
|
||||
'order': value.order,
|
||||
'disabled': value.disabled,
|
||||
'type': AutomationTypeEnumToJSON(value['type']),
|
||||
'name': value['name'],
|
||||
'description': value['description'],
|
||||
'param_1': value['param1'],
|
||||
'param_2': value['param2'],
|
||||
'param_3': value['param3'],
|
||||
'order': value['order'],
|
||||
'disabled': value['disabled'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,32 +12,34 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* * `FOOD_ALIAS` - Food Alias
|
||||
* `UNIT_ALIAS` - Unit Alias
|
||||
* `KEYWORD_ALIAS` - Keyword Alias
|
||||
* `DESCRIPTION_REPLACE` - Description Replace
|
||||
* `INSTRUCTION_REPLACE` - Instruction Replace
|
||||
* `NEVER_UNIT` - Never Unit
|
||||
* `TRANSPOSE_WORDS` - Transpose Words
|
||||
* `FOOD_REPLACE` - Food Replace
|
||||
* `UNIT_REPLACE` - Unit Replace
|
||||
* `NAME_REPLACE` - Name Replace
|
||||
* * `UNIT_ALIAS` - Unit Alias
|
||||
* * `KEYWORD_ALIAS` - Keyword Alias
|
||||
* * `DESCRIPTION_REPLACE` - Description Replace
|
||||
* * `INSTRUCTION_REPLACE` - Instruction Replace
|
||||
* * `NEVER_UNIT` - Never Unit
|
||||
* * `TRANSPOSE_WORDS` - Transpose Words
|
||||
* * `FOOD_REPLACE` - Food Replace
|
||||
* * `UNIT_REPLACE` - Unit Replace
|
||||
* * `NAME_REPLACE` - Name Replace
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum AutomationTypeEnum {
|
||||
FoodAlias = 'FOOD_ALIAS',
|
||||
UnitAlias = 'UNIT_ALIAS',
|
||||
KeywordAlias = 'KEYWORD_ALIAS',
|
||||
DescriptionReplace = 'DESCRIPTION_REPLACE',
|
||||
InstructionReplace = 'INSTRUCTION_REPLACE',
|
||||
NeverUnit = 'NEVER_UNIT',
|
||||
TransposeWords = 'TRANSPOSE_WORDS',
|
||||
FoodReplace = 'FOOD_REPLACE',
|
||||
UnitReplace = 'UNIT_REPLACE',
|
||||
NameReplace = 'NAME_REPLACE'
|
||||
}
|
||||
export const AutomationTypeEnum = {
|
||||
FoodAlias: 'FOOD_ALIAS',
|
||||
UnitAlias: 'UNIT_ALIAS',
|
||||
KeywordAlias: 'KEYWORD_ALIAS',
|
||||
DescriptionReplace: 'DESCRIPTION_REPLACE',
|
||||
InstructionReplace: 'INSTRUCTION_REPLACE',
|
||||
NeverUnit: 'NEVER_UNIT',
|
||||
TransposeWords: 'TRANSPOSE_WORDS',
|
||||
FoodReplace: 'FOOD_REPLACE',
|
||||
UnitReplace: 'UNIT_REPLACE',
|
||||
NameReplace: 'NAME_REPLACE'
|
||||
} as const;
|
||||
export type AutomationTypeEnum = typeof AutomationTypeEnum[keyof typeof AutomationTypeEnum];
|
||||
|
||||
|
||||
export function AutomationTypeEnumFromJSON(json: any): AutomationTypeEnum {
|
||||
return AutomationTypeEnumFromJSONTyped(json, false);
|
||||
|
||||
@@ -12,46 +12,48 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* * `G` - g
|
||||
* `KG` - kg
|
||||
* `ML` - ml
|
||||
* `L` - l
|
||||
* `OUNCE` - ounce
|
||||
* `POUND` - pound
|
||||
* `FLUID_OUNCE` - fluid_ounce
|
||||
* `TSP` - tsp
|
||||
* `TBSP` - tbsp
|
||||
* `CUP` - cup
|
||||
* `PINT` - pint
|
||||
* `QUART` - quart
|
||||
* `GALLON` - gallon
|
||||
* `IMPERIAL_FLUID_OUNCE` - imperial fluid ounce
|
||||
* `IMPERIAL_PINT` - imperial pint
|
||||
* `IMPERIAL_QUART` - imperial quart
|
||||
* `IMPERIAL_GALLON` - imperial gallon
|
||||
* * `KG` - kg
|
||||
* * `ML` - ml
|
||||
* * `L` - l
|
||||
* * `OUNCE` - ounce
|
||||
* * `POUND` - pound
|
||||
* * `FLUID_OUNCE` - fluid_ounce
|
||||
* * `TSP` - tsp
|
||||
* * `TBSP` - tbsp
|
||||
* * `CUP` - cup
|
||||
* * `PINT` - pint
|
||||
* * `QUART` - quart
|
||||
* * `GALLON` - gallon
|
||||
* * `IMPERIAL_FLUID_OUNCE` - imperial fluid ounce
|
||||
* * `IMPERIAL_PINT` - imperial pint
|
||||
* * `IMPERIAL_QUART` - imperial quart
|
||||
* * `IMPERIAL_GALLON` - imperial gallon
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum BaseUnitEnum {
|
||||
G = 'G',
|
||||
Kg = 'KG',
|
||||
Ml = 'ML',
|
||||
L = 'L',
|
||||
Ounce = 'OUNCE',
|
||||
Pound = 'POUND',
|
||||
FluidOunce = 'FLUID_OUNCE',
|
||||
Tsp = 'TSP',
|
||||
Tbsp = 'TBSP',
|
||||
Cup = 'CUP',
|
||||
Pint = 'PINT',
|
||||
Quart = 'QUART',
|
||||
Gallon = 'GALLON',
|
||||
ImperialFluidOunce = 'IMPERIAL_FLUID_OUNCE',
|
||||
ImperialPint = 'IMPERIAL_PINT',
|
||||
ImperialQuart = 'IMPERIAL_QUART',
|
||||
ImperialGallon = 'IMPERIAL_GALLON'
|
||||
}
|
||||
export const BaseUnitEnum = {
|
||||
G: 'G',
|
||||
Kg: 'KG',
|
||||
Ml: 'ML',
|
||||
L: 'L',
|
||||
Ounce: 'OUNCE',
|
||||
Pound: 'POUND',
|
||||
FluidOunce: 'FLUID_OUNCE',
|
||||
Tsp: 'TSP',
|
||||
Tbsp: 'TBSP',
|
||||
Cup: 'CUP',
|
||||
Pint: 'PINT',
|
||||
Quart: 'QUART',
|
||||
Gallon: 'GALLON',
|
||||
ImperialFluidOunce: 'IMPERIAL_FLUID_OUNCE',
|
||||
ImperialPint: 'IMPERIAL_PINT',
|
||||
ImperialQuart: 'IMPERIAL_QUART',
|
||||
ImperialGallon: 'IMPERIAL_GALLON'
|
||||
} as const;
|
||||
export type BaseUnitEnum = typeof BaseUnitEnum[keyof typeof BaseUnitEnum];
|
||||
|
||||
|
||||
export function BaseUnitEnumFromJSON(json: any): BaseUnitEnum {
|
||||
return BaseUnitEnumFromJSONTyped(json, false);
|
||||
|
||||
@@ -12,14 +12,16 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum BlankEnum {
|
||||
Empty = ''
|
||||
}
|
||||
export const BlankEnum = {
|
||||
Empty: ''
|
||||
} as const;
|
||||
export type BlankEnum = typeof BlankEnum[keyof typeof BlankEnum];
|
||||
|
||||
|
||||
export function BlankEnumFromJSON(json: any): BlankEnum {
|
||||
return BlankEnumFromJSONTyped(json, false);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
@@ -30,7 +30,7 @@ export interface BookmarkletImport {
|
||||
* @type {string}
|
||||
* @memberof BookmarkletImport
|
||||
*/
|
||||
url?: string | null;
|
||||
url?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@@ -51,18 +51,29 @@ export interface BookmarkletImport {
|
||||
readonly createdAt: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the BookmarkletImport interface.
|
||||
*/
|
||||
export function instanceOfBookmarkletImport(value: object): boolean {
|
||||
if (!('id' in value)) return false;
|
||||
if (!('html' in value)) return false;
|
||||
if (!('createdBy' in value)) return false;
|
||||
if (!('createdAt' in value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function BookmarkletImportFromJSON(json: any): BookmarkletImport {
|
||||
return BookmarkletImportFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function BookmarkletImportFromJSONTyped(json: any, ignoreDiscriminator: boolean): BookmarkletImport {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': json['id'],
|
||||
'url': !exists(json, 'url') ? undefined : json['url'],
|
||||
'url': json['url'] == null ? undefined : json['url'],
|
||||
'html': json['html'],
|
||||
'createdBy': json['created_by'],
|
||||
'createdAt': (new Date(json['created_at'])),
|
||||
@@ -70,17 +81,13 @@ export function BookmarkletImportFromJSONTyped(json: any, ignoreDiscriminator: b
|
||||
}
|
||||
|
||||
export function BookmarkletImportToJSON(value?: BookmarkletImport | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'url': value.url,
|
||||
'html': value.html,
|
||||
'url': value['url'],
|
||||
'html': value['html'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
@@ -30,7 +30,7 @@ export interface BookmarkletImportList {
|
||||
* @type {string}
|
||||
* @memberof BookmarkletImportList
|
||||
*/
|
||||
url?: string | null;
|
||||
url?: string;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
@@ -45,34 +45,40 @@ export interface BookmarkletImportList {
|
||||
readonly createdAt: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the BookmarkletImportList interface.
|
||||
*/
|
||||
export function instanceOfBookmarkletImportList(value: object): boolean {
|
||||
if (!('id' in value)) return false;
|
||||
if (!('createdBy' in value)) return false;
|
||||
if (!('createdAt' in value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function BookmarkletImportListFromJSON(json: any): BookmarkletImportList {
|
||||
return BookmarkletImportListFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function BookmarkletImportListFromJSONTyped(json: any, ignoreDiscriminator: boolean): BookmarkletImportList {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': json['id'],
|
||||
'url': !exists(json, 'url') ? undefined : json['url'],
|
||||
'url': json['url'] == null ? undefined : json['url'],
|
||||
'createdBy': json['created_by'],
|
||||
'createdAt': (new Date(json['created_at'])),
|
||||
};
|
||||
}
|
||||
|
||||
export function BookmarkletImportListToJSON(value?: BookmarkletImportList | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'url': value.url,
|
||||
'url': value['url'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
@@ -36,19 +36,19 @@ export interface ConnectorConfigConfig {
|
||||
* @type {string}
|
||||
* @memberof ConnectorConfigConfig
|
||||
*/
|
||||
url?: string | null;
|
||||
url?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof ConnectorConfigConfig
|
||||
*/
|
||||
token?: string | null;
|
||||
token?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof ConnectorConfigConfig
|
||||
*/
|
||||
todoEntity?: string | null;
|
||||
todoEntity?: string;
|
||||
/**
|
||||
* Is Connector Enabled
|
||||
* @type {boolean}
|
||||
@@ -81,47 +81,53 @@ export interface ConnectorConfigConfig {
|
||||
readonly createdBy: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the ConnectorConfigConfig interface.
|
||||
*/
|
||||
export function instanceOfConnectorConfigConfig(value: object): boolean {
|
||||
if (!('id' in value)) return false;
|
||||
if (!('name' in value)) return false;
|
||||
if (!('createdBy' in value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function ConnectorConfigConfigFromJSON(json: any): ConnectorConfigConfig {
|
||||
return ConnectorConfigConfigFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function ConnectorConfigConfigFromJSONTyped(json: any, ignoreDiscriminator: boolean): ConnectorConfigConfig {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': json['id'],
|
||||
'name': json['name'],
|
||||
'url': !exists(json, 'url') ? undefined : json['url'],
|
||||
'token': !exists(json, 'token') ? undefined : json['token'],
|
||||
'todoEntity': !exists(json, 'todo_entity') ? undefined : json['todo_entity'],
|
||||
'enabled': !exists(json, 'enabled') ? undefined : json['enabled'],
|
||||
'onShoppingListEntryCreatedEnabled': !exists(json, 'on_shopping_list_entry_created_enabled') ? undefined : json['on_shopping_list_entry_created_enabled'],
|
||||
'onShoppingListEntryUpdatedEnabled': !exists(json, 'on_shopping_list_entry_updated_enabled') ? undefined : json['on_shopping_list_entry_updated_enabled'],
|
||||
'onShoppingListEntryDeletedEnabled': !exists(json, 'on_shopping_list_entry_deleted_enabled') ? undefined : json['on_shopping_list_entry_deleted_enabled'],
|
||||
'url': json['url'] == null ? undefined : json['url'],
|
||||
'token': json['token'] == null ? undefined : json['token'],
|
||||
'todoEntity': json['todo_entity'] == null ? undefined : json['todo_entity'],
|
||||
'enabled': json['enabled'] == null ? undefined : json['enabled'],
|
||||
'onShoppingListEntryCreatedEnabled': json['on_shopping_list_entry_created_enabled'] == null ? undefined : json['on_shopping_list_entry_created_enabled'],
|
||||
'onShoppingListEntryUpdatedEnabled': json['on_shopping_list_entry_updated_enabled'] == null ? undefined : json['on_shopping_list_entry_updated_enabled'],
|
||||
'onShoppingListEntryDeletedEnabled': json['on_shopping_list_entry_deleted_enabled'] == null ? undefined : json['on_shopping_list_entry_deleted_enabled'],
|
||||
'createdBy': json['created_by'],
|
||||
};
|
||||
}
|
||||
|
||||
export function ConnectorConfigConfigToJSON(value?: ConnectorConfigConfig | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'name': value.name,
|
||||
'url': value.url,
|
||||
'token': value.token,
|
||||
'todo_entity': value.todoEntity,
|
||||
'enabled': value.enabled,
|
||||
'on_shopping_list_entry_created_enabled': value.onShoppingListEntryCreatedEnabled,
|
||||
'on_shopping_list_entry_updated_enabled': value.onShoppingListEntryUpdatedEnabled,
|
||||
'on_shopping_list_entry_deleted_enabled': value.onShoppingListEntryDeletedEnabled,
|
||||
'name': value['name'],
|
||||
'url': value['url'],
|
||||
'token': value['token'],
|
||||
'todo_entity': value['todoEntity'],
|
||||
'enabled': value['enabled'],
|
||||
'on_shopping_list_entry_created_enabled': value['onShoppingListEntryCreatedEnabled'],
|
||||
'on_shopping_list_entry_updated_enabled': value['onShoppingListEntryUpdatedEnabled'],
|
||||
'on_shopping_list_entry_deleted_enabled': value['onShoppingListEntryDeletedEnabled'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { User } from './User';
|
||||
import {
|
||||
User,
|
||||
UserFromJSON,
|
||||
UserFromJSONTyped,
|
||||
UserToJSON,
|
||||
} from './';
|
||||
} from './User';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -43,19 +43,19 @@ export interface CookLog {
|
||||
* @type {number}
|
||||
* @memberof CookLog
|
||||
*/
|
||||
servings?: number | null;
|
||||
servings?: number;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof CookLog
|
||||
*/
|
||||
rating?: number | null;
|
||||
rating?: number;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof CookLog
|
||||
*/
|
||||
comment?: string | null;
|
||||
comment?: string;
|
||||
/**
|
||||
*
|
||||
* @type {User}
|
||||
@@ -76,42 +76,49 @@ export interface CookLog {
|
||||
readonly updatedAt: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the CookLog interface.
|
||||
*/
|
||||
export function instanceOfCookLog(value: object): boolean {
|
||||
if (!('id' in value)) return false;
|
||||
if (!('recipe' in value)) return false;
|
||||
if (!('createdBy' in value)) return false;
|
||||
if (!('updatedAt' in value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function CookLogFromJSON(json: any): CookLog {
|
||||
return CookLogFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function CookLogFromJSONTyped(json: any, ignoreDiscriminator: boolean): CookLog {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': json['id'],
|
||||
'recipe': json['recipe'],
|
||||
'servings': !exists(json, 'servings') ? undefined : json['servings'],
|
||||
'rating': !exists(json, 'rating') ? undefined : json['rating'],
|
||||
'comment': !exists(json, 'comment') ? undefined : json['comment'],
|
||||
'servings': json['servings'] == null ? undefined : json['servings'],
|
||||
'rating': json['rating'] == null ? undefined : json['rating'],
|
||||
'comment': json['comment'] == null ? undefined : json['comment'],
|
||||
'createdBy': UserFromJSON(json['created_by']),
|
||||
'createdAt': !exists(json, 'created_at') ? undefined : (new Date(json['created_at'])),
|
||||
'createdAt': json['created_at'] == null ? undefined : (new Date(json['created_at'])),
|
||||
'updatedAt': (new Date(json['updated_at'])),
|
||||
};
|
||||
}
|
||||
|
||||
export function CookLogToJSON(value?: CookLog | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'recipe': value.recipe,
|
||||
'servings': value.servings,
|
||||
'rating': value.rating,
|
||||
'comment': value.comment,
|
||||
'created_at': value.createdAt === undefined ? undefined : (value.createdAt.toISOString()),
|
||||
'recipe': value['recipe'],
|
||||
'servings': value['servings'],
|
||||
'rating': value['rating'],
|
||||
'comment': value['comment'],
|
||||
'created_at': value['createdAt'] == null ? undefined : ((value['createdAt']).toISOString()),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { User } from './User';
|
||||
import {
|
||||
User,
|
||||
UserFromJSON,
|
||||
UserFromJSONTyped,
|
||||
UserToJSON,
|
||||
} from './';
|
||||
} from './User';
|
||||
|
||||
/**
|
||||
* Adds nested create feature
|
||||
@@ -58,12 +58,23 @@ export interface CustomFilter {
|
||||
readonly createdBy: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the CustomFilter interface.
|
||||
*/
|
||||
export function instanceOfCustomFilter(value: object): boolean {
|
||||
if (!('id' in value)) return false;
|
||||
if (!('name' in value)) return false;
|
||||
if (!('search' in value)) return false;
|
||||
if (!('createdBy' in value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function CustomFilterFromJSON(json: any): CustomFilter {
|
||||
return CustomFilterFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function CustomFilterFromJSONTyped(json: any, ignoreDiscriminator: boolean): CustomFilter {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
@@ -71,24 +82,20 @@ export function CustomFilterFromJSONTyped(json: any, ignoreDiscriminator: boolea
|
||||
'id': json['id'],
|
||||
'name': json['name'],
|
||||
'search': json['search'],
|
||||
'shared': !exists(json, 'shared') ? undefined : ((json['shared'] as Array<any>).map(UserFromJSON)),
|
||||
'shared': json['shared'] == null ? undefined : ((json['shared'] as Array<any>).map(UserFromJSON)),
|
||||
'createdBy': json['created_by'],
|
||||
};
|
||||
}
|
||||
|
||||
export function CustomFilterToJSON(value?: CustomFilter | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'name': value.name,
|
||||
'search': value.search,
|
||||
'shared': value.shared === undefined ? undefined : ((value.shared as Array<any>).map(UserToJSON)),
|
||||
'name': value['name'],
|
||||
'search': value['search'],
|
||||
'shared': value['shared'] == null ? undefined : ((value['shared'] as Array<any>).map(UserToJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,20 +12,22 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* * `SEARCH` - Search
|
||||
* `PLAN` - Meal-Plan
|
||||
* `BOOKS` - Books
|
||||
* `SHOPPING` - Shopping
|
||||
* * `PLAN` - Meal-Plan
|
||||
* * `BOOKS` - Books
|
||||
* * `SHOPPING` - Shopping
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum DefaultPageEnum {
|
||||
Search = 'SEARCH',
|
||||
Plan = 'PLAN',
|
||||
Books = 'BOOKS',
|
||||
Shopping = 'SHOPPING'
|
||||
}
|
||||
export const DefaultPageEnum = {
|
||||
Search: 'SEARCH',
|
||||
Plan: 'PLAN',
|
||||
Books: 'BOOKS',
|
||||
Shopping: 'SHOPPING'
|
||||
} as const;
|
||||
export type DefaultPageEnum = typeof DefaultPageEnum[keyof typeof DefaultPageEnum];
|
||||
|
||||
|
||||
export function DefaultPageEnumFromJSON(json: any): DefaultPageEnum {
|
||||
return DefaultPageEnumFromJSONTyped(json, false);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
@@ -81,46 +81,53 @@ export interface ExportLog {
|
||||
readonly createdAt: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the ExportLog interface.
|
||||
*/
|
||||
export function instanceOfExportLog(value: object): boolean {
|
||||
if (!('id' in value)) return false;
|
||||
if (!('type' in value)) return false;
|
||||
if (!('createdBy' in value)) return false;
|
||||
if (!('createdAt' in value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function ExportLogFromJSON(json: any): ExportLog {
|
||||
return ExportLogFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function ExportLogFromJSONTyped(json: any, ignoreDiscriminator: boolean): ExportLog {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': json['id'],
|
||||
'type': json['type'],
|
||||
'msg': !exists(json, 'msg') ? undefined : json['msg'],
|
||||
'running': !exists(json, 'running') ? undefined : json['running'],
|
||||
'totalRecipes': !exists(json, 'total_recipes') ? undefined : json['total_recipes'],
|
||||
'exportedRecipes': !exists(json, 'exported_recipes') ? undefined : json['exported_recipes'],
|
||||
'cacheDuration': !exists(json, 'cache_duration') ? undefined : json['cache_duration'],
|
||||
'possiblyNotExpired': !exists(json, 'possibly_not_expired') ? undefined : json['possibly_not_expired'],
|
||||
'msg': json['msg'] == null ? undefined : json['msg'],
|
||||
'running': json['running'] == null ? undefined : json['running'],
|
||||
'totalRecipes': json['total_recipes'] == null ? undefined : json['total_recipes'],
|
||||
'exportedRecipes': json['exported_recipes'] == null ? undefined : json['exported_recipes'],
|
||||
'cacheDuration': json['cache_duration'] == null ? undefined : json['cache_duration'],
|
||||
'possiblyNotExpired': json['possibly_not_expired'] == null ? undefined : json['possibly_not_expired'],
|
||||
'createdBy': json['created_by'],
|
||||
'createdAt': (new Date(json['created_at'])),
|
||||
};
|
||||
}
|
||||
|
||||
export function ExportLogToJSON(value?: ExportLog | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'type': value.type,
|
||||
'msg': value.msg,
|
||||
'running': value.running,
|
||||
'total_recipes': value.totalRecipes,
|
||||
'exported_recipes': value.exportedRecipes,
|
||||
'cache_duration': value.cacheDuration,
|
||||
'possibly_not_expired': value.possiblyNotExpired,
|
||||
'type': value['type'],
|
||||
'msg': value['msg'],
|
||||
'running': value['running'],
|
||||
'total_recipes': value['totalRecipes'],
|
||||
'exported_recipes': value['exportedRecipes'],
|
||||
'cache_duration': value['cacheDuration'],
|
||||
'possibly_not_expired': value['possiblyNotExpired'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,70 +12,80 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { FoodInheritField } from './FoodInheritField';
|
||||
import {
|
||||
FoodInheritField,
|
||||
FoodInheritFieldFromJSON,
|
||||
FoodInheritFieldFromJSONTyped,
|
||||
FoodInheritFieldToJSON,
|
||||
FoodSimple,
|
||||
} from './FoodInheritField';
|
||||
import type { FoodSimple } from './FoodSimple';
|
||||
import {
|
||||
FoodSimpleFromJSON,
|
||||
FoodSimpleFromJSONTyped,
|
||||
FoodSimpleToJSON,
|
||||
Property,
|
||||
} from './FoodSimple';
|
||||
import type { Property } from './Property';
|
||||
import {
|
||||
PropertyFromJSON,
|
||||
PropertyFromJSONTyped,
|
||||
PropertyToJSON,
|
||||
RecipeSimple,
|
||||
} from './Property';
|
||||
import type { RecipeSimple } from './RecipeSimple';
|
||||
import {
|
||||
RecipeSimpleFromJSON,
|
||||
RecipeSimpleFromJSONTyped,
|
||||
RecipeSimpleToJSON,
|
||||
SupermarketCategory,
|
||||
} from './RecipeSimple';
|
||||
import type { SupermarketCategory } from './SupermarketCategory';
|
||||
import {
|
||||
SupermarketCategoryFromJSON,
|
||||
SupermarketCategoryFromJSONTyped,
|
||||
SupermarketCategoryToJSON,
|
||||
Unit,
|
||||
} from './SupermarketCategory';
|
||||
import type { Unit } from './Unit';
|
||||
import {
|
||||
UnitFromJSON,
|
||||
UnitFromJSONTyped,
|
||||
UnitToJSON,
|
||||
} from './';
|
||||
} 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.
|
||||
* 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
|
||||
*/
|
||||
@@ -97,7 +107,7 @@ export interface Food {
|
||||
* @type {string}
|
||||
* @memberof Food
|
||||
*/
|
||||
pluralName?: string | null;
|
||||
pluralName?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@@ -115,19 +125,19 @@ export interface Food {
|
||||
* @type {RecipeSimple}
|
||||
* @memberof Food
|
||||
*/
|
||||
recipe?: RecipeSimple | null;
|
||||
recipe?: RecipeSimple;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Food
|
||||
*/
|
||||
url?: string | null;
|
||||
url?: string;
|
||||
/**
|
||||
*
|
||||
* @type {Array<Property>}
|
||||
* @memberof Food
|
||||
*/
|
||||
properties?: Array<Property> | null;
|
||||
properties?: Array<Property>;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@@ -139,25 +149,25 @@ export interface Food {
|
||||
* @type {Unit}
|
||||
* @memberof Food
|
||||
*/
|
||||
propertiesFoodUnit?: Unit | null;
|
||||
propertiesFoodUnit?: Unit;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof Food
|
||||
*/
|
||||
fdcId?: number | null;
|
||||
fdcId?: number;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Food
|
||||
*/
|
||||
foodOnhand?: string | null;
|
||||
foodOnhand?: string;
|
||||
/**
|
||||
*
|
||||
* @type {SupermarketCategory}
|
||||
* @memberof Food
|
||||
*/
|
||||
supermarketCategory?: SupermarketCategory | null;
|
||||
supermarketCategory?: SupermarketCategory;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@@ -175,7 +185,7 @@ export interface Food {
|
||||
* @type {Array<FoodInheritField>}
|
||||
* @memberof Food
|
||||
*/
|
||||
inheritFields?: Array<FoodInheritField> | null;
|
||||
inheritFields?: Array<FoodInheritField>;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@@ -193,7 +203,7 @@ export interface Food {
|
||||
* @type {Array<FoodSimple>}
|
||||
* @memberof Food
|
||||
*/
|
||||
substitute?: Array<FoodSimple> | null;
|
||||
substitute?: Array<FoodSimple>;
|
||||
/**
|
||||
*
|
||||
* @type {boolean}
|
||||
@@ -217,13 +227,27 @@ export interface Food {
|
||||
* @type {Array<FoodInheritField>}
|
||||
* @memberof Food
|
||||
*/
|
||||
childInheritFields?: Array<FoodInheritField> | null;
|
||||
childInheritFields?: Array<FoodInheritField>;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Food
|
||||
*/
|
||||
openDataSlug?: string | null;
|
||||
openDataSlug?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the Food interface.
|
||||
*/
|
||||
export function instanceOfFood(value: object): boolean {
|
||||
if (!('id' in value)) return false;
|
||||
if (!('name' in value)) return false;
|
||||
if (!('shopping' in value)) return false;
|
||||
if (!('parent' in value)) return false;
|
||||
if (!('numchild' in value)) return false;
|
||||
if (!('fullName' in value)) return false;
|
||||
if (!('substituteOnhand' in value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function FoodFromJSON(json: any): Food {
|
||||
@@ -231,66 +255,62 @@ export function FoodFromJSON(json: any): Food {
|
||||
}
|
||||
|
||||
export function FoodFromJSONTyped(json: any, ignoreDiscriminator: boolean): Food {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': json['id'],
|
||||
'name': json['name'],
|
||||
'pluralName': !exists(json, 'plural_name') ? undefined : json['plural_name'],
|
||||
'description': !exists(json, 'description') ? undefined : json['description'],
|
||||
'pluralName': json['plural_name'] == null ? undefined : json['plural_name'],
|
||||
'description': json['description'] == null ? undefined : json['description'],
|
||||
'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(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']),
|
||||
'recipe': json['recipe'] == null ? undefined : RecipeSimpleFromJSON(json['recipe']),
|
||||
'url': json['url'] == null ? undefined : json['url'],
|
||||
'properties': json['properties'] == null ? undefined : ((json['properties'] as Array<any>).map(PropertyFromJSON)),
|
||||
'propertiesFoodAmount': json['properties_food_amount'] == null ? undefined : json['properties_food_amount'],
|
||||
'propertiesFoodUnit': json['properties_food_unit'] == null ? undefined : UnitFromJSON(json['properties_food_unit']),
|
||||
'fdcId': json['fdc_id'] == null ? undefined : json['fdc_id'],
|
||||
'foodOnhand': json['food_onhand'] == null ? undefined : json['food_onhand'],
|
||||
'supermarketCategory': json['supermarket_category'] == null ? 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)),
|
||||
'inheritFields': json['inherit_fields'] == null ? undefined : ((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(FoodSimpleFromJSON)),
|
||||
'substituteSiblings': !exists(json, 'substitute_siblings') ? undefined : json['substitute_siblings'],
|
||||
'substituteChildren': !exists(json, 'substitute_children') ? undefined : json['substitute_children'],
|
||||
'ignoreShopping': json['ignore_shopping'] == null ? undefined : json['ignore_shopping'],
|
||||
'substitute': json['substitute'] == null ? undefined : ((json['substitute'] as Array<any>).map(FoodSimpleFromJSON)),
|
||||
'substituteSiblings': json['substitute_siblings'] == null ? undefined : json['substitute_siblings'],
|
||||
'substituteChildren': json['substitute_children'] == null ? undefined : json['substitute_children'],
|
||||
'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'],
|
||||
'childInheritFields': json['child_inherit_fields'] == null ? undefined : ((json['child_inherit_fields'] as Array<any>).map(FoodInheritFieldFromJSON)),
|
||||
'openDataSlug': json['open_data_slug'] == null ? undefined : json['open_data_slug'],
|
||||
};
|
||||
}
|
||||
|
||||
export function FoodToJSON(value?: Food | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
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,
|
||||
'name': value['name'],
|
||||
'plural_name': value['pluralName'],
|
||||
'description': value['description'],
|
||||
'recipe': RecipeSimpleToJSON(value['recipe']),
|
||||
'url': value['url'],
|
||||
'properties': value['properties'] == null ? undefined : ((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'] == null ? undefined : ((value['inheritFields'] as Array<any>).map(FoodInheritFieldToJSON)),
|
||||
'ignore_shopping': value['ignoreShopping'],
|
||||
'substitute': value['substitute'] == null ? undefined : ((value['substitute'] as Array<any>).map(FoodSimpleToJSON)),
|
||||
'substitute_siblings': value['substituteSiblings'],
|
||||
'substitute_children': value['substituteChildren'],
|
||||
'child_inherit_fields': value['childInheritFields'] == null ? undefined : ((value['childInheritFields'] as Array<any>).map(FoodInheritFieldToJSON)),
|
||||
'open_data_slug': value['openDataSlug'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,43 +12,43 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
* 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 FoodInheritField
|
||||
*/
|
||||
@@ -64,13 +64,21 @@ export interface FoodInheritField {
|
||||
* @type {string}
|
||||
* @memberof FoodInheritField
|
||||
*/
|
||||
name?: string | null;
|
||||
name?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof FoodInheritField
|
||||
*/
|
||||
field?: string | null;
|
||||
field?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the FoodInheritField interface.
|
||||
*/
|
||||
export function instanceOfFoodInheritField(value: object): boolean {
|
||||
if (!('id' in value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function FoodInheritFieldFromJSON(json: any): FoodInheritField {
|
||||
@@ -78,29 +86,25 @@ export function FoodInheritFieldFromJSON(json: any): FoodInheritField {
|
||||
}
|
||||
|
||||
export function FoodInheritFieldFromJSONTyped(json: any, ignoreDiscriminator: boolean): FoodInheritField {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': json['id'],
|
||||
'name': !exists(json, 'name') ? undefined : json['name'],
|
||||
'field': !exists(json, 'field') ? undefined : json['field'],
|
||||
'name': json['name'] == null ? undefined : json['name'],
|
||||
'field': json['field'] == null ? undefined : json['field'],
|
||||
};
|
||||
}
|
||||
|
||||
export function FoodInheritFieldToJSON(value?: FoodInheritField | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'name': value.name,
|
||||
'field': value.field,
|
||||
'name': value['name'],
|
||||
'field': value['field'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
@@ -36,7 +36,16 @@ export interface FoodSimple {
|
||||
* @type {string}
|
||||
* @memberof FoodSimple
|
||||
*/
|
||||
pluralName?: string | null;
|
||||
pluralName?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the FoodSimple interface.
|
||||
*/
|
||||
export function instanceOfFoodSimple(value: object): boolean {
|
||||
if (!('id' in value)) return false;
|
||||
if (!('name' in value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function FoodSimpleFromJSON(json: any): FoodSimple {
|
||||
@@ -44,29 +53,25 @@ export function FoodSimpleFromJSON(json: any): FoodSimple {
|
||||
}
|
||||
|
||||
export function FoodSimpleFromJSONTyped(json: any, ignoreDiscriminator: boolean): FoodSimple {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': json['id'],
|
||||
'name': json['name'],
|
||||
'pluralName': !exists(json, 'plural_name') ? undefined : json['plural_name'],
|
||||
'pluralName': json['plural_name'] == null ? undefined : json['plural_name'],
|
||||
};
|
||||
}
|
||||
|
||||
export function FoodSimpleToJSON(value?: FoodSimple | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'name': value.name,
|
||||
'plural_name': value.pluralName,
|
||||
'name': value['name'],
|
||||
'plural_name': value['pluralName'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,43 +12,43 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
* 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 Group
|
||||
*/
|
||||
@@ -67,12 +67,21 @@ export interface Group {
|
||||
name: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the Group interface.
|
||||
*/
|
||||
export function instanceOfGroup(value: object): boolean {
|
||||
if (!('id' in value)) return false;
|
||||
if (!('name' in value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function GroupFromJSON(json: any): Group {
|
||||
return GroupFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function GroupFromJSONTyped(json: any, ignoreDiscriminator: boolean): Group {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
@@ -83,16 +92,12 @@ export function GroupFromJSONTyped(json: any, ignoreDiscriminator: boolean): Gro
|
||||
}
|
||||
|
||||
export function GroupToJSON(value?: Group | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'name': value.name,
|
||||
'name': value['name'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { Keyword } from './Keyword';
|
||||
import {
|
||||
Keyword,
|
||||
KeywordFromJSON,
|
||||
KeywordFromJSONTyped,
|
||||
KeywordToJSON,
|
||||
} from './';
|
||||
} from './Keyword';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -82,43 +82,51 @@ export interface ImportLog {
|
||||
readonly createdAt: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the ImportLog interface.
|
||||
*/
|
||||
export function instanceOfImportLog(value: object): boolean {
|
||||
if (!('id' in value)) return false;
|
||||
if (!('type' in value)) return false;
|
||||
if (!('keyword' in value)) return false;
|
||||
if (!('createdBy' in value)) return false;
|
||||
if (!('createdAt' in value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function ImportLogFromJSON(json: any): ImportLog {
|
||||
return ImportLogFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function ImportLogFromJSONTyped(json: any, ignoreDiscriminator: boolean): ImportLog {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': json['id'],
|
||||
'type': json['type'],
|
||||
'msg': !exists(json, 'msg') ? undefined : json['msg'],
|
||||
'running': !exists(json, 'running') ? undefined : json['running'],
|
||||
'msg': json['msg'] == null ? undefined : json['msg'],
|
||||
'running': json['running'] == null ? undefined : json['running'],
|
||||
'keyword': KeywordFromJSON(json['keyword']),
|
||||
'totalRecipes': !exists(json, 'total_recipes') ? undefined : json['total_recipes'],
|
||||
'importedRecipes': !exists(json, 'imported_recipes') ? undefined : json['imported_recipes'],
|
||||
'totalRecipes': json['total_recipes'] == null ? undefined : json['total_recipes'],
|
||||
'importedRecipes': json['imported_recipes'] == null ? undefined : json['imported_recipes'],
|
||||
'createdBy': json['created_by'],
|
||||
'createdAt': (new Date(json['created_at'])),
|
||||
};
|
||||
}
|
||||
|
||||
export function ImportLogToJSON(value?: ImportLog | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'type': value.type,
|
||||
'msg': value.msg,
|
||||
'running': value.running,
|
||||
'total_recipes': value.totalRecipes,
|
||||
'imported_recipes': value.importedRecipes,
|
||||
'type': value['type'],
|
||||
'msg': value['msg'],
|
||||
'running': value['running'],
|
||||
'total_recipes': value['totalRecipes'],
|
||||
'imported_recipes': value['importedRecipes'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,17 +12,19 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { Food } from './Food';
|
||||
import {
|
||||
Food,
|
||||
FoodFromJSON,
|
||||
FoodFromJSONTyped,
|
||||
FoodToJSON,
|
||||
Unit,
|
||||
} from './Food';
|
||||
import type { Unit } from './Unit';
|
||||
import {
|
||||
UnitFromJSON,
|
||||
UnitFromJSONTyped,
|
||||
UnitToJSON,
|
||||
} from './';
|
||||
} from './Unit';
|
||||
|
||||
/**
|
||||
* Adds nested create feature
|
||||
@@ -65,7 +67,7 @@ export interface Ingredient {
|
||||
* @type {string}
|
||||
* @memberof Ingredient
|
||||
*/
|
||||
note?: string | null;
|
||||
note?: string;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
@@ -89,7 +91,7 @@ export interface Ingredient {
|
||||
* @type {string}
|
||||
* @memberof Ingredient
|
||||
*/
|
||||
originalText?: string | null;
|
||||
originalText?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@@ -110,12 +112,25 @@ export interface Ingredient {
|
||||
alwaysUsePluralFood?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the Ingredient interface.
|
||||
*/
|
||||
export function instanceOfIngredient(value: object): boolean {
|
||||
if (!('id' in value)) return false;
|
||||
if (!('food' in value)) return false;
|
||||
if (!('unit' in value)) return false;
|
||||
if (!('amount' in value)) return false;
|
||||
if (!('conversions' in value)) return false;
|
||||
if (!('usedInRecipes' in value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function IngredientFromJSON(json: any): Ingredient {
|
||||
return IngredientFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function IngredientFromJSONTyped(json: any, ignoreDiscriminator: boolean): Ingredient {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
@@ -125,37 +140,33 @@ export function IngredientFromJSONTyped(json: any, ignoreDiscriminator: boolean)
|
||||
'unit': UnitFromJSON(json['unit']),
|
||||
'amount': json['amount'],
|
||||
'conversions': json['conversions'],
|
||||
'note': !exists(json, 'note') ? undefined : json['note'],
|
||||
'order': !exists(json, 'order') ? undefined : json['order'],
|
||||
'isHeader': !exists(json, 'is_header') ? undefined : json['is_header'],
|
||||
'noAmount': !exists(json, 'no_amount') ? undefined : json['no_amount'],
|
||||
'originalText': !exists(json, 'original_text') ? undefined : json['original_text'],
|
||||
'note': json['note'] == null ? undefined : json['note'],
|
||||
'order': json['order'] == null ? undefined : json['order'],
|
||||
'isHeader': json['is_header'] == null ? undefined : json['is_header'],
|
||||
'noAmount': json['no_amount'] == null ? undefined : json['no_amount'],
|
||||
'originalText': json['original_text'] == null ? undefined : json['original_text'],
|
||||
'usedInRecipes': json['used_in_recipes'],
|
||||
'alwaysUsePluralUnit': !exists(json, 'always_use_plural_unit') ? undefined : json['always_use_plural_unit'],
|
||||
'alwaysUsePluralFood': !exists(json, 'always_use_plural_food') ? undefined : json['always_use_plural_food'],
|
||||
'alwaysUsePluralUnit': json['always_use_plural_unit'] == null ? undefined : json['always_use_plural_unit'],
|
||||
'alwaysUsePluralFood': json['always_use_plural_food'] == null ? undefined : json['always_use_plural_food'],
|
||||
};
|
||||
}
|
||||
|
||||
export function IngredientToJSON(value?: Ingredient | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'food': FoodToJSON(value.food),
|
||||
'unit': UnitToJSON(value.unit),
|
||||
'amount': value.amount,
|
||||
'note': value.note,
|
||||
'order': value.order,
|
||||
'is_header': value.isHeader,
|
||||
'no_amount': value.noAmount,
|
||||
'original_text': value.originalText,
|
||||
'always_use_plural_unit': value.alwaysUsePluralUnit,
|
||||
'always_use_plural_food': value.alwaysUsePluralFood,
|
||||
'food': FoodToJSON(value['food']),
|
||||
'unit': UnitToJSON(value['unit']),
|
||||
'amount': value['amount'],
|
||||
'note': value['note'],
|
||||
'order': value['order'],
|
||||
'is_header': value['isHeader'],
|
||||
'no_amount': value['noAmount'],
|
||||
'original_text': value['originalText'],
|
||||
'always_use_plural_unit': value['alwaysUsePluralUnit'],
|
||||
'always_use_plural_food': value['alwaysUsePluralFood'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { Group } from './Group';
|
||||
import {
|
||||
Group,
|
||||
GroupFromJSON,
|
||||
GroupFromJSONTyped,
|
||||
GroupToJSON,
|
||||
} from './';
|
||||
} from './Group';
|
||||
|
||||
/**
|
||||
* Adds nested create feature
|
||||
@@ -61,7 +61,7 @@ export interface InviteLink {
|
||||
* @type {number}
|
||||
* @memberof InviteLink
|
||||
*/
|
||||
usedBy?: number | null;
|
||||
usedBy?: number;
|
||||
/**
|
||||
*
|
||||
* @type {boolean}
|
||||
@@ -73,7 +73,7 @@ export interface InviteLink {
|
||||
* @type {string}
|
||||
* @memberof InviteLink
|
||||
*/
|
||||
internalNote?: string | null;
|
||||
internalNote?: string;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
@@ -88,45 +88,53 @@ export interface InviteLink {
|
||||
readonly createdAt: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the InviteLink interface.
|
||||
*/
|
||||
export function instanceOfInviteLink(value: object): boolean {
|
||||
if (!('id' in value)) return false;
|
||||
if (!('uuid' in value)) return false;
|
||||
if (!('group' in value)) return false;
|
||||
if (!('createdBy' in value)) return false;
|
||||
if (!('createdAt' in value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function InviteLinkFromJSON(json: any): InviteLink {
|
||||
return InviteLinkFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function InviteLinkFromJSONTyped(json: any, ignoreDiscriminator: boolean): InviteLink {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': json['id'],
|
||||
'uuid': json['uuid'],
|
||||
'email': !exists(json, 'email') ? undefined : json['email'],
|
||||
'email': json['email'] == null ? undefined : json['email'],
|
||||
'group': GroupFromJSON(json['group']),
|
||||
'validUntil': !exists(json, 'valid_until') ? undefined : (new Date(json['valid_until'])),
|
||||
'usedBy': !exists(json, 'used_by') ? undefined : json['used_by'],
|
||||
'reusable': !exists(json, 'reusable') ? undefined : json['reusable'],
|
||||
'internalNote': !exists(json, 'internal_note') ? undefined : json['internal_note'],
|
||||
'validUntil': json['valid_until'] == null ? undefined : (new Date(json['valid_until'])),
|
||||
'usedBy': json['used_by'] == null ? undefined : json['used_by'],
|
||||
'reusable': json['reusable'] == null ? undefined : json['reusable'],
|
||||
'internalNote': json['internal_note'] == null ? undefined : json['internal_note'],
|
||||
'createdBy': json['created_by'],
|
||||
'createdAt': (new Date(json['created_at'])),
|
||||
};
|
||||
}
|
||||
|
||||
export function InviteLinkToJSON(value?: InviteLink | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'email': value.email,
|
||||
'group': GroupToJSON(value.group),
|
||||
'valid_until': value.validUntil === undefined ? undefined : (value.validUntil.toISOString().substr(0,10)),
|
||||
'used_by': value.usedBy,
|
||||
'reusable': value.reusable,
|
||||
'internal_note': value.internalNote,
|
||||
'email': value['email'],
|
||||
'group': GroupToJSON(value['group']),
|
||||
'valid_until': value['validUntil'] == null ? undefined : ((value['validUntil']).toISOString().substring(0,10)),
|
||||
'used_by': value['usedBy'],
|
||||
'reusable': value['reusable'],
|
||||
'internal_note': value['internalNote'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,43 +12,43 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
* 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 Keyword
|
||||
*/
|
||||
@@ -109,12 +109,27 @@ export interface Keyword {
|
||||
readonly fullName: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the Keyword interface.
|
||||
*/
|
||||
export function instanceOfKeyword(value: object): boolean {
|
||||
if (!('id' in value)) return false;
|
||||
if (!('name' in value)) return false;
|
||||
if (!('label' in value)) return false;
|
||||
if (!('parent' in value)) return false;
|
||||
if (!('numchild' in value)) return false;
|
||||
if (!('createdAt' in value)) return false;
|
||||
if (!('updatedAt' in value)) return false;
|
||||
if (!('fullName' in value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function KeywordFromJSON(json: any): Keyword {
|
||||
return KeywordFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function KeywordFromJSONTyped(json: any, ignoreDiscriminator: boolean): Keyword {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
@@ -122,7 +137,7 @@ export function KeywordFromJSONTyped(json: any, ignoreDiscriminator: boolean): K
|
||||
'id': json['id'],
|
||||
'name': json['name'],
|
||||
'label': json['label'],
|
||||
'description': !exists(json, 'description') ? undefined : json['description'],
|
||||
'description': json['description'] == null ? undefined : json['description'],
|
||||
'parent': json['parent'],
|
||||
'numchild': json['numchild'],
|
||||
'createdAt': (new Date(json['created_at'])),
|
||||
@@ -132,17 +147,13 @@ export function KeywordFromJSONTyped(json: any, ignoreDiscriminator: boolean): K
|
||||
}
|
||||
|
||||
export function KeywordToJSON(value?: Keyword | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'name': value.name,
|
||||
'description': value.description,
|
||||
'name': value['name'],
|
||||
'description': value['description'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
@@ -33,12 +33,21 @@ export interface KeywordLabel {
|
||||
readonly label: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the KeywordLabel interface.
|
||||
*/
|
||||
export function instanceOfKeywordLabel(value: object): boolean {
|
||||
if (!('id' in value)) return false;
|
||||
if (!('label' in value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function KeywordLabelFromJSON(json: any): KeywordLabel {
|
||||
return KeywordLabelFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function KeywordLabelFromJSONTyped(json: any, ignoreDiscriminator: boolean): KeywordLabel {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
@@ -49,15 +58,11 @@ export function KeywordLabelFromJSONTyped(json: any, ignoreDiscriminator: boolea
|
||||
}
|
||||
|
||||
export function KeywordLabelToJSON(value?: KeywordLabel | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,21 +12,25 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { MealType } from './MealType';
|
||||
import {
|
||||
MealType,
|
||||
MealTypeFromJSON,
|
||||
MealTypeFromJSONTyped,
|
||||
MealTypeToJSON,
|
||||
RecipeOverview,
|
||||
} from './MealType';
|
||||
import type { RecipeOverview } from './RecipeOverview';
|
||||
import {
|
||||
RecipeOverviewFromJSON,
|
||||
RecipeOverviewFromJSONTyped,
|
||||
RecipeOverviewToJSON,
|
||||
User,
|
||||
} from './RecipeOverview';
|
||||
import type { User } from './User';
|
||||
import {
|
||||
UserFromJSON,
|
||||
UserFromJSONTyped,
|
||||
UserToJSON,
|
||||
} from './';
|
||||
} from './User';
|
||||
|
||||
/**
|
||||
* Adds nested create feature
|
||||
@@ -51,7 +55,7 @@ export interface MealPlan {
|
||||
* @type {RecipeOverview}
|
||||
* @memberof MealPlan
|
||||
*/
|
||||
recipe?: RecipeOverview | null;
|
||||
recipe?: RecipeOverview;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@@ -99,7 +103,7 @@ export interface MealPlan {
|
||||
* @type {Array<User>}
|
||||
* @memberof MealPlan
|
||||
*/
|
||||
shared?: Array<User> | null;
|
||||
shared?: Array<User>;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@@ -120,27 +124,43 @@ export interface MealPlan {
|
||||
readonly shopping: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the MealPlan interface.
|
||||
*/
|
||||
export function instanceOfMealPlan(value: object): boolean {
|
||||
if (!('id' in value)) return false;
|
||||
if (!('servings' in value)) return false;
|
||||
if (!('noteMarkdown' in value)) return false;
|
||||
if (!('fromDate' in value)) return false;
|
||||
if (!('mealType' in value)) return false;
|
||||
if (!('createdBy' in value)) return false;
|
||||
if (!('recipeName' in value)) return false;
|
||||
if (!('mealTypeName' in value)) return false;
|
||||
if (!('shopping' in value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function MealPlanFromJSON(json: any): MealPlan {
|
||||
return MealPlanFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function MealPlanFromJSONTyped(json: any, ignoreDiscriminator: boolean): MealPlan {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': json['id'],
|
||||
'title': !exists(json, 'title') ? undefined : json['title'],
|
||||
'recipe': !exists(json, 'recipe') ? undefined : RecipeOverviewFromJSON(json['recipe']),
|
||||
'title': json['title'] == null ? undefined : json['title'],
|
||||
'recipe': json['recipe'] == null ? undefined : RecipeOverviewFromJSON(json['recipe']),
|
||||
'servings': json['servings'],
|
||||
'note': !exists(json, 'note') ? undefined : json['note'],
|
||||
'note': json['note'] == null ? undefined : json['note'],
|
||||
'noteMarkdown': json['note_markdown'],
|
||||
'fromDate': (new Date(json['from_date'])),
|
||||
'toDate': !exists(json, 'to_date') ? undefined : (new Date(json['to_date'])),
|
||||
'toDate': json['to_date'] == null ? undefined : (new Date(json['to_date'])),
|
||||
'mealType': MealTypeFromJSON(json['meal_type']),
|
||||
'createdBy': json['created_by'],
|
||||
'shared': !exists(json, 'shared') ? undefined : (json['shared'] === null ? null : (json['shared'] as Array<any>).map(UserFromJSON)),
|
||||
'shared': json['shared'] == null ? undefined : ((json['shared'] as Array<any>).map(UserFromJSON)),
|
||||
'recipeName': json['recipe_name'],
|
||||
'mealTypeName': json['meal_type_name'],
|
||||
'shopping': json['shopping'],
|
||||
@@ -148,23 +168,19 @@ export function MealPlanFromJSONTyped(json: any, ignoreDiscriminator: boolean):
|
||||
}
|
||||
|
||||
export function MealPlanToJSON(value?: MealPlan | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'title': value.title,
|
||||
'recipe': RecipeOverviewToJSON(value.recipe),
|
||||
'servings': value.servings,
|
||||
'note': value.note,
|
||||
'from_date': (value.fromDate.toISOString().substr(0,10)),
|
||||
'to_date': value.toDate === undefined ? undefined : (value.toDate.toISOString().substr(0,10)),
|
||||
'meal_type': MealTypeToJSON(value.mealType),
|
||||
'shared': value.shared === undefined ? undefined : (value.shared === null ? null : (value.shared as Array<any>).map(UserToJSON)),
|
||||
'title': value['title'],
|
||||
'recipe': RecipeOverviewToJSON(value['recipe']),
|
||||
'servings': value['servings'],
|
||||
'note': value['note'],
|
||||
'from_date': ((value['fromDate']).toISOString().substring(0,10)),
|
||||
'to_date': value['toDate'] == null ? undefined : ((value['toDate']).toISOString().substring(0,10)),
|
||||
'meal_type': MealTypeToJSON(value['mealType']),
|
||||
'shared': value['shared'] == null ? undefined : ((value['shared'] as Array<any>).map(UserToJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
* Adds nested create feature
|
||||
* @export
|
||||
@@ -42,7 +42,7 @@ export interface MealType {
|
||||
* @type {string}
|
||||
* @memberof MealType
|
||||
*/
|
||||
color?: string | null;
|
||||
color?: string;
|
||||
/**
|
||||
*
|
||||
* @type {boolean}
|
||||
@@ -57,39 +57,45 @@ export interface MealType {
|
||||
readonly createdBy: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the MealType interface.
|
||||
*/
|
||||
export function instanceOfMealType(value: object): boolean {
|
||||
if (!('id' in value)) return false;
|
||||
if (!('name' in value)) return false;
|
||||
if (!('createdBy' in value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function MealTypeFromJSON(json: any): MealType {
|
||||
return MealTypeFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function MealTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): MealType {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': json['id'],
|
||||
'name': json['name'],
|
||||
'order': !exists(json, 'order') ? undefined : json['order'],
|
||||
'color': !exists(json, 'color') ? undefined : json['color'],
|
||||
'_default': !exists(json, 'default') ? undefined : json['default'],
|
||||
'order': json['order'] == null ? undefined : json['order'],
|
||||
'color': json['color'] == null ? undefined : json['color'],
|
||||
'_default': json['default'] == null ? undefined : json['default'],
|
||||
'createdBy': json['created_by'],
|
||||
};
|
||||
}
|
||||
|
||||
export function MealTypeToJSON(value?: MealType | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'name': value.name,
|
||||
'order': value.order,
|
||||
'color': value.color,
|
||||
'default': value._default,
|
||||
'name': value['name'],
|
||||
'order': value['order'],
|
||||
'color': value['color'],
|
||||
'default': value['_default'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,18 +12,20 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* * `DB` - Dropbox
|
||||
* `NEXTCLOUD` - Nextcloud
|
||||
* `LOCAL` - Local
|
||||
* * `NEXTCLOUD` - Nextcloud
|
||||
* * `LOCAL` - Local
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum MethodEnum {
|
||||
Db = 'DB',
|
||||
Nextcloud = 'NEXTCLOUD',
|
||||
Local = 'LOCAL'
|
||||
}
|
||||
export const MethodEnum = {
|
||||
Db: 'DB',
|
||||
Nextcloud: 'NEXTCLOUD',
|
||||
Local: 'LOCAL'
|
||||
} as const;
|
||||
export type MethodEnum = typeof MethodEnum[keyof typeof MethodEnum];
|
||||
|
||||
|
||||
export function MethodEnumFromJSON(json: any): MethodEnum {
|
||||
return MethodEnumFromJSONTyped(json, false);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
@@ -54,7 +54,19 @@ export interface NutritionInformation {
|
||||
* @type {string}
|
||||
* @memberof NutritionInformation
|
||||
*/
|
||||
source?: string | null;
|
||||
source?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the NutritionInformation interface.
|
||||
*/
|
||||
export function instanceOfNutritionInformation(value: object): boolean {
|
||||
if (!('id' in value)) return false;
|
||||
if (!('carbohydrates' in value)) return false;
|
||||
if (!('fats' in value)) return false;
|
||||
if (!('proteins' in value)) return false;
|
||||
if (!('calories' in value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function NutritionInformationFromJSON(json: any): NutritionInformation {
|
||||
@@ -62,7 +74,7 @@ export function NutritionInformationFromJSON(json: any): NutritionInformation {
|
||||
}
|
||||
|
||||
export function NutritionInformationFromJSONTyped(json: any, ignoreDiscriminator: boolean): NutritionInformation {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
@@ -72,25 +84,21 @@ export function NutritionInformationFromJSONTyped(json: any, ignoreDiscriminator
|
||||
'fats': json['fats'],
|
||||
'proteins': json['proteins'],
|
||||
'calories': json['calories'],
|
||||
'source': !exists(json, 'source') ? undefined : json['source'],
|
||||
'source': json['source'] == null ? undefined : json['source'],
|
||||
};
|
||||
}
|
||||
|
||||
export function NutritionInformationToJSON(value?: NutritionInformation | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'carbohydrates': value.carbohydrates,
|
||||
'fats': value.fats,
|
||||
'proteins': value.proteins,
|
||||
'calories': value.calories,
|
||||
'source': value.source,
|
||||
'carbohydrates': value['carbohydrates'],
|
||||
'fats': value['fats'],
|
||||
'proteins': value['proteins'],
|
||||
'calories': value['calories'],
|
||||
'source': value['source'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,50 +12,50 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { OpenDataVersion } from './OpenDataVersion';
|
||||
import {
|
||||
OpenDataVersion,
|
||||
OpenDataVersionFromJSON,
|
||||
OpenDataVersionFromJSONTyped,
|
||||
OpenDataVersionToJSON,
|
||||
} from './';
|
||||
} from './OpenDataVersion';
|
||||
|
||||
/**
|
||||
* 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 OpenDataCategory
|
||||
*/
|
||||
@@ -104,12 +104,24 @@ export interface OpenDataCategory {
|
||||
readonly createdBy: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the OpenDataCategory interface.
|
||||
*/
|
||||
export function instanceOfOpenDataCategory(value: object): boolean {
|
||||
if (!('id' in value)) return false;
|
||||
if (!('version' in value)) return false;
|
||||
if (!('slug' in value)) return false;
|
||||
if (!('name' in value)) return false;
|
||||
if (!('createdBy' in value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function OpenDataCategoryFromJSON(json: any): OpenDataCategory {
|
||||
return OpenDataCategoryFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function OpenDataCategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): OpenDataCategory {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
@@ -118,27 +130,23 @@ export function OpenDataCategoryFromJSONTyped(json: any, ignoreDiscriminator: bo
|
||||
'version': OpenDataVersionFromJSON(json['version']),
|
||||
'slug': json['slug'],
|
||||
'name': json['name'],
|
||||
'description': !exists(json, 'description') ? undefined : json['description'],
|
||||
'comment': !exists(json, 'comment') ? undefined : json['comment'],
|
||||
'description': json['description'] == null ? undefined : json['description'],
|
||||
'comment': json['comment'] == null ? undefined : json['comment'],
|
||||
'createdBy': json['created_by'],
|
||||
};
|
||||
}
|
||||
|
||||
export function OpenDataCategoryToJSON(value?: OpenDataCategory | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'version': OpenDataVersionToJSON(value.version),
|
||||
'slug': value.slug,
|
||||
'name': value.name,
|
||||
'description': value.description,
|
||||
'comment': value.comment,
|
||||
'version': OpenDataVersionToJSON(value['version']),
|
||||
'slug': value['slug'],
|
||||
'name': value['name'],
|
||||
'description': value['description'],
|
||||
'comment': value['comment'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,21 +12,25 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { OpenDataFood } from './OpenDataFood';
|
||||
import {
|
||||
OpenDataFood,
|
||||
OpenDataFoodFromJSON,
|
||||
OpenDataFoodFromJSONTyped,
|
||||
OpenDataFoodToJSON,
|
||||
OpenDataUnit,
|
||||
} from './OpenDataFood';
|
||||
import type { OpenDataUnit } from './OpenDataUnit';
|
||||
import {
|
||||
OpenDataUnitFromJSON,
|
||||
OpenDataUnitFromJSONTyped,
|
||||
OpenDataUnitToJSON,
|
||||
OpenDataVersion,
|
||||
} from './OpenDataUnit';
|
||||
import type { OpenDataVersion } from './OpenDataVersion';
|
||||
import {
|
||||
OpenDataVersionFromJSON,
|
||||
OpenDataVersionFromJSONTyped,
|
||||
OpenDataVersionToJSON,
|
||||
} from './';
|
||||
} from './OpenDataVersion';
|
||||
|
||||
/**
|
||||
* Adds nested create feature
|
||||
@@ -102,12 +106,29 @@ export interface OpenDataConversion {
|
||||
readonly createdBy: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the OpenDataConversion interface.
|
||||
*/
|
||||
export function instanceOfOpenDataConversion(value: object): boolean {
|
||||
if (!('id' in value)) return false;
|
||||
if (!('version' in value)) return false;
|
||||
if (!('slug' in value)) return false;
|
||||
if (!('food' in value)) return false;
|
||||
if (!('baseAmount' in value)) return false;
|
||||
if (!('baseUnit' in value)) return false;
|
||||
if (!('convertedAmount' in value)) return false;
|
||||
if (!('convertedUnit' in value)) return false;
|
||||
if (!('source' in value)) return false;
|
||||
if (!('createdBy' in value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function OpenDataConversionFromJSON(json: any): OpenDataConversion {
|
||||
return OpenDataConversionFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function OpenDataConversionFromJSONTyped(json: any, ignoreDiscriminator: boolean): OpenDataConversion {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
@@ -121,30 +142,26 @@ export function OpenDataConversionFromJSONTyped(json: any, ignoreDiscriminator:
|
||||
'convertedAmount': json['converted_amount'],
|
||||
'convertedUnit': OpenDataUnitFromJSON(json['converted_unit']),
|
||||
'source': json['source'],
|
||||
'comment': !exists(json, 'comment') ? undefined : json['comment'],
|
||||
'comment': json['comment'] == null ? undefined : json['comment'],
|
||||
'createdBy': json['created_by'],
|
||||
};
|
||||
}
|
||||
|
||||
export function OpenDataConversionToJSON(value?: OpenDataConversion | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'version': OpenDataVersionToJSON(value.version),
|
||||
'slug': value.slug,
|
||||
'food': OpenDataFoodToJSON(value.food),
|
||||
'base_amount': value.baseAmount,
|
||||
'base_unit': OpenDataUnitToJSON(value.baseUnit),
|
||||
'converted_amount': value.convertedAmount,
|
||||
'converted_unit': OpenDataUnitToJSON(value.convertedUnit),
|
||||
'source': value.source,
|
||||
'comment': value.comment,
|
||||
'version': OpenDataVersionToJSON(value['version']),
|
||||
'slug': value['slug'],
|
||||
'food': OpenDataFoodToJSON(value['food']),
|
||||
'base_amount': value['baseAmount'],
|
||||
'base_unit': OpenDataUnitToJSON(value['baseUnit']),
|
||||
'converted_amount': value['convertedAmount'],
|
||||
'converted_unit': OpenDataUnitToJSON(value['convertedUnit']),
|
||||
'source': value['source'],
|
||||
'comment': value['comment'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,62 +12,68 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { OpenDataCategory } from './OpenDataCategory';
|
||||
import {
|
||||
OpenDataCategory,
|
||||
OpenDataCategoryFromJSON,
|
||||
OpenDataCategoryFromJSONTyped,
|
||||
OpenDataCategoryToJSON,
|
||||
OpenDataFoodProperty,
|
||||
} from './OpenDataCategory';
|
||||
import type { OpenDataFoodProperty } from './OpenDataFoodProperty';
|
||||
import {
|
||||
OpenDataFoodPropertyFromJSON,
|
||||
OpenDataFoodPropertyFromJSONTyped,
|
||||
OpenDataFoodPropertyToJSON,
|
||||
OpenDataUnit,
|
||||
} from './OpenDataFoodProperty';
|
||||
import type { OpenDataUnit } from './OpenDataUnit';
|
||||
import {
|
||||
OpenDataUnitFromJSON,
|
||||
OpenDataUnitFromJSONTyped,
|
||||
OpenDataUnitToJSON,
|
||||
OpenDataVersion,
|
||||
} from './OpenDataUnit';
|
||||
import type { OpenDataVersion } from './OpenDataVersion';
|
||||
import {
|
||||
OpenDataVersionFromJSON,
|
||||
OpenDataVersionFromJSONTyped,
|
||||
OpenDataVersionToJSON,
|
||||
} from './';
|
||||
} from './OpenDataVersion';
|
||||
|
||||
/**
|
||||
* 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 OpenDataFood
|
||||
*/
|
||||
@@ -113,25 +119,25 @@ export interface OpenDataFood {
|
||||
* @type {OpenDataUnit}
|
||||
* @memberof OpenDataFood
|
||||
*/
|
||||
preferredUnitMetric?: OpenDataUnit | null;
|
||||
preferredUnitMetric?: OpenDataUnit;
|
||||
/**
|
||||
*
|
||||
* @type {OpenDataUnit}
|
||||
* @memberof OpenDataFood
|
||||
*/
|
||||
preferredShoppingUnitMetric?: OpenDataUnit | null;
|
||||
preferredShoppingUnitMetric?: OpenDataUnit;
|
||||
/**
|
||||
*
|
||||
* @type {OpenDataUnit}
|
||||
* @memberof OpenDataFood
|
||||
*/
|
||||
preferredUnitImperial?: OpenDataUnit | null;
|
||||
preferredUnitImperial?: OpenDataUnit;
|
||||
/**
|
||||
*
|
||||
* @type {OpenDataUnit}
|
||||
* @memberof OpenDataFood
|
||||
*/
|
||||
preferredShoppingUnitImperial?: OpenDataUnit | null;
|
||||
preferredShoppingUnitImperial?: OpenDataUnit;
|
||||
/**
|
||||
*
|
||||
* @type {Array<OpenDataFoodProperty>}
|
||||
@@ -176,12 +182,29 @@ export interface OpenDataFood {
|
||||
readonly createdBy: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the OpenDataFood interface.
|
||||
*/
|
||||
export function instanceOfOpenDataFood(value: object): boolean {
|
||||
if (!('id' in value)) return false;
|
||||
if (!('version' in value)) return false;
|
||||
if (!('slug' in value)) return false;
|
||||
if (!('name' in value)) return false;
|
||||
if (!('pluralName' in value)) return false;
|
||||
if (!('storeCategory' in value)) return false;
|
||||
if (!('properties' in value)) return false;
|
||||
if (!('propertiesFoodUnit' in value)) return false;
|
||||
if (!('fdcId' in value)) return false;
|
||||
if (!('createdBy' in value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function OpenDataFoodFromJSON(json: any): OpenDataFood {
|
||||
return OpenDataFoodFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function OpenDataFoodFromJSONTyped(json: any, ignoreDiscriminator: boolean): OpenDataFood {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
@@ -192,45 +215,41 @@ export function OpenDataFoodFromJSONTyped(json: any, ignoreDiscriminator: boolea
|
||||
'name': json['name'],
|
||||
'pluralName': json['plural_name'],
|
||||
'storeCategory': OpenDataCategoryFromJSON(json['store_category']),
|
||||
'preferredUnitMetric': !exists(json, 'preferred_unit_metric') ? undefined : OpenDataUnitFromJSON(json['preferred_unit_metric']),
|
||||
'preferredShoppingUnitMetric': !exists(json, 'preferred_shopping_unit_metric') ? undefined : OpenDataUnitFromJSON(json['preferred_shopping_unit_metric']),
|
||||
'preferredUnitImperial': !exists(json, 'preferred_unit_imperial') ? undefined : OpenDataUnitFromJSON(json['preferred_unit_imperial']),
|
||||
'preferredShoppingUnitImperial': !exists(json, 'preferred_shopping_unit_imperial') ? undefined : OpenDataUnitFromJSON(json['preferred_shopping_unit_imperial']),
|
||||
'properties': (json['properties'] === null ? null : (json['properties'] as Array<any>).map(OpenDataFoodPropertyFromJSON)),
|
||||
'propertiesFoodAmount': !exists(json, 'properties_food_amount') ? undefined : json['properties_food_amount'],
|
||||
'preferredUnitMetric': json['preferred_unit_metric'] == null ? undefined : OpenDataUnitFromJSON(json['preferred_unit_metric']),
|
||||
'preferredShoppingUnitMetric': json['preferred_shopping_unit_metric'] == null ? undefined : OpenDataUnitFromJSON(json['preferred_shopping_unit_metric']),
|
||||
'preferredUnitImperial': json['preferred_unit_imperial'] == null ? undefined : OpenDataUnitFromJSON(json['preferred_unit_imperial']),
|
||||
'preferredShoppingUnitImperial': json['preferred_shopping_unit_imperial'] == null ? undefined : OpenDataUnitFromJSON(json['preferred_shopping_unit_imperial']),
|
||||
'properties': (json['properties'] == null ? null : (json['properties'] as Array<any>).map(OpenDataFoodPropertyFromJSON)),
|
||||
'propertiesFoodAmount': json['properties_food_amount'] == null ? undefined : json['properties_food_amount'],
|
||||
'propertiesFoodUnit': OpenDataUnitFromJSON(json['properties_food_unit']),
|
||||
'propertiesSource': !exists(json, 'properties_source') ? undefined : json['properties_source'],
|
||||
'propertiesSource': json['properties_source'] == null ? undefined : json['properties_source'],
|
||||
'fdcId': json['fdc_id'],
|
||||
'comment': !exists(json, 'comment') ? undefined : json['comment'],
|
||||
'comment': json['comment'] == null ? undefined : json['comment'],
|
||||
'createdBy': json['created_by'],
|
||||
};
|
||||
}
|
||||
|
||||
export function OpenDataFoodToJSON(value?: OpenDataFood | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'version': OpenDataVersionToJSON(value.version),
|
||||
'slug': value.slug,
|
||||
'name': value.name,
|
||||
'plural_name': value.pluralName,
|
||||
'store_category': OpenDataCategoryToJSON(value.storeCategory),
|
||||
'preferred_unit_metric': OpenDataUnitToJSON(value.preferredUnitMetric),
|
||||
'preferred_shopping_unit_metric': OpenDataUnitToJSON(value.preferredShoppingUnitMetric),
|
||||
'preferred_unit_imperial': OpenDataUnitToJSON(value.preferredUnitImperial),
|
||||
'preferred_shopping_unit_imperial': OpenDataUnitToJSON(value.preferredShoppingUnitImperial),
|
||||
'properties': (value.properties === null ? null : (value.properties as Array<any>).map(OpenDataFoodPropertyToJSON)),
|
||||
'properties_food_amount': value.propertiesFoodAmount,
|
||||
'properties_food_unit': OpenDataUnitToJSON(value.propertiesFoodUnit),
|
||||
'properties_source': value.propertiesSource,
|
||||
'fdc_id': value.fdcId,
|
||||
'comment': value.comment,
|
||||
'version': OpenDataVersionToJSON(value['version']),
|
||||
'slug': value['slug'],
|
||||
'name': value['name'],
|
||||
'plural_name': value['pluralName'],
|
||||
'store_category': OpenDataCategoryToJSON(value['storeCategory']),
|
||||
'preferred_unit_metric': OpenDataUnitToJSON(value['preferredUnitMetric']),
|
||||
'preferred_shopping_unit_metric': OpenDataUnitToJSON(value['preferredShoppingUnitMetric']),
|
||||
'preferred_unit_imperial': OpenDataUnitToJSON(value['preferredUnitImperial']),
|
||||
'preferred_shopping_unit_imperial': OpenDataUnitToJSON(value['preferredShoppingUnitImperial']),
|
||||
'properties': (value['properties'] == null ? null : (value['properties'] as Array<any>).map(OpenDataFoodPropertyToJSON)),
|
||||
'properties_food_amount': value['propertiesFoodAmount'],
|
||||
'properties_food_unit': OpenDataUnitToJSON(value['propertiesFoodUnit']),
|
||||
'properties_source': value['propertiesSource'],
|
||||
'fdc_id': value['fdcId'],
|
||||
'comment': value['comment'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { OpenDataProperty } from './OpenDataProperty';
|
||||
import {
|
||||
OpenDataProperty,
|
||||
OpenDataPropertyFromJSON,
|
||||
OpenDataPropertyFromJSONTyped,
|
||||
OpenDataPropertyToJSON,
|
||||
} from './';
|
||||
} from './OpenDataProperty';
|
||||
|
||||
/**
|
||||
* Adds nested create feature
|
||||
@@ -46,12 +46,22 @@ export interface OpenDataFoodProperty {
|
||||
propertyAmount: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the OpenDataFoodProperty interface.
|
||||
*/
|
||||
export function instanceOfOpenDataFoodProperty(value: object): boolean {
|
||||
if (!('id' in value)) return false;
|
||||
if (!('property' in value)) return false;
|
||||
if (!('propertyAmount' in value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function OpenDataFoodPropertyFromJSON(json: any): OpenDataFoodProperty {
|
||||
return OpenDataFoodPropertyFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function OpenDataFoodPropertyFromJSONTyped(json: any, ignoreDiscriminator: boolean): OpenDataFoodProperty {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
@@ -63,17 +73,13 @@ export function OpenDataFoodPropertyFromJSONTyped(json: any, ignoreDiscriminator
|
||||
}
|
||||
|
||||
export function OpenDataFoodPropertyToJSON(value?: OpenDataFoodProperty | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'property': OpenDataPropertyToJSON(value.property),
|
||||
'property_amount': value.propertyAmount,
|
||||
'property': OpenDataPropertyToJSON(value['property']),
|
||||
'property_amount': value['propertyAmount'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,50 +12,50 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { OpenDataVersion } from './OpenDataVersion';
|
||||
import {
|
||||
OpenDataVersion,
|
||||
OpenDataVersionFromJSON,
|
||||
OpenDataVersionFromJSONTyped,
|
||||
OpenDataVersionToJSON,
|
||||
} from './';
|
||||
} from './OpenDataVersion';
|
||||
|
||||
/**
|
||||
* 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 OpenDataProperty
|
||||
*/
|
||||
@@ -95,7 +95,7 @@ export interface OpenDataProperty {
|
||||
* @type {number}
|
||||
* @memberof OpenDataProperty
|
||||
*/
|
||||
fdcId?: number | null;
|
||||
fdcId?: number;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@@ -110,12 +110,24 @@ export interface OpenDataProperty {
|
||||
readonly createdBy: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the OpenDataProperty interface.
|
||||
*/
|
||||
export function instanceOfOpenDataProperty(value: object): boolean {
|
||||
if (!('id' in value)) return false;
|
||||
if (!('version' in value)) return false;
|
||||
if (!('slug' in value)) return false;
|
||||
if (!('name' in value)) return false;
|
||||
if (!('createdBy' in value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function OpenDataPropertyFromJSON(json: any): OpenDataProperty {
|
||||
return OpenDataPropertyFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function OpenDataPropertyFromJSONTyped(json: any, ignoreDiscriminator: boolean): OpenDataProperty {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
@@ -124,29 +136,25 @@ export function OpenDataPropertyFromJSONTyped(json: any, ignoreDiscriminator: bo
|
||||
'version': OpenDataVersionFromJSON(json['version']),
|
||||
'slug': json['slug'],
|
||||
'name': json['name'],
|
||||
'unit': !exists(json, 'unit') ? undefined : json['unit'],
|
||||
'fdcId': !exists(json, 'fdc_id') ? undefined : json['fdc_id'],
|
||||
'comment': !exists(json, 'comment') ? undefined : json['comment'],
|
||||
'unit': json['unit'] == null ? undefined : json['unit'],
|
||||
'fdcId': json['fdc_id'] == null ? undefined : json['fdc_id'],
|
||||
'comment': json['comment'] == null ? undefined : json['comment'],
|
||||
'createdBy': json['created_by'],
|
||||
};
|
||||
}
|
||||
|
||||
export function OpenDataPropertyToJSON(value?: OpenDataProperty | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'version': OpenDataVersionToJSON(value.version),
|
||||
'slug': value.slug,
|
||||
'name': value.name,
|
||||
'unit': value.unit,
|
||||
'fdc_id': value.fdcId,
|
||||
'comment': value.comment,
|
||||
'version': OpenDataVersionToJSON(value['version']),
|
||||
'slug': value['slug'],
|
||||
'name': value['name'],
|
||||
'unit': value['unit'],
|
||||
'fdc_id': value['fdcId'],
|
||||
'comment': value['comment'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,17 +12,19 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { OpenDataStoreCategory } from './OpenDataStoreCategory';
|
||||
import {
|
||||
OpenDataStoreCategory,
|
||||
OpenDataStoreCategoryFromJSON,
|
||||
OpenDataStoreCategoryFromJSONTyped,
|
||||
OpenDataStoreCategoryToJSON,
|
||||
OpenDataVersion,
|
||||
} from './OpenDataStoreCategory';
|
||||
import type { OpenDataVersion } from './OpenDataVersion';
|
||||
import {
|
||||
OpenDataVersionFromJSON,
|
||||
OpenDataVersionFromJSONTyped,
|
||||
OpenDataVersionToJSON,
|
||||
} from './';
|
||||
} from './OpenDataVersion';
|
||||
|
||||
/**
|
||||
* Adds nested create feature
|
||||
@@ -74,12 +76,25 @@ export interface OpenDataStore {
|
||||
readonly createdBy: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the OpenDataStore interface.
|
||||
*/
|
||||
export function instanceOfOpenDataStore(value: object): boolean {
|
||||
if (!('id' in value)) return false;
|
||||
if (!('version' in value)) return false;
|
||||
if (!('slug' in value)) return false;
|
||||
if (!('name' in value)) return false;
|
||||
if (!('categoryToStore' in value)) return false;
|
||||
if (!('createdBy' in value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function OpenDataStoreFromJSON(json: any): OpenDataStore {
|
||||
return OpenDataStoreFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function OpenDataStoreFromJSONTyped(json: any, ignoreDiscriminator: boolean): OpenDataStore {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
@@ -88,27 +103,23 @@ export function OpenDataStoreFromJSONTyped(json: any, ignoreDiscriminator: boole
|
||||
'version': OpenDataVersionFromJSON(json['version']),
|
||||
'slug': json['slug'],
|
||||
'name': json['name'],
|
||||
'categoryToStore': (json['category_to_store'] === null ? null : (json['category_to_store'] as Array<any>).map(OpenDataStoreCategoryFromJSON)),
|
||||
'comment': !exists(json, 'comment') ? undefined : json['comment'],
|
||||
'categoryToStore': (json['category_to_store'] == null ? null : (json['category_to_store'] as Array<any>).map(OpenDataStoreCategoryFromJSON)),
|
||||
'comment': json['comment'] == null ? undefined : json['comment'],
|
||||
'createdBy': json['created_by'],
|
||||
};
|
||||
}
|
||||
|
||||
export function OpenDataStoreToJSON(value?: OpenDataStore | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'version': OpenDataVersionToJSON(value.version),
|
||||
'slug': value.slug,
|
||||
'name': value.name,
|
||||
'category_to_store': (value.categoryToStore === null ? null : (value.categoryToStore as Array<any>).map(OpenDataStoreCategoryToJSON)),
|
||||
'comment': value.comment,
|
||||
'version': OpenDataVersionToJSON(value['version']),
|
||||
'slug': value['slug'],
|
||||
'name': value['name'],
|
||||
'category_to_store': (value['categoryToStore'] == null ? null : (value['categoryToStore'] as Array<any>).map(OpenDataStoreCategoryToJSON)),
|
||||
'comment': value['comment'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { OpenDataCategory } from './OpenDataCategory';
|
||||
import {
|
||||
OpenDataCategory,
|
||||
OpenDataCategoryFromJSON,
|
||||
OpenDataCategoryFromJSONTyped,
|
||||
OpenDataCategoryToJSON,
|
||||
} from './';
|
||||
} from './OpenDataCategory';
|
||||
|
||||
/**
|
||||
* Adds nested create feature
|
||||
@@ -52,12 +52,22 @@ export interface OpenDataStoreCategory {
|
||||
order?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the OpenDataStoreCategory interface.
|
||||
*/
|
||||
export function instanceOfOpenDataStoreCategory(value: object): boolean {
|
||||
if (!('id' in value)) return false;
|
||||
if (!('category' in value)) return false;
|
||||
if (!('store' in value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function OpenDataStoreCategoryFromJSON(json: any): OpenDataStoreCategory {
|
||||
return OpenDataStoreCategoryFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function OpenDataStoreCategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): OpenDataStoreCategory {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
@@ -65,23 +75,19 @@ export function OpenDataStoreCategoryFromJSONTyped(json: any, ignoreDiscriminato
|
||||
'id': json['id'],
|
||||
'category': OpenDataCategoryFromJSON(json['category']),
|
||||
'store': json['store'],
|
||||
'order': !exists(json, 'order') ? undefined : json['order'],
|
||||
'order': json['order'] == null ? undefined : json['order'],
|
||||
};
|
||||
}
|
||||
|
||||
export function OpenDataStoreCategoryToJSON(value?: OpenDataStoreCategory | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'category': OpenDataCategoryToJSON(value.category),
|
||||
'store': value.store,
|
||||
'order': value.order,
|
||||
'category': OpenDataCategoryToJSON(value['category']),
|
||||
'store': value['store'],
|
||||
'order': value['order'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,62 +12,62 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { BaseUnitEnum } from './BaseUnitEnum';
|
||||
import {
|
||||
BaseUnitEnum,
|
||||
BaseUnitEnumFromJSON,
|
||||
BaseUnitEnumFromJSONTyped,
|
||||
BaseUnitEnumToJSON,
|
||||
BlankEnum,
|
||||
BlankEnumFromJSON,
|
||||
BlankEnumFromJSONTyped,
|
||||
BlankEnumToJSON,
|
||||
OpenDataUnitTypeEnum,
|
||||
} from './BaseUnitEnum';
|
||||
import type { OpenDataUnitTypeEnum } from './OpenDataUnitTypeEnum';
|
||||
import {
|
||||
OpenDataUnitTypeEnumFromJSON,
|
||||
OpenDataUnitTypeEnumFromJSONTyped,
|
||||
OpenDataUnitTypeEnumToJSON,
|
||||
OpenDataVersion,
|
||||
} from './OpenDataUnitTypeEnum';
|
||||
import type { OpenDataVersion } from './OpenDataVersion';
|
||||
import {
|
||||
OpenDataVersionFromJSON,
|
||||
OpenDataVersionFromJSONTyped,
|
||||
OpenDataVersionToJSON,
|
||||
} from './';
|
||||
} from './OpenDataVersion';
|
||||
|
||||
/**
|
||||
* 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 OpenDataUnit
|
||||
*/
|
||||
@@ -104,10 +104,10 @@ export interface OpenDataUnit {
|
||||
pluralName?: string;
|
||||
/**
|
||||
*
|
||||
* @type {BaseUnitEnum | BlankEnum}
|
||||
* @type {BaseUnitEnum}
|
||||
* @memberof OpenDataUnit
|
||||
*/
|
||||
baseUnit?: BaseUnitEnum | BlankEnum;
|
||||
baseUnit?: BaseUnitEnum;
|
||||
/**
|
||||
*
|
||||
* @type {OpenDataUnitTypeEnum}
|
||||
@@ -128,12 +128,25 @@ export interface OpenDataUnit {
|
||||
readonly createdBy: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the OpenDataUnit interface.
|
||||
*/
|
||||
export function instanceOfOpenDataUnit(value: object): boolean {
|
||||
if (!('id' in value)) return false;
|
||||
if (!('version' in value)) return false;
|
||||
if (!('slug' in value)) return false;
|
||||
if (!('name' in value)) return false;
|
||||
if (!('type' in value)) return false;
|
||||
if (!('createdBy' in value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function OpenDataUnitFromJSON(json: any): OpenDataUnit {
|
||||
return OpenDataUnitFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function OpenDataUnitFromJSONTyped(json: any, ignoreDiscriminator: boolean): OpenDataUnit {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
@@ -142,31 +155,27 @@ export function OpenDataUnitFromJSONTyped(json: any, ignoreDiscriminator: boolea
|
||||
'version': OpenDataVersionFromJSON(json['version']),
|
||||
'slug': json['slug'],
|
||||
'name': json['name'],
|
||||
'pluralName': !exists(json, 'plural_name') ? undefined : json['plural_name'],
|
||||
'baseUnit': !exists(json, 'base_unit') ? undefined : BaseUnitEnum | BlankEnumFromJSON(json['base_unit']),
|
||||
'pluralName': json['plural_name'] == null ? undefined : json['plural_name'],
|
||||
'baseUnit': json['base_unit'] == null ? undefined : BaseUnitEnumFromJSON(json['base_unit']),
|
||||
'type': OpenDataUnitTypeEnumFromJSON(json['type']),
|
||||
'comment': !exists(json, 'comment') ? undefined : json['comment'],
|
||||
'comment': json['comment'] == null ? undefined : json['comment'],
|
||||
'createdBy': json['created_by'],
|
||||
};
|
||||
}
|
||||
|
||||
export function OpenDataUnitToJSON(value?: OpenDataUnit | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'version': OpenDataVersionToJSON(value.version),
|
||||
'slug': value.slug,
|
||||
'name': value.name,
|
||||
'plural_name': value.pluralName,
|
||||
'base_unit': BaseUnitEnum | BlankEnumToJSON(value.baseUnit),
|
||||
'type': OpenDataUnitTypeEnumToJSON(value.type),
|
||||
'comment': value.comment,
|
||||
'version': OpenDataVersionToJSON(value['version']),
|
||||
'slug': value['slug'],
|
||||
'name': value['name'],
|
||||
'plural_name': value['pluralName'],
|
||||
'base_unit': BaseUnitEnumToJSON(value['baseUnit']),
|
||||
'type': OpenDataUnitTypeEnumToJSON(value['type']),
|
||||
'comment': value['comment'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
*
|
||||
@@ -39,18 +39,15 @@ export function OpenDataUnitBaseUnitFromJSON(json: any): OpenDataUnitBaseUnit {
|
||||
}
|
||||
|
||||
export function OpenDataUnitBaseUnitFromJSONTyped(json: any, ignoreDiscriminator: boolean): OpenDataUnitBaseUnit {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return { ...BaseUnitEnumFromJSONTyped(json, true), ...BlankEnumFromJSONTyped(json, true) };
|
||||
}
|
||||
|
||||
export function OpenDataUnitBaseUnitToJSON(value?: OpenDataUnitBaseUnit | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (instanceOfBaseUnitEnum(value)) {
|
||||
|
||||
@@ -12,18 +12,20 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* * `WEIGHT` - weight
|
||||
* `VOLUME` - volume
|
||||
* `OTHER` - other
|
||||
* * `VOLUME` - volume
|
||||
* * `OTHER` - other
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum OpenDataUnitTypeEnum {
|
||||
Weight = 'WEIGHT',
|
||||
Volume = 'VOLUME',
|
||||
Other = 'OTHER'
|
||||
}
|
||||
export const OpenDataUnitTypeEnum = {
|
||||
Weight: 'WEIGHT',
|
||||
Volume: 'VOLUME',
|
||||
Other: 'OTHER'
|
||||
} as const;
|
||||
export type OpenDataUnitTypeEnum = typeof OpenDataUnitTypeEnum[keyof typeof OpenDataUnitTypeEnum];
|
||||
|
||||
|
||||
export function OpenDataUnitTypeEnumFromJSON(json: any): OpenDataUnitTypeEnum {
|
||||
return OpenDataUnitTypeEnumFromJSONTyped(json, false);
|
||||
|
||||
@@ -12,43 +12,43 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
* 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 OpenDataVersion
|
||||
*/
|
||||
@@ -79,12 +79,22 @@ export interface OpenDataVersion {
|
||||
comment?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the OpenDataVersion interface.
|
||||
*/
|
||||
export function instanceOfOpenDataVersion(value: object): boolean {
|
||||
if (!('id' in value)) return false;
|
||||
if (!('name' in value)) return false;
|
||||
if (!('code' in value)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function OpenDataVersionFromJSON(json: any): OpenDataVersion {
|
||||
return OpenDataVersionFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function OpenDataVersionFromJSONTyped(json: any, ignoreDiscriminator: boolean): OpenDataVersion {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
@@ -92,23 +102,19 @@ export function OpenDataVersionFromJSONTyped(json: any, ignoreDiscriminator: boo
|
||||
'id': json['id'],
|
||||
'name': json['name'],
|
||||
'code': json['code'],
|
||||
'comment': !exists(json, 'comment') ? undefined : json['comment'],
|
||||
'comment': json['comment'] == null ? undefined : json['comment'],
|
||||
};
|
||||
}
|
||||
|
||||
export function OpenDataVersionToJSON(value?: OpenDataVersion | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'name': value.name,
|
||||
'code': value.code,
|
||||
'comment': value.comment,
|
||||
'name': value['name'],
|
||||
'code': value['code'],
|
||||
'comment': value['comment'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { Automation } from './Automation';
|
||||
import {
|
||||
Automation,
|
||||
AutomationFromJSON,
|
||||
AutomationFromJSONTyped,
|
||||
AutomationToJSON,
|
||||
} from './';
|
||||
} from './Automation';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -37,13 +37,13 @@ export interface PaginatedAutomationList {
|
||||
* @type {string}
|
||||
* @memberof PaginatedAutomationList
|
||||
*/
|
||||
next?: string | null;
|
||||
next?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PaginatedAutomationList
|
||||
*/
|
||||
previous?: string | null;
|
||||
previous?: string;
|
||||
/**
|
||||
*
|
||||
* @type {Array<Automation>}
|
||||
@@ -52,37 +52,40 @@ export interface PaginatedAutomationList {
|
||||
results?: Array<Automation>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PaginatedAutomationList interface.
|
||||
*/
|
||||
export function instanceOfPaginatedAutomationList(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PaginatedAutomationListFromJSON(json: any): PaginatedAutomationList {
|
||||
return PaginatedAutomationListFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PaginatedAutomationListFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaginatedAutomationList {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'count': !exists(json, 'count') ? undefined : json['count'],
|
||||
'next': !exists(json, 'next') ? undefined : json['next'],
|
||||
'previous': !exists(json, 'previous') ? undefined : json['previous'],
|
||||
'results': !exists(json, 'results') ? undefined : ((json['results'] as Array<any>).map(AutomationFromJSON)),
|
||||
'count': json['count'] == null ? undefined : json['count'],
|
||||
'next': json['next'] == null ? undefined : json['next'],
|
||||
'previous': json['previous'] == null ? undefined : json['previous'],
|
||||
'results': json['results'] == null ? undefined : ((json['results'] as Array<any>).map(AutomationFromJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
export function PaginatedAutomationListToJSON(value?: PaginatedAutomationList | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'count': value.count,
|
||||
'next': value.next,
|
||||
'previous': value.previous,
|
||||
'results': value.results === undefined ? undefined : ((value.results as Array<any>).map(AutomationToJSON)),
|
||||
'count': value['count'],
|
||||
'next': value['next'],
|
||||
'previous': value['previous'],
|
||||
'results': value['results'] == null ? undefined : ((value['results'] as Array<any>).map(AutomationToJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { CookLog } from './CookLog';
|
||||
import {
|
||||
CookLog,
|
||||
CookLogFromJSON,
|
||||
CookLogFromJSONTyped,
|
||||
CookLogToJSON,
|
||||
} from './';
|
||||
} from './CookLog';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -37,13 +37,13 @@ export interface PaginatedCookLogList {
|
||||
* @type {string}
|
||||
* @memberof PaginatedCookLogList
|
||||
*/
|
||||
next?: string | null;
|
||||
next?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PaginatedCookLogList
|
||||
*/
|
||||
previous?: string | null;
|
||||
previous?: string;
|
||||
/**
|
||||
*
|
||||
* @type {Array<CookLog>}
|
||||
@@ -52,37 +52,40 @@ export interface PaginatedCookLogList {
|
||||
results?: Array<CookLog>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PaginatedCookLogList interface.
|
||||
*/
|
||||
export function instanceOfPaginatedCookLogList(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PaginatedCookLogListFromJSON(json: any): PaginatedCookLogList {
|
||||
return PaginatedCookLogListFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PaginatedCookLogListFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaginatedCookLogList {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'count': !exists(json, 'count') ? undefined : json['count'],
|
||||
'next': !exists(json, 'next') ? undefined : json['next'],
|
||||
'previous': !exists(json, 'previous') ? undefined : json['previous'],
|
||||
'results': !exists(json, 'results') ? undefined : ((json['results'] as Array<any>).map(CookLogFromJSON)),
|
||||
'count': json['count'] == null ? undefined : json['count'],
|
||||
'next': json['next'] == null ? undefined : json['next'],
|
||||
'previous': json['previous'] == null ? undefined : json['previous'],
|
||||
'results': json['results'] == null ? undefined : ((json['results'] as Array<any>).map(CookLogFromJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
export function PaginatedCookLogListToJSON(value?: PaginatedCookLogList | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'count': value.count,
|
||||
'next': value.next,
|
||||
'previous': value.previous,
|
||||
'results': value.results === undefined ? undefined : ((value.results as Array<any>).map(CookLogToJSON)),
|
||||
'count': value['count'],
|
||||
'next': value['next'],
|
||||
'previous': value['previous'],
|
||||
'results': value['results'] == null ? undefined : ((value['results'] as Array<any>).map(CookLogToJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { CustomFilter } from './CustomFilter';
|
||||
import {
|
||||
CustomFilter,
|
||||
CustomFilterFromJSON,
|
||||
CustomFilterFromJSONTyped,
|
||||
CustomFilterToJSON,
|
||||
} from './';
|
||||
} from './CustomFilter';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -37,13 +37,13 @@ export interface PaginatedCustomFilterList {
|
||||
* @type {string}
|
||||
* @memberof PaginatedCustomFilterList
|
||||
*/
|
||||
next?: string | null;
|
||||
next?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PaginatedCustomFilterList
|
||||
*/
|
||||
previous?: string | null;
|
||||
previous?: string;
|
||||
/**
|
||||
*
|
||||
* @type {Array<CustomFilter>}
|
||||
@@ -52,37 +52,40 @@ export interface PaginatedCustomFilterList {
|
||||
results?: Array<CustomFilter>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PaginatedCustomFilterList interface.
|
||||
*/
|
||||
export function instanceOfPaginatedCustomFilterList(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PaginatedCustomFilterListFromJSON(json: any): PaginatedCustomFilterList {
|
||||
return PaginatedCustomFilterListFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PaginatedCustomFilterListFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaginatedCustomFilterList {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'count': !exists(json, 'count') ? undefined : json['count'],
|
||||
'next': !exists(json, 'next') ? undefined : json['next'],
|
||||
'previous': !exists(json, 'previous') ? undefined : json['previous'],
|
||||
'results': !exists(json, 'results') ? undefined : ((json['results'] as Array<any>).map(CustomFilterFromJSON)),
|
||||
'count': json['count'] == null ? undefined : json['count'],
|
||||
'next': json['next'] == null ? undefined : json['next'],
|
||||
'previous': json['previous'] == null ? undefined : json['previous'],
|
||||
'results': json['results'] == null ? undefined : ((json['results'] as Array<any>).map(CustomFilterFromJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
export function PaginatedCustomFilterListToJSON(value?: PaginatedCustomFilterList | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'count': value.count,
|
||||
'next': value.next,
|
||||
'previous': value.previous,
|
||||
'results': value.results === undefined ? undefined : ((value.results as Array<any>).map(CustomFilterToJSON)),
|
||||
'count': value['count'],
|
||||
'next': value['next'],
|
||||
'previous': value['previous'],
|
||||
'results': value['results'] == null ? undefined : ((value['results'] as Array<any>).map(CustomFilterToJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { ExportLog } from './ExportLog';
|
||||
import {
|
||||
ExportLog,
|
||||
ExportLogFromJSON,
|
||||
ExportLogFromJSONTyped,
|
||||
ExportLogToJSON,
|
||||
} from './';
|
||||
} from './ExportLog';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -37,13 +37,13 @@ export interface PaginatedExportLogList {
|
||||
* @type {string}
|
||||
* @memberof PaginatedExportLogList
|
||||
*/
|
||||
next?: string | null;
|
||||
next?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PaginatedExportLogList
|
||||
*/
|
||||
previous?: string | null;
|
||||
previous?: string;
|
||||
/**
|
||||
*
|
||||
* @type {Array<ExportLog>}
|
||||
@@ -52,37 +52,40 @@ export interface PaginatedExportLogList {
|
||||
results?: Array<ExportLog>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PaginatedExportLogList interface.
|
||||
*/
|
||||
export function instanceOfPaginatedExportLogList(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PaginatedExportLogListFromJSON(json: any): PaginatedExportLogList {
|
||||
return PaginatedExportLogListFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PaginatedExportLogListFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaginatedExportLogList {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'count': !exists(json, 'count') ? undefined : json['count'],
|
||||
'next': !exists(json, 'next') ? undefined : json['next'],
|
||||
'previous': !exists(json, 'previous') ? undefined : json['previous'],
|
||||
'results': !exists(json, 'results') ? undefined : ((json['results'] as Array<any>).map(ExportLogFromJSON)),
|
||||
'count': json['count'] == null ? undefined : json['count'],
|
||||
'next': json['next'] == null ? undefined : json['next'],
|
||||
'previous': json['previous'] == null ? undefined : json['previous'],
|
||||
'results': json['results'] == null ? undefined : ((json['results'] as Array<any>).map(ExportLogFromJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
export function PaginatedExportLogListToJSON(value?: PaginatedExportLogList | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'count': value.count,
|
||||
'next': value.next,
|
||||
'previous': value.previous,
|
||||
'results': value.results === undefined ? undefined : ((value.results as Array<any>).map(ExportLogToJSON)),
|
||||
'count': value['count'],
|
||||
'next': value['next'],
|
||||
'previous': value['previous'],
|
||||
'results': value['results'] == null ? undefined : ((value['results'] as Array<any>).map(ExportLogToJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { Food } from './Food';
|
||||
import {
|
||||
Food,
|
||||
FoodFromJSON,
|
||||
FoodFromJSONTyped,
|
||||
FoodToJSON,
|
||||
} from './';
|
||||
} from './Food';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -37,13 +37,13 @@ export interface PaginatedFoodList {
|
||||
* @type {string}
|
||||
* @memberof PaginatedFoodList
|
||||
*/
|
||||
next?: string | null;
|
||||
next?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PaginatedFoodList
|
||||
*/
|
||||
previous?: string | null;
|
||||
previous?: string;
|
||||
/**
|
||||
*
|
||||
* @type {Array<Food>}
|
||||
@@ -52,37 +52,40 @@ export interface PaginatedFoodList {
|
||||
results?: Array<Food>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PaginatedFoodList interface.
|
||||
*/
|
||||
export function instanceOfPaginatedFoodList(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PaginatedFoodListFromJSON(json: any): PaginatedFoodList {
|
||||
return PaginatedFoodListFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PaginatedFoodListFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaginatedFoodList {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'count': !exists(json, 'count') ? undefined : json['count'],
|
||||
'next': !exists(json, 'next') ? undefined : json['next'],
|
||||
'previous': !exists(json, 'previous') ? undefined : json['previous'],
|
||||
'results': !exists(json, 'results') ? undefined : ((json['results'] as Array<any>).map(FoodFromJSON)),
|
||||
'count': json['count'] == null ? undefined : json['count'],
|
||||
'next': json['next'] == null ? undefined : json['next'],
|
||||
'previous': json['previous'] == null ? undefined : json['previous'],
|
||||
'results': json['results'] == null ? undefined : ((json['results'] as Array<any>).map(FoodFromJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
export function PaginatedFoodListToJSON(value?: PaginatedFoodList | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'count': value.count,
|
||||
'next': value.next,
|
||||
'previous': value.previous,
|
||||
'results': value.results === undefined ? undefined : ((value.results as Array<any>).map(FoodToJSON)),
|
||||
'count': value['count'],
|
||||
'next': value['next'],
|
||||
'previous': value['previous'],
|
||||
'results': value['results'] == null ? undefined : ((value['results'] as Array<any>).map(FoodToJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { ImportLog } from './ImportLog';
|
||||
import {
|
||||
ImportLog,
|
||||
ImportLogFromJSON,
|
||||
ImportLogFromJSONTyped,
|
||||
ImportLogToJSON,
|
||||
} from './';
|
||||
} from './ImportLog';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -37,13 +37,13 @@ export interface PaginatedImportLogList {
|
||||
* @type {string}
|
||||
* @memberof PaginatedImportLogList
|
||||
*/
|
||||
next?: string | null;
|
||||
next?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PaginatedImportLogList
|
||||
*/
|
||||
previous?: string | null;
|
||||
previous?: string;
|
||||
/**
|
||||
*
|
||||
* @type {Array<ImportLog>}
|
||||
@@ -52,37 +52,40 @@ export interface PaginatedImportLogList {
|
||||
results?: Array<ImportLog>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PaginatedImportLogList interface.
|
||||
*/
|
||||
export function instanceOfPaginatedImportLogList(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PaginatedImportLogListFromJSON(json: any): PaginatedImportLogList {
|
||||
return PaginatedImportLogListFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PaginatedImportLogListFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaginatedImportLogList {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'count': !exists(json, 'count') ? undefined : json['count'],
|
||||
'next': !exists(json, 'next') ? undefined : json['next'],
|
||||
'previous': !exists(json, 'previous') ? undefined : json['previous'],
|
||||
'results': !exists(json, 'results') ? undefined : ((json['results'] as Array<any>).map(ImportLogFromJSON)),
|
||||
'count': json['count'] == null ? undefined : json['count'],
|
||||
'next': json['next'] == null ? undefined : json['next'],
|
||||
'previous': json['previous'] == null ? undefined : json['previous'],
|
||||
'results': json['results'] == null ? undefined : ((json['results'] as Array<any>).map(ImportLogFromJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
export function PaginatedImportLogListToJSON(value?: PaginatedImportLogList | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'count': value.count,
|
||||
'next': value.next,
|
||||
'previous': value.previous,
|
||||
'results': value.results === undefined ? undefined : ((value.results as Array<any>).map(ImportLogToJSON)),
|
||||
'count': value['count'],
|
||||
'next': value['next'],
|
||||
'previous': value['previous'],
|
||||
'results': value['results'] == null ? undefined : ((value['results'] as Array<any>).map(ImportLogToJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { Ingredient } from './Ingredient';
|
||||
import {
|
||||
Ingredient,
|
||||
IngredientFromJSON,
|
||||
IngredientFromJSONTyped,
|
||||
IngredientToJSON,
|
||||
} from './';
|
||||
} from './Ingredient';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -37,13 +37,13 @@ export interface PaginatedIngredientList {
|
||||
* @type {string}
|
||||
* @memberof PaginatedIngredientList
|
||||
*/
|
||||
next?: string | null;
|
||||
next?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PaginatedIngredientList
|
||||
*/
|
||||
previous?: string | null;
|
||||
previous?: string;
|
||||
/**
|
||||
*
|
||||
* @type {Array<Ingredient>}
|
||||
@@ -52,37 +52,40 @@ export interface PaginatedIngredientList {
|
||||
results?: Array<Ingredient>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PaginatedIngredientList interface.
|
||||
*/
|
||||
export function instanceOfPaginatedIngredientList(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PaginatedIngredientListFromJSON(json: any): PaginatedIngredientList {
|
||||
return PaginatedIngredientListFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PaginatedIngredientListFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaginatedIngredientList {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'count': !exists(json, 'count') ? undefined : json['count'],
|
||||
'next': !exists(json, 'next') ? undefined : json['next'],
|
||||
'previous': !exists(json, 'previous') ? undefined : json['previous'],
|
||||
'results': !exists(json, 'results') ? undefined : ((json['results'] as Array<any>).map(IngredientFromJSON)),
|
||||
'count': json['count'] == null ? undefined : json['count'],
|
||||
'next': json['next'] == null ? undefined : json['next'],
|
||||
'previous': json['previous'] == null ? undefined : json['previous'],
|
||||
'results': json['results'] == null ? undefined : ((json['results'] as Array<any>).map(IngredientFromJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
export function PaginatedIngredientListToJSON(value?: PaginatedIngredientList | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'count': value.count,
|
||||
'next': value.next,
|
||||
'previous': value.previous,
|
||||
'results': value.results === undefined ? undefined : ((value.results as Array<any>).map(IngredientToJSON)),
|
||||
'count': value['count'],
|
||||
'next': value['next'],
|
||||
'previous': value['previous'],
|
||||
'results': value['results'] == null ? undefined : ((value['results'] as Array<any>).map(IngredientToJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { Keyword } from './Keyword';
|
||||
import {
|
||||
Keyword,
|
||||
KeywordFromJSON,
|
||||
KeywordFromJSONTyped,
|
||||
KeywordToJSON,
|
||||
} from './';
|
||||
} from './Keyword';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -37,13 +37,13 @@ export interface PaginatedKeywordList {
|
||||
* @type {string}
|
||||
* @memberof PaginatedKeywordList
|
||||
*/
|
||||
next?: string | null;
|
||||
next?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PaginatedKeywordList
|
||||
*/
|
||||
previous?: string | null;
|
||||
previous?: string;
|
||||
/**
|
||||
*
|
||||
* @type {Array<Keyword>}
|
||||
@@ -52,37 +52,40 @@ export interface PaginatedKeywordList {
|
||||
results?: Array<Keyword>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PaginatedKeywordList interface.
|
||||
*/
|
||||
export function instanceOfPaginatedKeywordList(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PaginatedKeywordListFromJSON(json: any): PaginatedKeywordList {
|
||||
return PaginatedKeywordListFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PaginatedKeywordListFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaginatedKeywordList {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'count': !exists(json, 'count') ? undefined : json['count'],
|
||||
'next': !exists(json, 'next') ? undefined : json['next'],
|
||||
'previous': !exists(json, 'previous') ? undefined : json['previous'],
|
||||
'results': !exists(json, 'results') ? undefined : ((json['results'] as Array<any>).map(KeywordFromJSON)),
|
||||
'count': json['count'] == null ? undefined : json['count'],
|
||||
'next': json['next'] == null ? undefined : json['next'],
|
||||
'previous': json['previous'] == null ? undefined : json['previous'],
|
||||
'results': json['results'] == null ? undefined : ((json['results'] as Array<any>).map(KeywordFromJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
export function PaginatedKeywordListToJSON(value?: PaginatedKeywordList | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'count': value.count,
|
||||
'next': value.next,
|
||||
'previous': value.previous,
|
||||
'results': value.results === undefined ? undefined : ((value.results as Array<any>).map(KeywordToJSON)),
|
||||
'count': value['count'],
|
||||
'next': value['next'],
|
||||
'previous': value['previous'],
|
||||
'results': value['results'] == null ? undefined : ((value['results'] as Array<any>).map(KeywordToJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { RecipeOverview } from './RecipeOverview';
|
||||
import {
|
||||
RecipeOverview,
|
||||
RecipeOverviewFromJSON,
|
||||
RecipeOverviewFromJSONTyped,
|
||||
RecipeOverviewToJSON,
|
||||
} from './';
|
||||
} from './RecipeOverview';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -37,13 +37,13 @@ export interface PaginatedRecipeOverviewList {
|
||||
* @type {string}
|
||||
* @memberof PaginatedRecipeOverviewList
|
||||
*/
|
||||
next?: string | null;
|
||||
next?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PaginatedRecipeOverviewList
|
||||
*/
|
||||
previous?: string | null;
|
||||
previous?: string;
|
||||
/**
|
||||
*
|
||||
* @type {Array<RecipeOverview>}
|
||||
@@ -52,37 +52,40 @@ export interface PaginatedRecipeOverviewList {
|
||||
results?: Array<RecipeOverview>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PaginatedRecipeOverviewList interface.
|
||||
*/
|
||||
export function instanceOfPaginatedRecipeOverviewList(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PaginatedRecipeOverviewListFromJSON(json: any): PaginatedRecipeOverviewList {
|
||||
return PaginatedRecipeOverviewListFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PaginatedRecipeOverviewListFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaginatedRecipeOverviewList {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'count': !exists(json, 'count') ? undefined : json['count'],
|
||||
'next': !exists(json, 'next') ? undefined : json['next'],
|
||||
'previous': !exists(json, 'previous') ? undefined : json['previous'],
|
||||
'results': !exists(json, 'results') ? undefined : ((json['results'] as Array<any>).map(RecipeOverviewFromJSON)),
|
||||
'count': json['count'] == null ? undefined : json['count'],
|
||||
'next': json['next'] == null ? undefined : json['next'],
|
||||
'previous': json['previous'] == null ? undefined : json['previous'],
|
||||
'results': json['results'] == null ? undefined : ((json['results'] as Array<any>).map(RecipeOverviewFromJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
export function PaginatedRecipeOverviewListToJSON(value?: PaginatedRecipeOverviewList | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'count': value.count,
|
||||
'next': value.next,
|
||||
'previous': value.previous,
|
||||
'results': value.results === undefined ? undefined : ((value.results as Array<any>).map(RecipeOverviewToJSON)),
|
||||
'count': value['count'],
|
||||
'next': value['next'],
|
||||
'previous': value['previous'],
|
||||
'results': value['results'] == null ? undefined : ((value['results'] as Array<any>).map(RecipeOverviewToJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { Step } from './Step';
|
||||
import {
|
||||
Step,
|
||||
StepFromJSON,
|
||||
StepFromJSONTyped,
|
||||
StepToJSON,
|
||||
} from './';
|
||||
} from './Step';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -37,13 +37,13 @@ export interface PaginatedStepList {
|
||||
* @type {string}
|
||||
* @memberof PaginatedStepList
|
||||
*/
|
||||
next?: string | null;
|
||||
next?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PaginatedStepList
|
||||
*/
|
||||
previous?: string | null;
|
||||
previous?: string;
|
||||
/**
|
||||
*
|
||||
* @type {Array<Step>}
|
||||
@@ -52,37 +52,40 @@ export interface PaginatedStepList {
|
||||
results?: Array<Step>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PaginatedStepList interface.
|
||||
*/
|
||||
export function instanceOfPaginatedStepList(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PaginatedStepListFromJSON(json: any): PaginatedStepList {
|
||||
return PaginatedStepListFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PaginatedStepListFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaginatedStepList {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'count': !exists(json, 'count') ? undefined : json['count'],
|
||||
'next': !exists(json, 'next') ? undefined : json['next'],
|
||||
'previous': !exists(json, 'previous') ? undefined : json['previous'],
|
||||
'results': !exists(json, 'results') ? undefined : ((json['results'] as Array<any>).map(StepFromJSON)),
|
||||
'count': json['count'] == null ? undefined : json['count'],
|
||||
'next': json['next'] == null ? undefined : json['next'],
|
||||
'previous': json['previous'] == null ? undefined : json['previous'],
|
||||
'results': json['results'] == null ? undefined : ((json['results'] as Array<any>).map(StepFromJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
export function PaginatedStepListToJSON(value?: PaginatedStepList | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'count': value.count,
|
||||
'next': value.next,
|
||||
'previous': value.previous,
|
||||
'results': value.results === undefined ? undefined : ((value.results as Array<any>).map(StepToJSON)),
|
||||
'count': value['count'],
|
||||
'next': value['next'],
|
||||
'previous': value['previous'],
|
||||
'results': value['results'] == null ? undefined : ((value['results'] as Array<any>).map(StepToJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { SupermarketCategoryRelation } from './SupermarketCategoryRelation';
|
||||
import {
|
||||
SupermarketCategoryRelation,
|
||||
SupermarketCategoryRelationFromJSON,
|
||||
SupermarketCategoryRelationFromJSONTyped,
|
||||
SupermarketCategoryRelationToJSON,
|
||||
} from './';
|
||||
} from './SupermarketCategoryRelation';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -37,13 +37,13 @@ export interface PaginatedSupermarketCategoryRelationList {
|
||||
* @type {string}
|
||||
* @memberof PaginatedSupermarketCategoryRelationList
|
||||
*/
|
||||
next?: string | null;
|
||||
next?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PaginatedSupermarketCategoryRelationList
|
||||
*/
|
||||
previous?: string | null;
|
||||
previous?: string;
|
||||
/**
|
||||
*
|
||||
* @type {Array<SupermarketCategoryRelation>}
|
||||
@@ -52,37 +52,40 @@ export interface PaginatedSupermarketCategoryRelationList {
|
||||
results?: Array<SupermarketCategoryRelation>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PaginatedSupermarketCategoryRelationList interface.
|
||||
*/
|
||||
export function instanceOfPaginatedSupermarketCategoryRelationList(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PaginatedSupermarketCategoryRelationListFromJSON(json: any): PaginatedSupermarketCategoryRelationList {
|
||||
return PaginatedSupermarketCategoryRelationListFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PaginatedSupermarketCategoryRelationListFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaginatedSupermarketCategoryRelationList {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'count': !exists(json, 'count') ? undefined : json['count'],
|
||||
'next': !exists(json, 'next') ? undefined : json['next'],
|
||||
'previous': !exists(json, 'previous') ? undefined : json['previous'],
|
||||
'results': !exists(json, 'results') ? undefined : ((json['results'] as Array<any>).map(SupermarketCategoryRelationFromJSON)),
|
||||
'count': json['count'] == null ? undefined : json['count'],
|
||||
'next': json['next'] == null ? undefined : json['next'],
|
||||
'previous': json['previous'] == null ? undefined : json['previous'],
|
||||
'results': json['results'] == null ? undefined : ((json['results'] as Array<any>).map(SupermarketCategoryRelationFromJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
export function PaginatedSupermarketCategoryRelationListToJSON(value?: PaginatedSupermarketCategoryRelationList | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'count': value.count,
|
||||
'next': value.next,
|
||||
'previous': value.previous,
|
||||
'results': value.results === undefined ? undefined : ((value.results as Array<any>).map(SupermarketCategoryRelationToJSON)),
|
||||
'count': value['count'],
|
||||
'next': value['next'],
|
||||
'previous': value['previous'],
|
||||
'results': value['results'] == null ? undefined : ((value['results'] as Array<any>).map(SupermarketCategoryRelationToJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { SyncLog } from './SyncLog';
|
||||
import {
|
||||
SyncLog,
|
||||
SyncLogFromJSON,
|
||||
SyncLogFromJSONTyped,
|
||||
SyncLogToJSON,
|
||||
} from './';
|
||||
} from './SyncLog';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -37,13 +37,13 @@ export interface PaginatedSyncLogList {
|
||||
* @type {string}
|
||||
* @memberof PaginatedSyncLogList
|
||||
*/
|
||||
next?: string | null;
|
||||
next?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PaginatedSyncLogList
|
||||
*/
|
||||
previous?: string | null;
|
||||
previous?: string;
|
||||
/**
|
||||
*
|
||||
* @type {Array<SyncLog>}
|
||||
@@ -52,37 +52,40 @@ export interface PaginatedSyncLogList {
|
||||
results?: Array<SyncLog>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PaginatedSyncLogList interface.
|
||||
*/
|
||||
export function instanceOfPaginatedSyncLogList(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PaginatedSyncLogListFromJSON(json: any): PaginatedSyncLogList {
|
||||
return PaginatedSyncLogListFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PaginatedSyncLogListFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaginatedSyncLogList {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'count': !exists(json, 'count') ? undefined : json['count'],
|
||||
'next': !exists(json, 'next') ? undefined : json['next'],
|
||||
'previous': !exists(json, 'previous') ? undefined : json['previous'],
|
||||
'results': !exists(json, 'results') ? undefined : ((json['results'] as Array<any>).map(SyncLogFromJSON)),
|
||||
'count': json['count'] == null ? undefined : json['count'],
|
||||
'next': json['next'] == null ? undefined : json['next'],
|
||||
'previous': json['previous'] == null ? undefined : json['previous'],
|
||||
'results': json['results'] == null ? undefined : ((json['results'] as Array<any>).map(SyncLogFromJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
export function PaginatedSyncLogListToJSON(value?: PaginatedSyncLogList | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'count': value.count,
|
||||
'next': value.next,
|
||||
'previous': value.previous,
|
||||
'results': value.results === undefined ? undefined : ((value.results as Array<any>).map(SyncLogToJSON)),
|
||||
'count': value['count'],
|
||||
'next': value['next'],
|
||||
'previous': value['previous'],
|
||||
'results': value['results'] == null ? undefined : ((value['results'] as Array<any>).map(SyncLogToJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { Unit } from './Unit';
|
||||
import {
|
||||
Unit,
|
||||
UnitFromJSON,
|
||||
UnitFromJSONTyped,
|
||||
UnitToJSON,
|
||||
} from './';
|
||||
} from './Unit';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -37,13 +37,13 @@ export interface PaginatedUnitList {
|
||||
* @type {string}
|
||||
* @memberof PaginatedUnitList
|
||||
*/
|
||||
next?: string | null;
|
||||
next?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PaginatedUnitList
|
||||
*/
|
||||
previous?: string | null;
|
||||
previous?: string;
|
||||
/**
|
||||
*
|
||||
* @type {Array<Unit>}
|
||||
@@ -52,37 +52,40 @@ export interface PaginatedUnitList {
|
||||
results?: Array<Unit>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PaginatedUnitList interface.
|
||||
*/
|
||||
export function instanceOfPaginatedUnitList(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PaginatedUnitListFromJSON(json: any): PaginatedUnitList {
|
||||
return PaginatedUnitListFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PaginatedUnitListFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaginatedUnitList {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'count': !exists(json, 'count') ? undefined : json['count'],
|
||||
'next': !exists(json, 'next') ? undefined : json['next'],
|
||||
'previous': !exists(json, 'previous') ? undefined : json['previous'],
|
||||
'results': !exists(json, 'results') ? undefined : ((json['results'] as Array<any>).map(UnitFromJSON)),
|
||||
'count': json['count'] == null ? undefined : json['count'],
|
||||
'next': json['next'] == null ? undefined : json['next'],
|
||||
'previous': json['previous'] == null ? undefined : json['previous'],
|
||||
'results': json['results'] == null ? undefined : ((json['results'] as Array<any>).map(UnitFromJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
export function PaginatedUnitListToJSON(value?: PaginatedUnitList | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'count': value.count,
|
||||
'next': value.next,
|
||||
'previous': value.previous,
|
||||
'results': value.results === undefined ? undefined : ((value.results as Array<any>).map(UnitToJSON)),
|
||||
'count': value['count'],
|
||||
'next': value['next'],
|
||||
'previous': value['previous'],
|
||||
'results': value['results'] == null ? undefined : ((value['results'] as Array<any>).map(UnitToJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { UserSpace } from './UserSpace';
|
||||
import {
|
||||
UserSpace,
|
||||
UserSpaceFromJSON,
|
||||
UserSpaceFromJSONTyped,
|
||||
UserSpaceToJSON,
|
||||
} from './';
|
||||
} from './UserSpace';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -37,13 +37,13 @@ export interface PaginatedUserSpaceList {
|
||||
* @type {string}
|
||||
* @memberof PaginatedUserSpaceList
|
||||
*/
|
||||
next?: string | null;
|
||||
next?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PaginatedUserSpaceList
|
||||
*/
|
||||
previous?: string | null;
|
||||
previous?: string;
|
||||
/**
|
||||
*
|
||||
* @type {Array<UserSpace>}
|
||||
@@ -52,37 +52,40 @@ export interface PaginatedUserSpaceList {
|
||||
results?: Array<UserSpace>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PaginatedUserSpaceList interface.
|
||||
*/
|
||||
export function instanceOfPaginatedUserSpaceList(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PaginatedUserSpaceListFromJSON(json: any): PaginatedUserSpaceList {
|
||||
return PaginatedUserSpaceListFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PaginatedUserSpaceListFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaginatedUserSpaceList {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'count': !exists(json, 'count') ? undefined : json['count'],
|
||||
'next': !exists(json, 'next') ? undefined : json['next'],
|
||||
'previous': !exists(json, 'previous') ? undefined : json['previous'],
|
||||
'results': !exists(json, 'results') ? undefined : ((json['results'] as Array<any>).map(UserSpaceFromJSON)),
|
||||
'count': json['count'] == null ? undefined : json['count'],
|
||||
'next': json['next'] == null ? undefined : json['next'],
|
||||
'previous': json['previous'] == null ? undefined : json['previous'],
|
||||
'results': json['results'] == null ? undefined : ((json['results'] as Array<any>).map(UserSpaceFromJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
export function PaginatedUserSpaceListToJSON(value?: PaginatedUserSpaceList | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'count': value.count,
|
||||
'next': value.next,
|
||||
'previous': value.previous,
|
||||
'results': value.results === undefined ? undefined : ((value.results as Array<any>).map(UserSpaceToJSON)),
|
||||
'count': value['count'],
|
||||
'next': value['next'],
|
||||
'previous': value['previous'],
|
||||
'results': value['results'] == null ? undefined : ((value['results'] as Array<any>).map(UserSpaceToJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { ViewLog } from './ViewLog';
|
||||
import {
|
||||
ViewLog,
|
||||
ViewLogFromJSON,
|
||||
ViewLogFromJSONTyped,
|
||||
ViewLogToJSON,
|
||||
} from './';
|
||||
} from './ViewLog';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -37,13 +37,13 @@ export interface PaginatedViewLogList {
|
||||
* @type {string}
|
||||
* @memberof PaginatedViewLogList
|
||||
*/
|
||||
next?: string | null;
|
||||
next?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PaginatedViewLogList
|
||||
*/
|
||||
previous?: string | null;
|
||||
previous?: string;
|
||||
/**
|
||||
*
|
||||
* @type {Array<ViewLog>}
|
||||
@@ -52,37 +52,40 @@ export interface PaginatedViewLogList {
|
||||
results?: Array<ViewLog>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PaginatedViewLogList interface.
|
||||
*/
|
||||
export function instanceOfPaginatedViewLogList(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PaginatedViewLogListFromJSON(json: any): PaginatedViewLogList {
|
||||
return PaginatedViewLogListFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PaginatedViewLogListFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaginatedViewLogList {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'count': !exists(json, 'count') ? undefined : json['count'],
|
||||
'next': !exists(json, 'next') ? undefined : json['next'],
|
||||
'previous': !exists(json, 'previous') ? undefined : json['previous'],
|
||||
'results': !exists(json, 'results') ? undefined : ((json['results'] as Array<any>).map(ViewLogFromJSON)),
|
||||
'count': json['count'] == null ? undefined : json['count'],
|
||||
'next': json['next'] == null ? undefined : json['next'],
|
||||
'previous': json['previous'] == null ? undefined : json['previous'],
|
||||
'results': json['results'] == null ? undefined : ((json['results'] as Array<any>).map(ViewLogFromJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
export function PaginatedViewLogListToJSON(value?: PaginatedViewLogList | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'count': value.count,
|
||||
'next': value.next,
|
||||
'previous': value.previous,
|
||||
'results': value.results === undefined ? undefined : ((value.results as Array<any>).map(ViewLogToJSON)),
|
||||
'count': value['count'],
|
||||
'next': value['next'],
|
||||
'previous': value['previous'],
|
||||
'results': value['results'] == null ? undefined : ((value['results'] as Array<any>).map(ViewLogToJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
@@ -57,37 +57,40 @@ export interface PatchedAccessToken {
|
||||
readonly updated?: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedAccessToken interface.
|
||||
*/
|
||||
export function instanceOfPatchedAccessToken(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedAccessTokenFromJSON(json: any): PatchedAccessToken {
|
||||
return PatchedAccessTokenFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PatchedAccessTokenFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedAccessToken {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'token': !exists(json, 'token') ? undefined : json['token'],
|
||||
'expires': !exists(json, 'expires') ? undefined : (new Date(json['expires'])),
|
||||
'scope': !exists(json, 'scope') ? undefined : json['scope'],
|
||||
'created': !exists(json, 'created') ? undefined : (new Date(json['created'])),
|
||||
'updated': !exists(json, 'updated') ? undefined : (new Date(json['updated'])),
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'token': json['token'] == null ? undefined : json['token'],
|
||||
'expires': json['expires'] == null ? undefined : (new Date(json['expires'])),
|
||||
'scope': json['scope'] == null ? undefined : json['scope'],
|
||||
'created': json['created'] == null ? undefined : (new Date(json['created'])),
|
||||
'updated': json['updated'] == null ? undefined : (new Date(json['updated'])),
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedAccessTokenToJSON(value?: PatchedAccessToken | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'expires': value.expires === undefined ? undefined : (value.expires.toISOString()),
|
||||
'scope': value.scope,
|
||||
'expires': value['expires'] == null ? undefined : ((value['expires']).toISOString()),
|
||||
'scope': value['scope'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { AutomationTypeEnum } from './AutomationTypeEnum';
|
||||
import {
|
||||
AutomationTypeEnum,
|
||||
AutomationTypeEnumFromJSON,
|
||||
AutomationTypeEnumFromJSONTyped,
|
||||
AutomationTypeEnumToJSON,
|
||||
} from './';
|
||||
} from './AutomationTypeEnum';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -49,25 +49,25 @@ export interface PatchedAutomation {
|
||||
* @type {string}
|
||||
* @memberof PatchedAutomation
|
||||
*/
|
||||
description?: string | null;
|
||||
description?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PatchedAutomation
|
||||
*/
|
||||
param1?: string | null;
|
||||
param1?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PatchedAutomation
|
||||
*/
|
||||
param2?: string | null;
|
||||
param2?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PatchedAutomation
|
||||
*/
|
||||
param3?: string | null;
|
||||
param3?: string;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
@@ -88,47 +88,50 @@ export interface PatchedAutomation {
|
||||
readonly createdBy?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedAutomation interface.
|
||||
*/
|
||||
export function instanceOfPatchedAutomation(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedAutomationFromJSON(json: any): PatchedAutomation {
|
||||
return PatchedAutomationFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PatchedAutomationFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedAutomation {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'type': !exists(json, 'type') ? undefined : AutomationTypeEnumFromJSON(json['type']),
|
||||
'name': !exists(json, 'name') ? undefined : json['name'],
|
||||
'description': !exists(json, 'description') ? undefined : json['description'],
|
||||
'param1': !exists(json, 'param_1') ? undefined : json['param_1'],
|
||||
'param2': !exists(json, 'param_2') ? undefined : json['param_2'],
|
||||
'param3': !exists(json, 'param_3') ? undefined : json['param_3'],
|
||||
'order': !exists(json, 'order') ? undefined : json['order'],
|
||||
'disabled': !exists(json, 'disabled') ? undefined : json['disabled'],
|
||||
'createdBy': !exists(json, 'created_by') ? undefined : json['created_by'],
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'type': json['type'] == null ? undefined : AutomationTypeEnumFromJSON(json['type']),
|
||||
'name': json['name'] == null ? undefined : json['name'],
|
||||
'description': json['description'] == null ? undefined : json['description'],
|
||||
'param1': json['param_1'] == null ? undefined : json['param_1'],
|
||||
'param2': json['param_2'] == null ? undefined : json['param_2'],
|
||||
'param3': json['param_3'] == null ? undefined : json['param_3'],
|
||||
'order': json['order'] == null ? undefined : json['order'],
|
||||
'disabled': json['disabled'] == null ? undefined : json['disabled'],
|
||||
'createdBy': json['created_by'] == null ? undefined : json['created_by'],
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedAutomationToJSON(value?: PatchedAutomation | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'type': AutomationTypeEnumToJSON(value.type),
|
||||
'name': value.name,
|
||||
'description': value.description,
|
||||
'param_1': value.param1,
|
||||
'param_2': value.param2,
|
||||
'param_3': value.param3,
|
||||
'order': value.order,
|
||||
'disabled': value.disabled,
|
||||
'type': AutomationTypeEnumToJSON(value['type']),
|
||||
'name': value['name'],
|
||||
'description': value['description'],
|
||||
'param_1': value['param1'],
|
||||
'param_2': value['param2'],
|
||||
'param_3': value['param3'],
|
||||
'order': value['order'],
|
||||
'disabled': value['disabled'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
@@ -30,7 +30,7 @@ export interface PatchedBookmarkletImport {
|
||||
* @type {string}
|
||||
* @memberof PatchedBookmarkletImport
|
||||
*/
|
||||
url?: string | null;
|
||||
url?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@@ -51,36 +51,39 @@ export interface PatchedBookmarkletImport {
|
||||
readonly createdAt?: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedBookmarkletImport interface.
|
||||
*/
|
||||
export function instanceOfPatchedBookmarkletImport(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedBookmarkletImportFromJSON(json: any): PatchedBookmarkletImport {
|
||||
return PatchedBookmarkletImportFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PatchedBookmarkletImportFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedBookmarkletImport {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'url': !exists(json, 'url') ? undefined : json['url'],
|
||||
'html': !exists(json, 'html') ? undefined : json['html'],
|
||||
'createdBy': !exists(json, 'created_by') ? undefined : json['created_by'],
|
||||
'createdAt': !exists(json, 'created_at') ? undefined : (new Date(json['created_at'])),
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'url': json['url'] == null ? undefined : json['url'],
|
||||
'html': json['html'] == null ? undefined : json['html'],
|
||||
'createdBy': json['created_by'] == null ? undefined : json['created_by'],
|
||||
'createdAt': json['created_at'] == null ? undefined : (new Date(json['created_at'])),
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedBookmarkletImportToJSON(value?: PatchedBookmarkletImport | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'url': value.url,
|
||||
'html': value.html,
|
||||
'url': value['url'],
|
||||
'html': value['html'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
@@ -36,19 +36,19 @@ export interface PatchedConnectorConfigConfig {
|
||||
* @type {string}
|
||||
* @memberof PatchedConnectorConfigConfig
|
||||
*/
|
||||
url?: string | null;
|
||||
url?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PatchedConnectorConfigConfig
|
||||
*/
|
||||
token?: string | null;
|
||||
token?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PatchedConnectorConfigConfig
|
||||
*/
|
||||
todoEntity?: string | null;
|
||||
todoEntity?: string;
|
||||
/**
|
||||
* Is Connector Enabled
|
||||
* @type {boolean}
|
||||
@@ -81,47 +81,50 @@ export interface PatchedConnectorConfigConfig {
|
||||
readonly createdBy?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedConnectorConfigConfig interface.
|
||||
*/
|
||||
export function instanceOfPatchedConnectorConfigConfig(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedConnectorConfigConfigFromJSON(json: any): PatchedConnectorConfigConfig {
|
||||
return PatchedConnectorConfigConfigFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PatchedConnectorConfigConfigFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedConnectorConfigConfig {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'name': !exists(json, 'name') ? undefined : json['name'],
|
||||
'url': !exists(json, 'url') ? undefined : json['url'],
|
||||
'token': !exists(json, 'token') ? undefined : json['token'],
|
||||
'todoEntity': !exists(json, 'todo_entity') ? undefined : json['todo_entity'],
|
||||
'enabled': !exists(json, 'enabled') ? undefined : json['enabled'],
|
||||
'onShoppingListEntryCreatedEnabled': !exists(json, 'on_shopping_list_entry_created_enabled') ? undefined : json['on_shopping_list_entry_created_enabled'],
|
||||
'onShoppingListEntryUpdatedEnabled': !exists(json, 'on_shopping_list_entry_updated_enabled') ? undefined : json['on_shopping_list_entry_updated_enabled'],
|
||||
'onShoppingListEntryDeletedEnabled': !exists(json, 'on_shopping_list_entry_deleted_enabled') ? undefined : json['on_shopping_list_entry_deleted_enabled'],
|
||||
'createdBy': !exists(json, 'created_by') ? undefined : json['created_by'],
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'name': json['name'] == null ? undefined : json['name'],
|
||||
'url': json['url'] == null ? undefined : json['url'],
|
||||
'token': json['token'] == null ? undefined : json['token'],
|
||||
'todoEntity': json['todo_entity'] == null ? undefined : json['todo_entity'],
|
||||
'enabled': json['enabled'] == null ? undefined : json['enabled'],
|
||||
'onShoppingListEntryCreatedEnabled': json['on_shopping_list_entry_created_enabled'] == null ? undefined : json['on_shopping_list_entry_created_enabled'],
|
||||
'onShoppingListEntryUpdatedEnabled': json['on_shopping_list_entry_updated_enabled'] == null ? undefined : json['on_shopping_list_entry_updated_enabled'],
|
||||
'onShoppingListEntryDeletedEnabled': json['on_shopping_list_entry_deleted_enabled'] == null ? undefined : json['on_shopping_list_entry_deleted_enabled'],
|
||||
'createdBy': json['created_by'] == null ? undefined : json['created_by'],
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedConnectorConfigConfigToJSON(value?: PatchedConnectorConfigConfig | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'name': value.name,
|
||||
'url': value.url,
|
||||
'token': value.token,
|
||||
'todo_entity': value.todoEntity,
|
||||
'enabled': value.enabled,
|
||||
'on_shopping_list_entry_created_enabled': value.onShoppingListEntryCreatedEnabled,
|
||||
'on_shopping_list_entry_updated_enabled': value.onShoppingListEntryUpdatedEnabled,
|
||||
'on_shopping_list_entry_deleted_enabled': value.onShoppingListEntryDeletedEnabled,
|
||||
'name': value['name'],
|
||||
'url': value['url'],
|
||||
'token': value['token'],
|
||||
'todo_entity': value['todoEntity'],
|
||||
'enabled': value['enabled'],
|
||||
'on_shopping_list_entry_created_enabled': value['onShoppingListEntryCreatedEnabled'],
|
||||
'on_shopping_list_entry_updated_enabled': value['onShoppingListEntryUpdatedEnabled'],
|
||||
'on_shopping_list_entry_deleted_enabled': value['onShoppingListEntryDeletedEnabled'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { User } from './User';
|
||||
import {
|
||||
User,
|
||||
UserFromJSON,
|
||||
UserFromJSONTyped,
|
||||
UserToJSON,
|
||||
} from './';
|
||||
} from './User';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -43,19 +43,19 @@ export interface PatchedCookLog {
|
||||
* @type {number}
|
||||
* @memberof PatchedCookLog
|
||||
*/
|
||||
servings?: number | null;
|
||||
servings?: number;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof PatchedCookLog
|
||||
*/
|
||||
rating?: number | null;
|
||||
rating?: number;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PatchedCookLog
|
||||
*/
|
||||
comment?: string | null;
|
||||
comment?: string;
|
||||
/**
|
||||
*
|
||||
* @type {User}
|
||||
@@ -76,42 +76,45 @@ export interface PatchedCookLog {
|
||||
readonly updatedAt?: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedCookLog interface.
|
||||
*/
|
||||
export function instanceOfPatchedCookLog(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedCookLogFromJSON(json: any): PatchedCookLog {
|
||||
return PatchedCookLogFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PatchedCookLogFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedCookLog {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'recipe': !exists(json, 'recipe') ? undefined : json['recipe'],
|
||||
'servings': !exists(json, 'servings') ? undefined : json['servings'],
|
||||
'rating': !exists(json, 'rating') ? undefined : json['rating'],
|
||||
'comment': !exists(json, 'comment') ? undefined : json['comment'],
|
||||
'createdBy': !exists(json, 'created_by') ? undefined : UserFromJSON(json['created_by']),
|
||||
'createdAt': !exists(json, 'created_at') ? undefined : (new Date(json['created_at'])),
|
||||
'updatedAt': !exists(json, 'updated_at') ? undefined : (new Date(json['updated_at'])),
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'recipe': json['recipe'] == null ? undefined : json['recipe'],
|
||||
'servings': json['servings'] == null ? undefined : json['servings'],
|
||||
'rating': json['rating'] == null ? undefined : json['rating'],
|
||||
'comment': json['comment'] == null ? undefined : json['comment'],
|
||||
'createdBy': json['created_by'] == null ? undefined : UserFromJSON(json['created_by']),
|
||||
'createdAt': json['created_at'] == null ? undefined : (new Date(json['created_at'])),
|
||||
'updatedAt': json['updated_at'] == null ? undefined : (new Date(json['updated_at'])),
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedCookLogToJSON(value?: PatchedCookLog | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'recipe': value.recipe,
|
||||
'servings': value.servings,
|
||||
'rating': value.rating,
|
||||
'comment': value.comment,
|
||||
'created_at': value.createdAt === undefined ? undefined : (value.createdAt.toISOString()),
|
||||
'recipe': value['recipe'],
|
||||
'servings': value['servings'],
|
||||
'rating': value['rating'],
|
||||
'comment': value['comment'],
|
||||
'created_at': value['createdAt'] == null ? undefined : ((value['createdAt']).toISOString()),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { User } from './User';
|
||||
import {
|
||||
User,
|
||||
UserFromJSON,
|
||||
UserFromJSONTyped,
|
||||
UserToJSON,
|
||||
} from './';
|
||||
} from './User';
|
||||
|
||||
/**
|
||||
* Adds nested create feature
|
||||
@@ -58,37 +58,40 @@ export interface PatchedCustomFilter {
|
||||
readonly createdBy?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedCustomFilter interface.
|
||||
*/
|
||||
export function instanceOfPatchedCustomFilter(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedCustomFilterFromJSON(json: any): PatchedCustomFilter {
|
||||
return PatchedCustomFilterFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PatchedCustomFilterFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedCustomFilter {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'name': !exists(json, 'name') ? undefined : json['name'],
|
||||
'search': !exists(json, 'search') ? undefined : json['search'],
|
||||
'shared': !exists(json, 'shared') ? undefined : ((json['shared'] as Array<any>).map(UserFromJSON)),
|
||||
'createdBy': !exists(json, 'created_by') ? undefined : json['created_by'],
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'name': json['name'] == null ? undefined : json['name'],
|
||||
'search': json['search'] == null ? undefined : json['search'],
|
||||
'shared': json['shared'] == null ? undefined : ((json['shared'] as Array<any>).map(UserFromJSON)),
|
||||
'createdBy': json['created_by'] == null ? undefined : json['created_by'],
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedCustomFilterToJSON(value?: PatchedCustomFilter | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'name': value.name,
|
||||
'search': value.search,
|
||||
'shared': value.shared === undefined ? undefined : ((value.shared as Array<any>).map(UserToJSON)),
|
||||
'name': value['name'],
|
||||
'search': value['search'],
|
||||
'shared': value['shared'] == null ? undefined : ((value['shared'] as Array<any>).map(UserToJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
@@ -81,46 +81,49 @@ export interface PatchedExportLog {
|
||||
readonly createdAt?: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedExportLog interface.
|
||||
*/
|
||||
export function instanceOfPatchedExportLog(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedExportLogFromJSON(json: any): PatchedExportLog {
|
||||
return PatchedExportLogFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PatchedExportLogFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedExportLog {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'type': !exists(json, 'type') ? undefined : json['type'],
|
||||
'msg': !exists(json, 'msg') ? undefined : json['msg'],
|
||||
'running': !exists(json, 'running') ? undefined : json['running'],
|
||||
'totalRecipes': !exists(json, 'total_recipes') ? undefined : json['total_recipes'],
|
||||
'exportedRecipes': !exists(json, 'exported_recipes') ? undefined : json['exported_recipes'],
|
||||
'cacheDuration': !exists(json, 'cache_duration') ? undefined : json['cache_duration'],
|
||||
'possiblyNotExpired': !exists(json, 'possibly_not_expired') ? undefined : json['possibly_not_expired'],
|
||||
'createdBy': !exists(json, 'created_by') ? undefined : json['created_by'],
|
||||
'createdAt': !exists(json, 'created_at') ? undefined : (new Date(json['created_at'])),
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'type': json['type'] == null ? undefined : json['type'],
|
||||
'msg': json['msg'] == null ? undefined : json['msg'],
|
||||
'running': json['running'] == null ? undefined : json['running'],
|
||||
'totalRecipes': json['total_recipes'] == null ? undefined : json['total_recipes'],
|
||||
'exportedRecipes': json['exported_recipes'] == null ? undefined : json['exported_recipes'],
|
||||
'cacheDuration': json['cache_duration'] == null ? undefined : json['cache_duration'],
|
||||
'possiblyNotExpired': json['possibly_not_expired'] == null ? undefined : json['possibly_not_expired'],
|
||||
'createdBy': json['created_by'] == null ? undefined : json['created_by'],
|
||||
'createdAt': json['created_at'] == null ? undefined : (new Date(json['created_at'])),
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedExportLogToJSON(value?: PatchedExportLog | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'type': value.type,
|
||||
'msg': value.msg,
|
||||
'running': value.running,
|
||||
'total_recipes': value.totalRecipes,
|
||||
'exported_recipes': value.exportedRecipes,
|
||||
'cache_duration': value.cacheDuration,
|
||||
'possibly_not_expired': value.possiblyNotExpired,
|
||||
'type': value['type'],
|
||||
'msg': value['msg'],
|
||||
'running': value['running'],
|
||||
'total_recipes': value['totalRecipes'],
|
||||
'exported_recipes': value['exportedRecipes'],
|
||||
'cache_duration': value['cacheDuration'],
|
||||
'possibly_not_expired': value['possiblyNotExpired'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,70 +12,80 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { FoodInheritField } from './FoodInheritField';
|
||||
import {
|
||||
FoodInheritField,
|
||||
FoodInheritFieldFromJSON,
|
||||
FoodInheritFieldFromJSONTyped,
|
||||
FoodInheritFieldToJSON,
|
||||
FoodSimple,
|
||||
} from './FoodInheritField';
|
||||
import type { FoodSimple } from './FoodSimple';
|
||||
import {
|
||||
FoodSimpleFromJSON,
|
||||
FoodSimpleFromJSONTyped,
|
||||
FoodSimpleToJSON,
|
||||
Property,
|
||||
} from './FoodSimple';
|
||||
import type { Property } from './Property';
|
||||
import {
|
||||
PropertyFromJSON,
|
||||
PropertyFromJSONTyped,
|
||||
PropertyToJSON,
|
||||
RecipeSimple,
|
||||
} from './Property';
|
||||
import type { RecipeSimple } from './RecipeSimple';
|
||||
import {
|
||||
RecipeSimpleFromJSON,
|
||||
RecipeSimpleFromJSONTyped,
|
||||
RecipeSimpleToJSON,
|
||||
SupermarketCategory,
|
||||
} from './RecipeSimple';
|
||||
import type { SupermarketCategory } from './SupermarketCategory';
|
||||
import {
|
||||
SupermarketCategoryFromJSON,
|
||||
SupermarketCategoryFromJSONTyped,
|
||||
SupermarketCategoryToJSON,
|
||||
Unit,
|
||||
} from './SupermarketCategory';
|
||||
import type { Unit } from './Unit';
|
||||
import {
|
||||
UnitFromJSON,
|
||||
UnitFromJSONTyped,
|
||||
UnitToJSON,
|
||||
} from './';
|
||||
} 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.
|
||||
* 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
|
||||
*/
|
||||
@@ -97,7 +107,7 @@ export interface PatchedFood {
|
||||
* @type {string}
|
||||
* @memberof PatchedFood
|
||||
*/
|
||||
pluralName?: string | null;
|
||||
pluralName?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@@ -115,19 +125,19 @@ export interface PatchedFood {
|
||||
* @type {RecipeSimple}
|
||||
* @memberof PatchedFood
|
||||
*/
|
||||
recipe?: RecipeSimple | null;
|
||||
recipe?: RecipeSimple;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PatchedFood
|
||||
*/
|
||||
url?: string | null;
|
||||
url?: string;
|
||||
/**
|
||||
*
|
||||
* @type {Array<Property>}
|
||||
* @memberof PatchedFood
|
||||
*/
|
||||
properties?: Array<Property> | null;
|
||||
properties?: Array<Property>;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@@ -139,25 +149,25 @@ export interface PatchedFood {
|
||||
* @type {Unit}
|
||||
* @memberof PatchedFood
|
||||
*/
|
||||
propertiesFoodUnit?: Unit | null;
|
||||
propertiesFoodUnit?: Unit;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof PatchedFood
|
||||
*/
|
||||
fdcId?: number | null;
|
||||
fdcId?: number;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PatchedFood
|
||||
*/
|
||||
foodOnhand?: string | null;
|
||||
foodOnhand?: string;
|
||||
/**
|
||||
*
|
||||
* @type {SupermarketCategory}
|
||||
* @memberof PatchedFood
|
||||
*/
|
||||
supermarketCategory?: SupermarketCategory | null;
|
||||
supermarketCategory?: SupermarketCategory;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@@ -175,7 +185,7 @@ export interface PatchedFood {
|
||||
* @type {Array<FoodInheritField>}
|
||||
* @memberof PatchedFood
|
||||
*/
|
||||
inheritFields?: Array<FoodInheritField> | null;
|
||||
inheritFields?: Array<FoodInheritField>;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@@ -193,7 +203,7 @@ export interface PatchedFood {
|
||||
* @type {Array<FoodSimple>}
|
||||
* @memberof PatchedFood
|
||||
*/
|
||||
substitute?: Array<FoodSimple> | null;
|
||||
substitute?: Array<FoodSimple>;
|
||||
/**
|
||||
*
|
||||
* @type {boolean}
|
||||
@@ -217,13 +227,20 @@ export interface PatchedFood {
|
||||
* @type {Array<FoodInheritField>}
|
||||
* @memberof PatchedFood
|
||||
*/
|
||||
childInheritFields?: Array<FoodInheritField> | null;
|
||||
childInheritFields?: Array<FoodInheritField>;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PatchedFood
|
||||
*/
|
||||
openDataSlug?: string | null;
|
||||
openDataSlug?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedFood interface.
|
||||
*/
|
||||
export function instanceOfPatchedFood(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedFoodFromJSON(json: any): PatchedFood {
|
||||
@@ -231,66 +248,62 @@ export function PatchedFoodFromJSON(json: any): PatchedFood {
|
||||
}
|
||||
|
||||
export function PatchedFoodFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedFood {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (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'],
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'name': json['name'] == null ? undefined : json['name'],
|
||||
'pluralName': json['plural_name'] == null ? undefined : json['plural_name'],
|
||||
'description': json['description'] == null ? undefined : json['description'],
|
||||
'shopping': json['shopping'] == null ? undefined : json['shopping'],
|
||||
'recipe': json['recipe'] == null ? undefined : RecipeSimpleFromJSON(json['recipe']),
|
||||
'url': json['url'] == null ? undefined : json['url'],
|
||||
'properties': json['properties'] == null ? undefined : ((json['properties'] as Array<any>).map(PropertyFromJSON)),
|
||||
'propertiesFoodAmount': json['properties_food_amount'] == null ? undefined : json['properties_food_amount'],
|
||||
'propertiesFoodUnit': json['properties_food_unit'] == null ? undefined : UnitFromJSON(json['properties_food_unit']),
|
||||
'fdcId': json['fdc_id'] == null ? undefined : json['fdc_id'],
|
||||
'foodOnhand': json['food_onhand'] == null ? undefined : json['food_onhand'],
|
||||
'supermarketCategory': json['supermarket_category'] == null ? undefined : SupermarketCategoryFromJSON(json['supermarket_category']),
|
||||
'parent': json['parent'] == null ? undefined : json['parent'],
|
||||
'numchild': json['numchild'] == null ? undefined : json['numchild'],
|
||||
'inheritFields': json['inherit_fields'] == null ? undefined : ((json['inherit_fields'] as Array<any>).map(FoodInheritFieldFromJSON)),
|
||||
'fullName': json['full_name'] == null ? undefined : json['full_name'],
|
||||
'ignoreShopping': json['ignore_shopping'] == null ? undefined : json['ignore_shopping'],
|
||||
'substitute': json['substitute'] == null ? undefined : ((json['substitute'] as Array<any>).map(FoodSimpleFromJSON)),
|
||||
'substituteSiblings': json['substitute_siblings'] == null ? undefined : json['substitute_siblings'],
|
||||
'substituteChildren': json['substitute_children'] == null ? undefined : json['substitute_children'],
|
||||
'substituteOnhand': json['substitute_onhand'] == null ? undefined : json['substitute_onhand'],
|
||||
'childInheritFields': json['child_inherit_fields'] == null ? undefined : ((json['child_inherit_fields'] as Array<any>).map(FoodInheritFieldFromJSON)),
|
||||
'openDataSlug': json['open_data_slug'] == null ? undefined : json['open_data_slug'],
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedFoodToJSON(value?: PatchedFood | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
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,
|
||||
'name': value['name'],
|
||||
'plural_name': value['pluralName'],
|
||||
'description': value['description'],
|
||||
'recipe': RecipeSimpleToJSON(value['recipe']),
|
||||
'url': value['url'],
|
||||
'properties': value['properties'] == null ? undefined : ((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'] == null ? undefined : ((value['inheritFields'] as Array<any>).map(FoodInheritFieldToJSON)),
|
||||
'ignore_shopping': value['ignoreShopping'],
|
||||
'substitute': value['substitute'] == null ? undefined : ((value['substitute'] as Array<any>).map(FoodSimpleToJSON)),
|
||||
'substitute_siblings': value['substituteSiblings'],
|
||||
'substitute_children': value['substituteChildren'],
|
||||
'child_inherit_fields': value['childInheritFields'] == null ? undefined : ((value['childInheritFields'] as Array<any>).map(FoodInheritFieldToJSON)),
|
||||
'open_data_slug': value['openDataSlug'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { Keyword } from './Keyword';
|
||||
import {
|
||||
Keyword,
|
||||
KeywordFromJSON,
|
||||
KeywordFromJSONTyped,
|
||||
KeywordToJSON,
|
||||
} from './';
|
||||
} from './Keyword';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -82,43 +82,46 @@ export interface PatchedImportLog {
|
||||
readonly createdAt?: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedImportLog interface.
|
||||
*/
|
||||
export function instanceOfPatchedImportLog(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedImportLogFromJSON(json: any): PatchedImportLog {
|
||||
return PatchedImportLogFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PatchedImportLogFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedImportLog {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'type': !exists(json, 'type') ? undefined : json['type'],
|
||||
'msg': !exists(json, 'msg') ? undefined : json['msg'],
|
||||
'running': !exists(json, 'running') ? undefined : json['running'],
|
||||
'keyword': !exists(json, 'keyword') ? undefined : KeywordFromJSON(json['keyword']),
|
||||
'totalRecipes': !exists(json, 'total_recipes') ? undefined : json['total_recipes'],
|
||||
'importedRecipes': !exists(json, 'imported_recipes') ? undefined : json['imported_recipes'],
|
||||
'createdBy': !exists(json, 'created_by') ? undefined : json['created_by'],
|
||||
'createdAt': !exists(json, 'created_at') ? undefined : (new Date(json['created_at'])),
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'type': json['type'] == null ? undefined : json['type'],
|
||||
'msg': json['msg'] == null ? undefined : json['msg'],
|
||||
'running': json['running'] == null ? undefined : json['running'],
|
||||
'keyword': json['keyword'] == null ? undefined : KeywordFromJSON(json['keyword']),
|
||||
'totalRecipes': json['total_recipes'] == null ? undefined : json['total_recipes'],
|
||||
'importedRecipes': json['imported_recipes'] == null ? undefined : json['imported_recipes'],
|
||||
'createdBy': json['created_by'] == null ? undefined : json['created_by'],
|
||||
'createdAt': json['created_at'] == null ? undefined : (new Date(json['created_at'])),
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedImportLogToJSON(value?: PatchedImportLog | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'type': value.type,
|
||||
'msg': value.msg,
|
||||
'running': value.running,
|
||||
'total_recipes': value.totalRecipes,
|
||||
'imported_recipes': value.importedRecipes,
|
||||
'type': value['type'],
|
||||
'msg': value['msg'],
|
||||
'running': value['running'],
|
||||
'total_recipes': value['totalRecipes'],
|
||||
'imported_recipes': value['importedRecipes'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,17 +12,19 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { Food } from './Food';
|
||||
import {
|
||||
Food,
|
||||
FoodFromJSON,
|
||||
FoodFromJSONTyped,
|
||||
FoodToJSON,
|
||||
Unit,
|
||||
} from './Food';
|
||||
import type { Unit } from './Unit';
|
||||
import {
|
||||
UnitFromJSON,
|
||||
UnitFromJSONTyped,
|
||||
UnitToJSON,
|
||||
} from './';
|
||||
} from './Unit';
|
||||
|
||||
/**
|
||||
* Adds nested create feature
|
||||
@@ -41,13 +43,13 @@ export interface PatchedIngredient {
|
||||
* @type {Food}
|
||||
* @memberof PatchedIngredient
|
||||
*/
|
||||
food?: Food | null;
|
||||
food?: Food;
|
||||
/**
|
||||
*
|
||||
* @type {Unit}
|
||||
* @memberof PatchedIngredient
|
||||
*/
|
||||
unit?: Unit | null;
|
||||
unit?: Unit;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@@ -65,7 +67,7 @@ export interface PatchedIngredient {
|
||||
* @type {string}
|
||||
* @memberof PatchedIngredient
|
||||
*/
|
||||
note?: string | null;
|
||||
note?: string;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
@@ -89,7 +91,7 @@ export interface PatchedIngredient {
|
||||
* @type {string}
|
||||
* @memberof PatchedIngredient
|
||||
*/
|
||||
originalText?: string | null;
|
||||
originalText?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@@ -110,52 +112,55 @@ export interface PatchedIngredient {
|
||||
alwaysUsePluralFood?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedIngredient interface.
|
||||
*/
|
||||
export function instanceOfPatchedIngredient(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedIngredientFromJSON(json: any): PatchedIngredient {
|
||||
return PatchedIngredientFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PatchedIngredientFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedIngredient {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'food': !exists(json, 'food') ? undefined : FoodFromJSON(json['food']),
|
||||
'unit': !exists(json, 'unit') ? undefined : UnitFromJSON(json['unit']),
|
||||
'amount': !exists(json, 'amount') ? undefined : json['amount'],
|
||||
'conversions': !exists(json, 'conversions') ? undefined : json['conversions'],
|
||||
'note': !exists(json, 'note') ? undefined : json['note'],
|
||||
'order': !exists(json, 'order') ? undefined : json['order'],
|
||||
'isHeader': !exists(json, 'is_header') ? undefined : json['is_header'],
|
||||
'noAmount': !exists(json, 'no_amount') ? undefined : json['no_amount'],
|
||||
'originalText': !exists(json, 'original_text') ? undefined : json['original_text'],
|
||||
'usedInRecipes': !exists(json, 'used_in_recipes') ? undefined : json['used_in_recipes'],
|
||||
'alwaysUsePluralUnit': !exists(json, 'always_use_plural_unit') ? undefined : json['always_use_plural_unit'],
|
||||
'alwaysUsePluralFood': !exists(json, 'always_use_plural_food') ? undefined : json['always_use_plural_food'],
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'food': json['food'] == null ? undefined : FoodFromJSON(json['food']),
|
||||
'unit': json['unit'] == null ? undefined : UnitFromJSON(json['unit']),
|
||||
'amount': json['amount'] == null ? undefined : json['amount'],
|
||||
'conversions': json['conversions'] == null ? undefined : json['conversions'],
|
||||
'note': json['note'] == null ? undefined : json['note'],
|
||||
'order': json['order'] == null ? undefined : json['order'],
|
||||
'isHeader': json['is_header'] == null ? undefined : json['is_header'],
|
||||
'noAmount': json['no_amount'] == null ? undefined : json['no_amount'],
|
||||
'originalText': json['original_text'] == null ? undefined : json['original_text'],
|
||||
'usedInRecipes': json['used_in_recipes'] == null ? undefined : json['used_in_recipes'],
|
||||
'alwaysUsePluralUnit': json['always_use_plural_unit'] == null ? undefined : json['always_use_plural_unit'],
|
||||
'alwaysUsePluralFood': json['always_use_plural_food'] == null ? undefined : json['always_use_plural_food'],
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedIngredientToJSON(value?: PatchedIngredient | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'food': FoodToJSON(value.food),
|
||||
'unit': UnitToJSON(value.unit),
|
||||
'amount': value.amount,
|
||||
'note': value.note,
|
||||
'order': value.order,
|
||||
'is_header': value.isHeader,
|
||||
'no_amount': value.noAmount,
|
||||
'original_text': value.originalText,
|
||||
'always_use_plural_unit': value.alwaysUsePluralUnit,
|
||||
'always_use_plural_food': value.alwaysUsePluralFood,
|
||||
'food': FoodToJSON(value['food']),
|
||||
'unit': UnitToJSON(value['unit']),
|
||||
'amount': value['amount'],
|
||||
'note': value['note'],
|
||||
'order': value['order'],
|
||||
'is_header': value['isHeader'],
|
||||
'no_amount': value['noAmount'],
|
||||
'original_text': value['originalText'],
|
||||
'always_use_plural_unit': value['alwaysUsePluralUnit'],
|
||||
'always_use_plural_food': value['alwaysUsePluralFood'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { Group } from './Group';
|
||||
import {
|
||||
Group,
|
||||
GroupFromJSON,
|
||||
GroupFromJSONTyped,
|
||||
GroupToJSON,
|
||||
} from './';
|
||||
} from './Group';
|
||||
|
||||
/**
|
||||
* Adds nested create feature
|
||||
@@ -61,7 +61,7 @@ export interface PatchedInviteLink {
|
||||
* @type {number}
|
||||
* @memberof PatchedInviteLink
|
||||
*/
|
||||
usedBy?: number | null;
|
||||
usedBy?: number;
|
||||
/**
|
||||
*
|
||||
* @type {boolean}
|
||||
@@ -73,7 +73,7 @@ export interface PatchedInviteLink {
|
||||
* @type {string}
|
||||
* @memberof PatchedInviteLink
|
||||
*/
|
||||
internalNote?: string | null;
|
||||
internalNote?: string;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
@@ -88,45 +88,48 @@ export interface PatchedInviteLink {
|
||||
readonly createdAt?: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedInviteLink interface.
|
||||
*/
|
||||
export function instanceOfPatchedInviteLink(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedInviteLinkFromJSON(json: any): PatchedInviteLink {
|
||||
return PatchedInviteLinkFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PatchedInviteLinkFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedInviteLink {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'uuid': !exists(json, 'uuid') ? undefined : json['uuid'],
|
||||
'email': !exists(json, 'email') ? undefined : json['email'],
|
||||
'group': !exists(json, 'group') ? undefined : GroupFromJSON(json['group']),
|
||||
'validUntil': !exists(json, 'valid_until') ? undefined : (new Date(json['valid_until'])),
|
||||
'usedBy': !exists(json, 'used_by') ? undefined : json['used_by'],
|
||||
'reusable': !exists(json, 'reusable') ? undefined : json['reusable'],
|
||||
'internalNote': !exists(json, 'internal_note') ? undefined : json['internal_note'],
|
||||
'createdBy': !exists(json, 'created_by') ? undefined : json['created_by'],
|
||||
'createdAt': !exists(json, 'created_at') ? undefined : (new Date(json['created_at'])),
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'uuid': json['uuid'] == null ? undefined : json['uuid'],
|
||||
'email': json['email'] == null ? undefined : json['email'],
|
||||
'group': json['group'] == null ? undefined : GroupFromJSON(json['group']),
|
||||
'validUntil': json['valid_until'] == null ? undefined : (new Date(json['valid_until'])),
|
||||
'usedBy': json['used_by'] == null ? undefined : json['used_by'],
|
||||
'reusable': json['reusable'] == null ? undefined : json['reusable'],
|
||||
'internalNote': json['internal_note'] == null ? undefined : json['internal_note'],
|
||||
'createdBy': json['created_by'] == null ? undefined : json['created_by'],
|
||||
'createdAt': json['created_at'] == null ? undefined : (new Date(json['created_at'])),
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedInviteLinkToJSON(value?: PatchedInviteLink | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'email': value.email,
|
||||
'group': GroupToJSON(value.group),
|
||||
'valid_until': value.validUntil === undefined ? undefined : (value.validUntil.toISOString().substr(0,10)),
|
||||
'used_by': value.usedBy,
|
||||
'reusable': value.reusable,
|
||||
'internal_note': value.internalNote,
|
||||
'email': value['email'],
|
||||
'group': GroupToJSON(value['group']),
|
||||
'valid_until': value['validUntil'] == null ? undefined : ((value['validUntil']).toISOString().substring(0,10)),
|
||||
'used_by': value['usedBy'],
|
||||
'reusable': value['reusable'],
|
||||
'internal_note': value['internalNote'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,43 +12,43 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
* 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 PatchedKeyword
|
||||
*/
|
||||
@@ -109,40 +109,43 @@ export interface PatchedKeyword {
|
||||
readonly fullName?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedKeyword interface.
|
||||
*/
|
||||
export function instanceOfPatchedKeyword(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedKeywordFromJSON(json: any): PatchedKeyword {
|
||||
return PatchedKeywordFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PatchedKeywordFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedKeyword {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'name': !exists(json, 'name') ? undefined : json['name'],
|
||||
'label': !exists(json, 'label') ? undefined : json['label'],
|
||||
'description': !exists(json, 'description') ? undefined : json['description'],
|
||||
'parent': !exists(json, 'parent') ? undefined : json['parent'],
|
||||
'numchild': !exists(json, 'numchild') ? undefined : json['numchild'],
|
||||
'createdAt': !exists(json, 'created_at') ? undefined : (new Date(json['created_at'])),
|
||||
'updatedAt': !exists(json, 'updated_at') ? undefined : (new Date(json['updated_at'])),
|
||||
'fullName': !exists(json, 'full_name') ? undefined : json['full_name'],
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'name': json['name'] == null ? undefined : json['name'],
|
||||
'label': json['label'] == null ? undefined : json['label'],
|
||||
'description': json['description'] == null ? undefined : json['description'],
|
||||
'parent': json['parent'] == null ? undefined : json['parent'],
|
||||
'numchild': json['numchild'] == null ? undefined : json['numchild'],
|
||||
'createdAt': json['created_at'] == null ? undefined : (new Date(json['created_at'])),
|
||||
'updatedAt': json['updated_at'] == null ? undefined : (new Date(json['updated_at'])),
|
||||
'fullName': json['full_name'] == null ? undefined : json['full_name'],
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedKeywordToJSON(value?: PatchedKeyword | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'name': value.name,
|
||||
'description': value.description,
|
||||
'name': value['name'],
|
||||
'description': value['description'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,21 +12,25 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { MealType } from './MealType';
|
||||
import {
|
||||
MealType,
|
||||
MealTypeFromJSON,
|
||||
MealTypeFromJSONTyped,
|
||||
MealTypeToJSON,
|
||||
RecipeOverview,
|
||||
} from './MealType';
|
||||
import type { RecipeOverview } from './RecipeOverview';
|
||||
import {
|
||||
RecipeOverviewFromJSON,
|
||||
RecipeOverviewFromJSONTyped,
|
||||
RecipeOverviewToJSON,
|
||||
User,
|
||||
} from './RecipeOverview';
|
||||
import type { User } from './User';
|
||||
import {
|
||||
UserFromJSON,
|
||||
UserFromJSONTyped,
|
||||
UserToJSON,
|
||||
} from './';
|
||||
} from './User';
|
||||
|
||||
/**
|
||||
* Adds nested create feature
|
||||
@@ -51,7 +55,7 @@ export interface PatchedMealPlan {
|
||||
* @type {RecipeOverview}
|
||||
* @memberof PatchedMealPlan
|
||||
*/
|
||||
recipe?: RecipeOverview | null;
|
||||
recipe?: RecipeOverview;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@@ -99,7 +103,7 @@ export interface PatchedMealPlan {
|
||||
* @type {Array<User>}
|
||||
* @memberof PatchedMealPlan
|
||||
*/
|
||||
shared?: Array<User> | null;
|
||||
shared?: Array<User>;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@@ -120,51 +124,54 @@ export interface PatchedMealPlan {
|
||||
readonly shopping?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedMealPlan interface.
|
||||
*/
|
||||
export function instanceOfPatchedMealPlan(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedMealPlanFromJSON(json: any): PatchedMealPlan {
|
||||
return PatchedMealPlanFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PatchedMealPlanFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedMealPlan {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'title': !exists(json, 'title') ? undefined : json['title'],
|
||||
'recipe': !exists(json, 'recipe') ? undefined : RecipeOverviewFromJSON(json['recipe']),
|
||||
'servings': !exists(json, 'servings') ? undefined : json['servings'],
|
||||
'note': !exists(json, 'note') ? undefined : json['note'],
|
||||
'noteMarkdown': !exists(json, 'note_markdown') ? undefined : json['note_markdown'],
|
||||
'fromDate': !exists(json, 'from_date') ? undefined : (new Date(json['from_date'])),
|
||||
'toDate': !exists(json, 'to_date') ? undefined : (new Date(json['to_date'])),
|
||||
'mealType': !exists(json, 'meal_type') ? undefined : MealTypeFromJSON(json['meal_type']),
|
||||
'createdBy': !exists(json, 'created_by') ? undefined : json['created_by'],
|
||||
'shared': !exists(json, 'shared') ? undefined : (json['shared'] === null ? null : (json['shared'] as Array<any>).map(UserFromJSON)),
|
||||
'recipeName': !exists(json, 'recipe_name') ? undefined : json['recipe_name'],
|
||||
'mealTypeName': !exists(json, 'meal_type_name') ? undefined : json['meal_type_name'],
|
||||
'shopping': !exists(json, 'shopping') ? undefined : json['shopping'],
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'title': json['title'] == null ? undefined : json['title'],
|
||||
'recipe': json['recipe'] == null ? undefined : RecipeOverviewFromJSON(json['recipe']),
|
||||
'servings': json['servings'] == null ? undefined : json['servings'],
|
||||
'note': json['note'] == null ? undefined : json['note'],
|
||||
'noteMarkdown': json['note_markdown'] == null ? undefined : json['note_markdown'],
|
||||
'fromDate': json['from_date'] == null ? undefined : (new Date(json['from_date'])),
|
||||
'toDate': json['to_date'] == null ? undefined : (new Date(json['to_date'])),
|
||||
'mealType': json['meal_type'] == null ? undefined : MealTypeFromJSON(json['meal_type']),
|
||||
'createdBy': json['created_by'] == null ? undefined : json['created_by'],
|
||||
'shared': json['shared'] == null ? undefined : ((json['shared'] as Array<any>).map(UserFromJSON)),
|
||||
'recipeName': json['recipe_name'] == null ? undefined : json['recipe_name'],
|
||||
'mealTypeName': json['meal_type_name'] == null ? undefined : json['meal_type_name'],
|
||||
'shopping': json['shopping'] == null ? undefined : json['shopping'],
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedMealPlanToJSON(value?: PatchedMealPlan | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'title': value.title,
|
||||
'recipe': RecipeOverviewToJSON(value.recipe),
|
||||
'servings': value.servings,
|
||||
'note': value.note,
|
||||
'from_date': value.fromDate === undefined ? undefined : (value.fromDate.toISOString().substr(0,10)),
|
||||
'to_date': value.toDate === undefined ? undefined : (value.toDate.toISOString().substr(0,10)),
|
||||
'meal_type': MealTypeToJSON(value.mealType),
|
||||
'shared': value.shared === undefined ? undefined : (value.shared === null ? null : (value.shared as Array<any>).map(UserToJSON)),
|
||||
'title': value['title'],
|
||||
'recipe': RecipeOverviewToJSON(value['recipe']),
|
||||
'servings': value['servings'],
|
||||
'note': value['note'],
|
||||
'from_date': value['fromDate'] == null ? undefined : ((value['fromDate']).toISOString().substring(0,10)),
|
||||
'to_date': value['toDate'] == null ? undefined : ((value['toDate']).toISOString().substring(0,10)),
|
||||
'meal_type': MealTypeToJSON(value['mealType']),
|
||||
'shared': value['shared'] == null ? undefined : ((value['shared'] as Array<any>).map(UserToJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
* Adds nested create feature
|
||||
* @export
|
||||
@@ -42,7 +42,7 @@ export interface PatchedMealType {
|
||||
* @type {string}
|
||||
* @memberof PatchedMealType
|
||||
*/
|
||||
color?: string | null;
|
||||
color?: string;
|
||||
/**
|
||||
*
|
||||
* @type {boolean}
|
||||
@@ -57,39 +57,42 @@ export interface PatchedMealType {
|
||||
readonly createdBy?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedMealType interface.
|
||||
*/
|
||||
export function instanceOfPatchedMealType(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedMealTypeFromJSON(json: any): PatchedMealType {
|
||||
return PatchedMealTypeFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PatchedMealTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedMealType {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'name': !exists(json, 'name') ? undefined : json['name'],
|
||||
'order': !exists(json, 'order') ? undefined : json['order'],
|
||||
'color': !exists(json, 'color') ? undefined : json['color'],
|
||||
'_default': !exists(json, 'default') ? undefined : json['default'],
|
||||
'createdBy': !exists(json, 'created_by') ? undefined : json['created_by'],
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'name': json['name'] == null ? undefined : json['name'],
|
||||
'order': json['order'] == null ? undefined : json['order'],
|
||||
'color': json['color'] == null ? undefined : json['color'],
|
||||
'_default': json['default'] == null ? undefined : json['default'],
|
||||
'createdBy': json['created_by'] == null ? undefined : json['created_by'],
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedMealTypeToJSON(value?: PatchedMealType | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'name': value.name,
|
||||
'order': value.order,
|
||||
'color': value.color,
|
||||
'default': value._default,
|
||||
'name': value['name'],
|
||||
'order': value['order'],
|
||||
'color': value['color'],
|
||||
'default': value['_default'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,50 +12,50 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { OpenDataVersion } from './OpenDataVersion';
|
||||
import {
|
||||
OpenDataVersion,
|
||||
OpenDataVersionFromJSON,
|
||||
OpenDataVersionFromJSONTyped,
|
||||
OpenDataVersionToJSON,
|
||||
} from './';
|
||||
} from './OpenDataVersion';
|
||||
|
||||
/**
|
||||
* 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 PatchedOpenDataCategory
|
||||
*/
|
||||
@@ -104,41 +104,44 @@ export interface PatchedOpenDataCategory {
|
||||
readonly createdBy?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedOpenDataCategory interface.
|
||||
*/
|
||||
export function instanceOfPatchedOpenDataCategory(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedOpenDataCategoryFromJSON(json: any): PatchedOpenDataCategory {
|
||||
return PatchedOpenDataCategoryFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PatchedOpenDataCategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedOpenDataCategory {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'version': !exists(json, 'version') ? undefined : OpenDataVersionFromJSON(json['version']),
|
||||
'slug': !exists(json, 'slug') ? undefined : json['slug'],
|
||||
'name': !exists(json, 'name') ? undefined : json['name'],
|
||||
'description': !exists(json, 'description') ? undefined : json['description'],
|
||||
'comment': !exists(json, 'comment') ? undefined : json['comment'],
|
||||
'createdBy': !exists(json, 'created_by') ? undefined : json['created_by'],
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'version': json['version'] == null ? undefined : OpenDataVersionFromJSON(json['version']),
|
||||
'slug': json['slug'] == null ? undefined : json['slug'],
|
||||
'name': json['name'] == null ? undefined : json['name'],
|
||||
'description': json['description'] == null ? undefined : json['description'],
|
||||
'comment': json['comment'] == null ? undefined : json['comment'],
|
||||
'createdBy': json['created_by'] == null ? undefined : json['created_by'],
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedOpenDataCategoryToJSON(value?: PatchedOpenDataCategory | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'version': OpenDataVersionToJSON(value.version),
|
||||
'slug': value.slug,
|
||||
'name': value.name,
|
||||
'description': value.description,
|
||||
'comment': value.comment,
|
||||
'version': OpenDataVersionToJSON(value['version']),
|
||||
'slug': value['slug'],
|
||||
'name': value['name'],
|
||||
'description': value['description'],
|
||||
'comment': value['comment'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,21 +12,25 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { OpenDataFood } from './OpenDataFood';
|
||||
import {
|
||||
OpenDataFood,
|
||||
OpenDataFoodFromJSON,
|
||||
OpenDataFoodFromJSONTyped,
|
||||
OpenDataFoodToJSON,
|
||||
OpenDataUnit,
|
||||
} from './OpenDataFood';
|
||||
import type { OpenDataUnit } from './OpenDataUnit';
|
||||
import {
|
||||
OpenDataUnitFromJSON,
|
||||
OpenDataUnitFromJSONTyped,
|
||||
OpenDataUnitToJSON,
|
||||
OpenDataVersion,
|
||||
} from './OpenDataUnit';
|
||||
import type { OpenDataVersion } from './OpenDataVersion';
|
||||
import {
|
||||
OpenDataVersionFromJSON,
|
||||
OpenDataVersionFromJSONTyped,
|
||||
OpenDataVersionToJSON,
|
||||
} from './';
|
||||
} from './OpenDataVersion';
|
||||
|
||||
/**
|
||||
* Adds nested create feature
|
||||
@@ -102,49 +106,52 @@ export interface PatchedOpenDataConversion {
|
||||
readonly createdBy?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedOpenDataConversion interface.
|
||||
*/
|
||||
export function instanceOfPatchedOpenDataConversion(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedOpenDataConversionFromJSON(json: any): PatchedOpenDataConversion {
|
||||
return PatchedOpenDataConversionFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PatchedOpenDataConversionFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedOpenDataConversion {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'version': !exists(json, 'version') ? undefined : OpenDataVersionFromJSON(json['version']),
|
||||
'slug': !exists(json, 'slug') ? undefined : json['slug'],
|
||||
'food': !exists(json, 'food') ? undefined : OpenDataFoodFromJSON(json['food']),
|
||||
'baseAmount': !exists(json, 'base_amount') ? undefined : json['base_amount'],
|
||||
'baseUnit': !exists(json, 'base_unit') ? undefined : OpenDataUnitFromJSON(json['base_unit']),
|
||||
'convertedAmount': !exists(json, 'converted_amount') ? undefined : json['converted_amount'],
|
||||
'convertedUnit': !exists(json, 'converted_unit') ? undefined : OpenDataUnitFromJSON(json['converted_unit']),
|
||||
'source': !exists(json, 'source') ? undefined : json['source'],
|
||||
'comment': !exists(json, 'comment') ? undefined : json['comment'],
|
||||
'createdBy': !exists(json, 'created_by') ? undefined : json['created_by'],
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'version': json['version'] == null ? undefined : OpenDataVersionFromJSON(json['version']),
|
||||
'slug': json['slug'] == null ? undefined : json['slug'],
|
||||
'food': json['food'] == null ? undefined : OpenDataFoodFromJSON(json['food']),
|
||||
'baseAmount': json['base_amount'] == null ? undefined : json['base_amount'],
|
||||
'baseUnit': json['base_unit'] == null ? undefined : OpenDataUnitFromJSON(json['base_unit']),
|
||||
'convertedAmount': json['converted_amount'] == null ? undefined : json['converted_amount'],
|
||||
'convertedUnit': json['converted_unit'] == null ? undefined : OpenDataUnitFromJSON(json['converted_unit']),
|
||||
'source': json['source'] == null ? undefined : json['source'],
|
||||
'comment': json['comment'] == null ? undefined : json['comment'],
|
||||
'createdBy': json['created_by'] == null ? undefined : json['created_by'],
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedOpenDataConversionToJSON(value?: PatchedOpenDataConversion | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'version': OpenDataVersionToJSON(value.version),
|
||||
'slug': value.slug,
|
||||
'food': OpenDataFoodToJSON(value.food),
|
||||
'base_amount': value.baseAmount,
|
||||
'base_unit': OpenDataUnitToJSON(value.baseUnit),
|
||||
'converted_amount': value.convertedAmount,
|
||||
'converted_unit': OpenDataUnitToJSON(value.convertedUnit),
|
||||
'source': value.source,
|
||||
'comment': value.comment,
|
||||
'version': OpenDataVersionToJSON(value['version']),
|
||||
'slug': value['slug'],
|
||||
'food': OpenDataFoodToJSON(value['food']),
|
||||
'base_amount': value['baseAmount'],
|
||||
'base_unit': OpenDataUnitToJSON(value['baseUnit']),
|
||||
'converted_amount': value['convertedAmount'],
|
||||
'converted_unit': OpenDataUnitToJSON(value['convertedUnit']),
|
||||
'source': value['source'],
|
||||
'comment': value['comment'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,62 +12,68 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { OpenDataCategory } from './OpenDataCategory';
|
||||
import {
|
||||
OpenDataCategory,
|
||||
OpenDataCategoryFromJSON,
|
||||
OpenDataCategoryFromJSONTyped,
|
||||
OpenDataCategoryToJSON,
|
||||
OpenDataFoodProperty,
|
||||
} from './OpenDataCategory';
|
||||
import type { OpenDataFoodProperty } from './OpenDataFoodProperty';
|
||||
import {
|
||||
OpenDataFoodPropertyFromJSON,
|
||||
OpenDataFoodPropertyFromJSONTyped,
|
||||
OpenDataFoodPropertyToJSON,
|
||||
OpenDataUnit,
|
||||
} from './OpenDataFoodProperty';
|
||||
import type { OpenDataUnit } from './OpenDataUnit';
|
||||
import {
|
||||
OpenDataUnitFromJSON,
|
||||
OpenDataUnitFromJSONTyped,
|
||||
OpenDataUnitToJSON,
|
||||
OpenDataVersion,
|
||||
} from './OpenDataUnit';
|
||||
import type { OpenDataVersion } from './OpenDataVersion';
|
||||
import {
|
||||
OpenDataVersionFromJSON,
|
||||
OpenDataVersionFromJSONTyped,
|
||||
OpenDataVersionToJSON,
|
||||
} from './';
|
||||
} from './OpenDataVersion';
|
||||
|
||||
/**
|
||||
* 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 PatchedOpenDataFood
|
||||
*/
|
||||
@@ -113,31 +119,31 @@ export interface PatchedOpenDataFood {
|
||||
* @type {OpenDataUnit}
|
||||
* @memberof PatchedOpenDataFood
|
||||
*/
|
||||
preferredUnitMetric?: OpenDataUnit | null;
|
||||
preferredUnitMetric?: OpenDataUnit;
|
||||
/**
|
||||
*
|
||||
* @type {OpenDataUnit}
|
||||
* @memberof PatchedOpenDataFood
|
||||
*/
|
||||
preferredShoppingUnitMetric?: OpenDataUnit | null;
|
||||
preferredShoppingUnitMetric?: OpenDataUnit;
|
||||
/**
|
||||
*
|
||||
* @type {OpenDataUnit}
|
||||
* @memberof PatchedOpenDataFood
|
||||
*/
|
||||
preferredUnitImperial?: OpenDataUnit | null;
|
||||
preferredUnitImperial?: OpenDataUnit;
|
||||
/**
|
||||
*
|
||||
* @type {OpenDataUnit}
|
||||
* @memberof PatchedOpenDataFood
|
||||
*/
|
||||
preferredShoppingUnitImperial?: OpenDataUnit | null;
|
||||
preferredShoppingUnitImperial?: OpenDataUnit;
|
||||
/**
|
||||
*
|
||||
* @type {Array<OpenDataFoodProperty>}
|
||||
* @memberof PatchedOpenDataFood
|
||||
*/
|
||||
properties?: Array<OpenDataFoodProperty> | null;
|
||||
properties?: Array<OpenDataFoodProperty>;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
@@ -176,61 +182,64 @@ export interface PatchedOpenDataFood {
|
||||
readonly createdBy?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedOpenDataFood interface.
|
||||
*/
|
||||
export function instanceOfPatchedOpenDataFood(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedOpenDataFoodFromJSON(json: any): PatchedOpenDataFood {
|
||||
return PatchedOpenDataFoodFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PatchedOpenDataFoodFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedOpenDataFood {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'version': !exists(json, 'version') ? undefined : OpenDataVersionFromJSON(json['version']),
|
||||
'slug': !exists(json, 'slug') ? undefined : json['slug'],
|
||||
'name': !exists(json, 'name') ? undefined : json['name'],
|
||||
'pluralName': !exists(json, 'plural_name') ? undefined : json['plural_name'],
|
||||
'storeCategory': !exists(json, 'store_category') ? undefined : OpenDataCategoryFromJSON(json['store_category']),
|
||||
'preferredUnitMetric': !exists(json, 'preferred_unit_metric') ? undefined : OpenDataUnitFromJSON(json['preferred_unit_metric']),
|
||||
'preferredShoppingUnitMetric': !exists(json, 'preferred_shopping_unit_metric') ? undefined : OpenDataUnitFromJSON(json['preferred_shopping_unit_metric']),
|
||||
'preferredUnitImperial': !exists(json, 'preferred_unit_imperial') ? undefined : OpenDataUnitFromJSON(json['preferred_unit_imperial']),
|
||||
'preferredShoppingUnitImperial': !exists(json, 'preferred_shopping_unit_imperial') ? undefined : OpenDataUnitFromJSON(json['preferred_shopping_unit_imperial']),
|
||||
'properties': !exists(json, 'properties') ? undefined : (json['properties'] === null ? null : (json['properties'] as Array<any>).map(OpenDataFoodPropertyFromJSON)),
|
||||
'propertiesFoodAmount': !exists(json, 'properties_food_amount') ? undefined : json['properties_food_amount'],
|
||||
'propertiesFoodUnit': !exists(json, 'properties_food_unit') ? undefined : OpenDataUnitFromJSON(json['properties_food_unit']),
|
||||
'propertiesSource': !exists(json, 'properties_source') ? undefined : json['properties_source'],
|
||||
'fdcId': !exists(json, 'fdc_id') ? undefined : json['fdc_id'],
|
||||
'comment': !exists(json, 'comment') ? undefined : json['comment'],
|
||||
'createdBy': !exists(json, 'created_by') ? undefined : json['created_by'],
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'version': json['version'] == null ? undefined : OpenDataVersionFromJSON(json['version']),
|
||||
'slug': json['slug'] == null ? undefined : json['slug'],
|
||||
'name': json['name'] == null ? undefined : json['name'],
|
||||
'pluralName': json['plural_name'] == null ? undefined : json['plural_name'],
|
||||
'storeCategory': json['store_category'] == null ? undefined : OpenDataCategoryFromJSON(json['store_category']),
|
||||
'preferredUnitMetric': json['preferred_unit_metric'] == null ? undefined : OpenDataUnitFromJSON(json['preferred_unit_metric']),
|
||||
'preferredShoppingUnitMetric': json['preferred_shopping_unit_metric'] == null ? undefined : OpenDataUnitFromJSON(json['preferred_shopping_unit_metric']),
|
||||
'preferredUnitImperial': json['preferred_unit_imperial'] == null ? undefined : OpenDataUnitFromJSON(json['preferred_unit_imperial']),
|
||||
'preferredShoppingUnitImperial': json['preferred_shopping_unit_imperial'] == null ? undefined : OpenDataUnitFromJSON(json['preferred_shopping_unit_imperial']),
|
||||
'properties': json['properties'] == null ? undefined : ((json['properties'] as Array<any>).map(OpenDataFoodPropertyFromJSON)),
|
||||
'propertiesFoodAmount': json['properties_food_amount'] == null ? undefined : json['properties_food_amount'],
|
||||
'propertiesFoodUnit': json['properties_food_unit'] == null ? undefined : OpenDataUnitFromJSON(json['properties_food_unit']),
|
||||
'propertiesSource': json['properties_source'] == null ? undefined : json['properties_source'],
|
||||
'fdcId': json['fdc_id'] == null ? undefined : json['fdc_id'],
|
||||
'comment': json['comment'] == null ? undefined : json['comment'],
|
||||
'createdBy': json['created_by'] == null ? undefined : json['created_by'],
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedOpenDataFoodToJSON(value?: PatchedOpenDataFood | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'version': OpenDataVersionToJSON(value.version),
|
||||
'slug': value.slug,
|
||||
'name': value.name,
|
||||
'plural_name': value.pluralName,
|
||||
'store_category': OpenDataCategoryToJSON(value.storeCategory),
|
||||
'preferred_unit_metric': OpenDataUnitToJSON(value.preferredUnitMetric),
|
||||
'preferred_shopping_unit_metric': OpenDataUnitToJSON(value.preferredShoppingUnitMetric),
|
||||
'preferred_unit_imperial': OpenDataUnitToJSON(value.preferredUnitImperial),
|
||||
'preferred_shopping_unit_imperial': OpenDataUnitToJSON(value.preferredShoppingUnitImperial),
|
||||
'properties': value.properties === undefined ? undefined : (value.properties === null ? null : (value.properties as Array<any>).map(OpenDataFoodPropertyToJSON)),
|
||||
'properties_food_amount': value.propertiesFoodAmount,
|
||||
'properties_food_unit': OpenDataUnitToJSON(value.propertiesFoodUnit),
|
||||
'properties_source': value.propertiesSource,
|
||||
'fdc_id': value.fdcId,
|
||||
'comment': value.comment,
|
||||
'version': OpenDataVersionToJSON(value['version']),
|
||||
'slug': value['slug'],
|
||||
'name': value['name'],
|
||||
'plural_name': value['pluralName'],
|
||||
'store_category': OpenDataCategoryToJSON(value['storeCategory']),
|
||||
'preferred_unit_metric': OpenDataUnitToJSON(value['preferredUnitMetric']),
|
||||
'preferred_shopping_unit_metric': OpenDataUnitToJSON(value['preferredShoppingUnitMetric']),
|
||||
'preferred_unit_imperial': OpenDataUnitToJSON(value['preferredUnitImperial']),
|
||||
'preferred_shopping_unit_imperial': OpenDataUnitToJSON(value['preferredShoppingUnitImperial']),
|
||||
'properties': value['properties'] == null ? undefined : ((value['properties'] as Array<any>).map(OpenDataFoodPropertyToJSON)),
|
||||
'properties_food_amount': value['propertiesFoodAmount'],
|
||||
'properties_food_unit': OpenDataUnitToJSON(value['propertiesFoodUnit']),
|
||||
'properties_source': value['propertiesSource'],
|
||||
'fdc_id': value['fdcId'],
|
||||
'comment': value['comment'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,50 +12,50 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { OpenDataVersion } from './OpenDataVersion';
|
||||
import {
|
||||
OpenDataVersion,
|
||||
OpenDataVersionFromJSON,
|
||||
OpenDataVersionFromJSONTyped,
|
||||
OpenDataVersionToJSON,
|
||||
} from './';
|
||||
} from './OpenDataVersion';
|
||||
|
||||
/**
|
||||
* 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 PatchedOpenDataProperty
|
||||
*/
|
||||
@@ -95,7 +95,7 @@ export interface PatchedOpenDataProperty {
|
||||
* @type {number}
|
||||
* @memberof PatchedOpenDataProperty
|
||||
*/
|
||||
fdcId?: number | null;
|
||||
fdcId?: number;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@@ -110,43 +110,46 @@ export interface PatchedOpenDataProperty {
|
||||
readonly createdBy?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedOpenDataProperty interface.
|
||||
*/
|
||||
export function instanceOfPatchedOpenDataProperty(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedOpenDataPropertyFromJSON(json: any): PatchedOpenDataProperty {
|
||||
return PatchedOpenDataPropertyFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PatchedOpenDataPropertyFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedOpenDataProperty {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'version': !exists(json, 'version') ? undefined : OpenDataVersionFromJSON(json['version']),
|
||||
'slug': !exists(json, 'slug') ? undefined : json['slug'],
|
||||
'name': !exists(json, 'name') ? undefined : json['name'],
|
||||
'unit': !exists(json, 'unit') ? undefined : json['unit'],
|
||||
'fdcId': !exists(json, 'fdc_id') ? undefined : json['fdc_id'],
|
||||
'comment': !exists(json, 'comment') ? undefined : json['comment'],
|
||||
'createdBy': !exists(json, 'created_by') ? undefined : json['created_by'],
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'version': json['version'] == null ? undefined : OpenDataVersionFromJSON(json['version']),
|
||||
'slug': json['slug'] == null ? undefined : json['slug'],
|
||||
'name': json['name'] == null ? undefined : json['name'],
|
||||
'unit': json['unit'] == null ? undefined : json['unit'],
|
||||
'fdcId': json['fdc_id'] == null ? undefined : json['fdc_id'],
|
||||
'comment': json['comment'] == null ? undefined : json['comment'],
|
||||
'createdBy': json['created_by'] == null ? undefined : json['created_by'],
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedOpenDataPropertyToJSON(value?: PatchedOpenDataProperty | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'version': OpenDataVersionToJSON(value.version),
|
||||
'slug': value.slug,
|
||||
'name': value.name,
|
||||
'unit': value.unit,
|
||||
'fdc_id': value.fdcId,
|
||||
'comment': value.comment,
|
||||
'version': OpenDataVersionToJSON(value['version']),
|
||||
'slug': value['slug'],
|
||||
'name': value['name'],
|
||||
'unit': value['unit'],
|
||||
'fdc_id': value['fdcId'],
|
||||
'comment': value['comment'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,17 +12,19 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { OpenDataStoreCategory } from './OpenDataStoreCategory';
|
||||
import {
|
||||
OpenDataStoreCategory,
|
||||
OpenDataStoreCategoryFromJSON,
|
||||
OpenDataStoreCategoryFromJSONTyped,
|
||||
OpenDataStoreCategoryToJSON,
|
||||
OpenDataVersion,
|
||||
} from './OpenDataStoreCategory';
|
||||
import type { OpenDataVersion } from './OpenDataVersion';
|
||||
import {
|
||||
OpenDataVersionFromJSON,
|
||||
OpenDataVersionFromJSONTyped,
|
||||
OpenDataVersionToJSON,
|
||||
} from './';
|
||||
} from './OpenDataVersion';
|
||||
|
||||
/**
|
||||
* Adds nested create feature
|
||||
@@ -59,7 +61,7 @@ export interface PatchedOpenDataStore {
|
||||
* @type {Array<OpenDataStoreCategory>}
|
||||
* @memberof PatchedOpenDataStore
|
||||
*/
|
||||
categoryToStore?: Array<OpenDataStoreCategory> | null;
|
||||
categoryToStore?: Array<OpenDataStoreCategory>;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@@ -74,41 +76,44 @@ export interface PatchedOpenDataStore {
|
||||
readonly createdBy?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedOpenDataStore interface.
|
||||
*/
|
||||
export function instanceOfPatchedOpenDataStore(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedOpenDataStoreFromJSON(json: any): PatchedOpenDataStore {
|
||||
return PatchedOpenDataStoreFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PatchedOpenDataStoreFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedOpenDataStore {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'version': !exists(json, 'version') ? undefined : OpenDataVersionFromJSON(json['version']),
|
||||
'slug': !exists(json, 'slug') ? undefined : json['slug'],
|
||||
'name': !exists(json, 'name') ? undefined : json['name'],
|
||||
'categoryToStore': !exists(json, 'category_to_store') ? undefined : (json['category_to_store'] === null ? null : (json['category_to_store'] as Array<any>).map(OpenDataStoreCategoryFromJSON)),
|
||||
'comment': !exists(json, 'comment') ? undefined : json['comment'],
|
||||
'createdBy': !exists(json, 'created_by') ? undefined : json['created_by'],
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'version': json['version'] == null ? undefined : OpenDataVersionFromJSON(json['version']),
|
||||
'slug': json['slug'] == null ? undefined : json['slug'],
|
||||
'name': json['name'] == null ? undefined : json['name'],
|
||||
'categoryToStore': json['category_to_store'] == null ? undefined : ((json['category_to_store'] as Array<any>).map(OpenDataStoreCategoryFromJSON)),
|
||||
'comment': json['comment'] == null ? undefined : json['comment'],
|
||||
'createdBy': json['created_by'] == null ? undefined : json['created_by'],
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedOpenDataStoreToJSON(value?: PatchedOpenDataStore | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'version': OpenDataVersionToJSON(value.version),
|
||||
'slug': value.slug,
|
||||
'name': value.name,
|
||||
'category_to_store': value.categoryToStore === undefined ? undefined : (value.categoryToStore === null ? null : (value.categoryToStore as Array<any>).map(OpenDataStoreCategoryToJSON)),
|
||||
'comment': value.comment,
|
||||
'version': OpenDataVersionToJSON(value['version']),
|
||||
'slug': value['slug'],
|
||||
'name': value['name'],
|
||||
'category_to_store': value['categoryToStore'] == null ? undefined : ((value['categoryToStore'] as Array<any>).map(OpenDataStoreCategoryToJSON)),
|
||||
'comment': value['comment'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,62 +12,62 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { BaseUnitEnum } from './BaseUnitEnum';
|
||||
import {
|
||||
BaseUnitEnum,
|
||||
BaseUnitEnumFromJSON,
|
||||
BaseUnitEnumFromJSONTyped,
|
||||
BaseUnitEnumToJSON,
|
||||
BlankEnum,
|
||||
BlankEnumFromJSON,
|
||||
BlankEnumFromJSONTyped,
|
||||
BlankEnumToJSON,
|
||||
OpenDataUnitTypeEnum,
|
||||
} from './BaseUnitEnum';
|
||||
import type { OpenDataUnitTypeEnum } from './OpenDataUnitTypeEnum';
|
||||
import {
|
||||
OpenDataUnitTypeEnumFromJSON,
|
||||
OpenDataUnitTypeEnumFromJSONTyped,
|
||||
OpenDataUnitTypeEnumToJSON,
|
||||
OpenDataVersion,
|
||||
} from './OpenDataUnitTypeEnum';
|
||||
import type { OpenDataVersion } from './OpenDataVersion';
|
||||
import {
|
||||
OpenDataVersionFromJSON,
|
||||
OpenDataVersionFromJSONTyped,
|
||||
OpenDataVersionToJSON,
|
||||
} from './';
|
||||
} from './OpenDataVersion';
|
||||
|
||||
/**
|
||||
* 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 {BaseUnitEnum | BlankEnum}
|
||||
* @type {BaseUnitEnum}
|
||||
* @memberof PatchedOpenDataUnit
|
||||
*/
|
||||
baseUnit?: BaseUnitEnum | BlankEnum;
|
||||
baseUnit?: BaseUnitEnum;
|
||||
/**
|
||||
*
|
||||
* @type {OpenDataUnitTypeEnum}
|
||||
@@ -128,45 +128,48 @@ export interface PatchedOpenDataUnit {
|
||||
readonly createdBy?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedOpenDataUnit interface.
|
||||
*/
|
||||
export function instanceOfPatchedOpenDataUnit(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedOpenDataUnitFromJSON(json: any): PatchedOpenDataUnit {
|
||||
return PatchedOpenDataUnitFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PatchedOpenDataUnitFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedOpenDataUnit {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'version': !exists(json, 'version') ? undefined : OpenDataVersionFromJSON(json['version']),
|
||||
'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 : 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'],
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'version': json['version'] == null ? undefined : OpenDataVersionFromJSON(json['version']),
|
||||
'slug': json['slug'] == null ? undefined : json['slug'],
|
||||
'name': json['name'] == null ? undefined : json['name'],
|
||||
'pluralName': json['plural_name'] == null ? undefined : json['plural_name'],
|
||||
'baseUnit': json['base_unit'] == null ? undefined : BaseUnitEnumFromJSON(json['base_unit']),
|
||||
'type': json['type'] == null ? undefined : OpenDataUnitTypeEnumFromJSON(json['type']),
|
||||
'comment': json['comment'] == null ? undefined : json['comment'],
|
||||
'createdBy': json['created_by'] == null ? undefined : json['created_by'],
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedOpenDataUnitToJSON(value?: PatchedOpenDataUnit | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'version': OpenDataVersionToJSON(value.version),
|
||||
'slug': value.slug,
|
||||
'name': value.name,
|
||||
'plural_name': value.pluralName,
|
||||
'base_unit': BaseUnitEnum | BlankEnumToJSON(value.baseUnit),
|
||||
'type': OpenDataUnitTypeEnumToJSON(value.type),
|
||||
'comment': value.comment,
|
||||
'version': OpenDataVersionToJSON(value['version']),
|
||||
'slug': value['slug'],
|
||||
'name': value['name'],
|
||||
'plural_name': value['pluralName'],
|
||||
'base_unit': BaseUnitEnumToJSON(value['baseUnit']),
|
||||
'type': OpenDataUnitTypeEnumToJSON(value['type']),
|
||||
'comment': value['comment'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,43 +12,43 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
* 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 PatchedOpenDataVersion
|
||||
*/
|
||||
@@ -79,36 +79,39 @@ export interface PatchedOpenDataVersion {
|
||||
comment?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedOpenDataVersion interface.
|
||||
*/
|
||||
export function instanceOfPatchedOpenDataVersion(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedOpenDataVersionFromJSON(json: any): PatchedOpenDataVersion {
|
||||
return PatchedOpenDataVersionFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PatchedOpenDataVersionFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedOpenDataVersion {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'name': !exists(json, 'name') ? undefined : json['name'],
|
||||
'code': !exists(json, 'code') ? undefined : json['code'],
|
||||
'comment': !exists(json, 'comment') ? undefined : json['comment'],
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'name': json['name'] == null ? undefined : json['name'],
|
||||
'code': json['code'] == null ? undefined : json['code'],
|
||||
'comment': json['comment'] == null ? undefined : json['comment'],
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedOpenDataVersionToJSON(value?: PatchedOpenDataVersion | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'name': value.name,
|
||||
'code': value.code,
|
||||
'comment': value.comment,
|
||||
'name': value['name'],
|
||||
'code': value['code'],
|
||||
'comment': value['comment'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,50 +12,50 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { PropertyType } from './PropertyType';
|
||||
import {
|
||||
PropertyType,
|
||||
PropertyTypeFromJSON,
|
||||
PropertyTypeFromJSONTyped,
|
||||
PropertyTypeToJSON,
|
||||
} from './';
|
||||
} 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.
|
||||
* 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 PatchedProperty
|
||||
*/
|
||||
@@ -71,7 +71,7 @@ export interface PatchedProperty {
|
||||
* @type {string}
|
||||
* @memberof PatchedProperty
|
||||
*/
|
||||
propertyAmount?: string | null;
|
||||
propertyAmount?: string;
|
||||
/**
|
||||
*
|
||||
* @type {PropertyType}
|
||||
@@ -80,34 +80,37 @@ export interface PatchedProperty {
|
||||
propertyType?: PropertyType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedProperty interface.
|
||||
*/
|
||||
export function instanceOfPatchedProperty(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedPropertyFromJSON(json: any): PatchedProperty {
|
||||
return PatchedPropertyFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PatchedPropertyFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedProperty {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'propertyAmount': !exists(json, 'property_amount') ? undefined : json['property_amount'],
|
||||
'propertyType': !exists(json, 'property_type') ? undefined : PropertyTypeFromJSON(json['property_type']),
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'propertyAmount': json['property_amount'] == null ? undefined : json['property_amount'],
|
||||
'propertyType': json['property_type'] == null ? undefined : PropertyTypeFromJSON(json['property_type']),
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedPropertyToJSON(value?: PatchedProperty | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'property_amount': value.propertyAmount,
|
||||
'property_type': PropertyTypeToJSON(value.propertyType),
|
||||
'property_amount': value['propertyAmount'],
|
||||
'property_type': PropertyTypeToJSON(value['propertyType']),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
* Adds nested create feature
|
||||
* @export
|
||||
@@ -36,13 +36,13 @@ export interface PatchedPropertyType {
|
||||
* @type {string}
|
||||
* @memberof PatchedPropertyType
|
||||
*/
|
||||
unit?: string | null;
|
||||
unit?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PatchedPropertyType
|
||||
*/
|
||||
description?: string | null;
|
||||
description?: string;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
@@ -54,13 +54,20 @@ export interface PatchedPropertyType {
|
||||
* @type {string}
|
||||
* @memberof PatchedPropertyType
|
||||
*/
|
||||
openDataSlug?: string | null;
|
||||
openDataSlug?: string;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof PatchedPropertyType
|
||||
*/
|
||||
fdcId?: number | null;
|
||||
fdcId?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedPropertyType interface.
|
||||
*/
|
||||
export function instanceOfPatchedPropertyType(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedPropertyTypeFromJSON(json: any): PatchedPropertyType {
|
||||
@@ -68,38 +75,34 @@ export function PatchedPropertyTypeFromJSON(json: any): PatchedPropertyType {
|
||||
}
|
||||
|
||||
export function PatchedPropertyTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedPropertyType {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'name': !exists(json, 'name') ? undefined : json['name'],
|
||||
'unit': !exists(json, 'unit') ? undefined : json['unit'],
|
||||
'description': !exists(json, 'description') ? undefined : json['description'],
|
||||
'order': !exists(json, 'order') ? undefined : json['order'],
|
||||
'openDataSlug': !exists(json, 'open_data_slug') ? undefined : json['open_data_slug'],
|
||||
'fdcId': !exists(json, 'fdc_id') ? undefined : json['fdc_id'],
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'name': json['name'] == null ? undefined : json['name'],
|
||||
'unit': json['unit'] == null ? undefined : json['unit'],
|
||||
'description': json['description'] == null ? undefined : json['description'],
|
||||
'order': json['order'] == null ? undefined : json['order'],
|
||||
'openDataSlug': json['open_data_slug'] == null ? undefined : json['open_data_slug'],
|
||||
'fdcId': json['fdc_id'] == null ? undefined : json['fdc_id'],
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedPropertyTypeToJSON(value?: PatchedPropertyType | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': value.id,
|
||||
'name': value.name,
|
||||
'unit': value.unit,
|
||||
'description': value.description,
|
||||
'order': value.order,
|
||||
'open_data_slug': value.openDataSlug,
|
||||
'fdc_id': value.fdcId,
|
||||
'id': value['id'],
|
||||
'name': value['name'],
|
||||
'unit': value['unit'],
|
||||
'description': value['description'],
|
||||
'order': value['order'],
|
||||
'open_data_slug': value['openDataSlug'],
|
||||
'fdc_id': value['fdcId'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,29 +12,37 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { Keyword } from './Keyword';
|
||||
import {
|
||||
Keyword,
|
||||
KeywordFromJSON,
|
||||
KeywordFromJSONTyped,
|
||||
KeywordToJSON,
|
||||
NutritionInformation,
|
||||
} from './Keyword';
|
||||
import type { NutritionInformation } from './NutritionInformation';
|
||||
import {
|
||||
NutritionInformationFromJSON,
|
||||
NutritionInformationFromJSONTyped,
|
||||
NutritionInformationToJSON,
|
||||
Property,
|
||||
} from './NutritionInformation';
|
||||
import type { Property } from './Property';
|
||||
import {
|
||||
PropertyFromJSON,
|
||||
PropertyFromJSONTyped,
|
||||
PropertyToJSON,
|
||||
Step,
|
||||
} from './Property';
|
||||
import type { Step } from './Step';
|
||||
import {
|
||||
StepFromJSON,
|
||||
StepFromJSONTyped,
|
||||
StepToJSON,
|
||||
User,
|
||||
} from './Step';
|
||||
import type { User } from './User';
|
||||
import {
|
||||
UserFromJSON,
|
||||
UserFromJSONTyped,
|
||||
UserToJSON,
|
||||
} from './';
|
||||
} from './User';
|
||||
|
||||
/**
|
||||
* Adds nested create feature
|
||||
@@ -59,13 +67,13 @@ export interface PatchedRecipe {
|
||||
* @type {string}
|
||||
* @memberof PatchedRecipe
|
||||
*/
|
||||
description?: string | null;
|
||||
description?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PatchedRecipe
|
||||
*/
|
||||
readonly image?: string | null;
|
||||
readonly image?: string;
|
||||
/**
|
||||
*
|
||||
* @type {Array<Keyword>}
|
||||
@@ -113,7 +121,7 @@ export interface PatchedRecipe {
|
||||
* @type {string}
|
||||
* @memberof PatchedRecipe
|
||||
*/
|
||||
sourceUrl?: string | null;
|
||||
sourceUrl?: string;
|
||||
/**
|
||||
*
|
||||
* @type {boolean}
|
||||
@@ -131,7 +139,7 @@ export interface PatchedRecipe {
|
||||
* @type {NutritionInformation}
|
||||
* @memberof PatchedRecipe
|
||||
*/
|
||||
nutrition?: NutritionInformation | null;
|
||||
nutrition?: NutritionInformation;
|
||||
/**
|
||||
*
|
||||
* @type {Array<Property>}
|
||||
@@ -167,13 +175,13 @@ export interface PatchedRecipe {
|
||||
* @type {string}
|
||||
* @memberof PatchedRecipe
|
||||
*/
|
||||
readonly rating?: string | null;
|
||||
readonly rating?: string;
|
||||
/**
|
||||
*
|
||||
* @type {Date}
|
||||
* @memberof PatchedRecipe
|
||||
*/
|
||||
readonly lastCooked?: Date | null;
|
||||
readonly lastCooked?: Date;
|
||||
/**
|
||||
*
|
||||
* @type {boolean}
|
||||
@@ -188,69 +196,72 @@ export interface PatchedRecipe {
|
||||
shared?: Array<User>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedRecipe interface.
|
||||
*/
|
||||
export function instanceOfPatchedRecipe(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedRecipeFromJSON(json: any): PatchedRecipe {
|
||||
return PatchedRecipeFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PatchedRecipeFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedRecipe {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'name': !exists(json, 'name') ? undefined : json['name'],
|
||||
'description': !exists(json, 'description') ? undefined : json['description'],
|
||||
'image': !exists(json, 'image') ? undefined : json['image'],
|
||||
'keywords': !exists(json, 'keywords') ? undefined : ((json['keywords'] as Array<any>).map(KeywordFromJSON)),
|
||||
'steps': !exists(json, 'steps') ? undefined : ((json['steps'] as Array<any>).map(StepFromJSON)),
|
||||
'workingTime': !exists(json, 'working_time') ? undefined : json['working_time'],
|
||||
'waitingTime': !exists(json, 'waiting_time') ? undefined : json['waiting_time'],
|
||||
'createdBy': !exists(json, 'created_by') ? undefined : json['created_by'],
|
||||
'createdAt': !exists(json, 'created_at') ? undefined : (new Date(json['created_at'])),
|
||||
'updatedAt': !exists(json, 'updated_at') ? undefined : (new Date(json['updated_at'])),
|
||||
'sourceUrl': !exists(json, 'source_url') ? undefined : json['source_url'],
|
||||
'internal': !exists(json, 'internal') ? undefined : json['internal'],
|
||||
'showIngredientOverview': !exists(json, 'show_ingredient_overview') ? undefined : json['show_ingredient_overview'],
|
||||
'nutrition': !exists(json, 'nutrition') ? undefined : NutritionInformationFromJSON(json['nutrition']),
|
||||
'properties': !exists(json, 'properties') ? undefined : ((json['properties'] as Array<any>).map(PropertyFromJSON)),
|
||||
'foodProperties': !exists(json, 'food_properties') ? undefined : json['food_properties'],
|
||||
'servings': !exists(json, 'servings') ? undefined : json['servings'],
|
||||
'filePath': !exists(json, 'file_path') ? undefined : json['file_path'],
|
||||
'servingsText': !exists(json, 'servings_text') ? undefined : json['servings_text'],
|
||||
'rating': !exists(json, 'rating') ? undefined : json['rating'],
|
||||
'lastCooked': !exists(json, 'last_cooked') ? undefined : (json['last_cooked'] === null ? null : new Date(json['last_cooked'])),
|
||||
'_private': !exists(json, 'private') ? undefined : json['private'],
|
||||
'shared': !exists(json, 'shared') ? undefined : ((json['shared'] as Array<any>).map(UserFromJSON)),
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'name': json['name'] == null ? undefined : json['name'],
|
||||
'description': json['description'] == null ? undefined : json['description'],
|
||||
'image': json['image'] == null ? undefined : json['image'],
|
||||
'keywords': json['keywords'] == null ? undefined : ((json['keywords'] as Array<any>).map(KeywordFromJSON)),
|
||||
'steps': json['steps'] == null ? undefined : ((json['steps'] as Array<any>).map(StepFromJSON)),
|
||||
'workingTime': json['working_time'] == null ? undefined : json['working_time'],
|
||||
'waitingTime': json['waiting_time'] == null ? undefined : json['waiting_time'],
|
||||
'createdBy': json['created_by'] == null ? undefined : json['created_by'],
|
||||
'createdAt': json['created_at'] == null ? undefined : (new Date(json['created_at'])),
|
||||
'updatedAt': json['updated_at'] == null ? undefined : (new Date(json['updated_at'])),
|
||||
'sourceUrl': json['source_url'] == null ? undefined : json['source_url'],
|
||||
'internal': json['internal'] == null ? undefined : json['internal'],
|
||||
'showIngredientOverview': json['show_ingredient_overview'] == null ? undefined : json['show_ingredient_overview'],
|
||||
'nutrition': json['nutrition'] == null ? undefined : NutritionInformationFromJSON(json['nutrition']),
|
||||
'properties': json['properties'] == null ? undefined : ((json['properties'] as Array<any>).map(PropertyFromJSON)),
|
||||
'foodProperties': json['food_properties'] == null ? undefined : json['food_properties'],
|
||||
'servings': json['servings'] == null ? undefined : json['servings'],
|
||||
'filePath': json['file_path'] == null ? undefined : json['file_path'],
|
||||
'servingsText': json['servings_text'] == null ? undefined : json['servings_text'],
|
||||
'rating': json['rating'] == null ? undefined : json['rating'],
|
||||
'lastCooked': json['last_cooked'] == null ? undefined : (new Date(json['last_cooked'])),
|
||||
'_private': json['private'] == null ? undefined : json['private'],
|
||||
'shared': json['shared'] == null ? undefined : ((json['shared'] as Array<any>).map(UserFromJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedRecipeToJSON(value?: PatchedRecipe | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'name': value.name,
|
||||
'description': value.description,
|
||||
'keywords': value.keywords === undefined ? undefined : ((value.keywords as Array<any>).map(KeywordToJSON)),
|
||||
'steps': value.steps === undefined ? undefined : ((value.steps as Array<any>).map(StepToJSON)),
|
||||
'working_time': value.workingTime,
|
||||
'waiting_time': value.waitingTime,
|
||||
'source_url': value.sourceUrl,
|
||||
'internal': value.internal,
|
||||
'show_ingredient_overview': value.showIngredientOverview,
|
||||
'nutrition': NutritionInformationToJSON(value.nutrition),
|
||||
'properties': value.properties === undefined ? undefined : ((value.properties as Array<any>).map(PropertyToJSON)),
|
||||
'servings': value.servings,
|
||||
'file_path': value.filePath,
|
||||
'servings_text': value.servingsText,
|
||||
'private': value._private,
|
||||
'shared': value.shared === undefined ? undefined : ((value.shared as Array<any>).map(UserToJSON)),
|
||||
'name': value['name'],
|
||||
'description': value['description'],
|
||||
'keywords': value['keywords'] == null ? undefined : ((value['keywords'] as Array<any>).map(KeywordToJSON)),
|
||||
'steps': value['steps'] == null ? undefined : ((value['steps'] as Array<any>).map(StepToJSON)),
|
||||
'working_time': value['workingTime'],
|
||||
'waiting_time': value['waitingTime'],
|
||||
'source_url': value['sourceUrl'],
|
||||
'internal': value['internal'],
|
||||
'show_ingredient_overview': value['showIngredientOverview'],
|
||||
'nutrition': NutritionInformationToJSON(value['nutrition']),
|
||||
'properties': value['properties'] == null ? undefined : ((value['properties'] as Array<any>).map(PropertyToJSON)),
|
||||
'servings': value['servings'],
|
||||
'file_path': value['filePath'],
|
||||
'servings_text': value['servingsText'],
|
||||
'private': value['_private'],
|
||||
'shared': value['shared'] == null ? undefined : ((value['shared'] as Array<any>).map(UserToJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,17 +12,19 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { CustomFilter } from './CustomFilter';
|
||||
import {
|
||||
CustomFilter,
|
||||
CustomFilterFromJSON,
|
||||
CustomFilterFromJSONTyped,
|
||||
CustomFilterToJSON,
|
||||
User,
|
||||
} from './CustomFilter';
|
||||
import type { User } from './User';
|
||||
import {
|
||||
UserFromJSON,
|
||||
UserFromJSONTyped,
|
||||
UserToJSON,
|
||||
} from './';
|
||||
} from './User';
|
||||
|
||||
/**
|
||||
* Adds nested create feature
|
||||
@@ -65,7 +67,7 @@ export interface PatchedRecipeBook {
|
||||
* @type {CustomFilter}
|
||||
* @memberof PatchedRecipeBook
|
||||
*/
|
||||
filter?: CustomFilter | null;
|
||||
filter?: CustomFilter;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
@@ -74,41 +76,44 @@ export interface PatchedRecipeBook {
|
||||
order?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedRecipeBook interface.
|
||||
*/
|
||||
export function instanceOfPatchedRecipeBook(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedRecipeBookFromJSON(json: any): PatchedRecipeBook {
|
||||
return PatchedRecipeBookFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PatchedRecipeBookFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedRecipeBook {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'name': !exists(json, 'name') ? undefined : json['name'],
|
||||
'description': !exists(json, 'description') ? undefined : json['description'],
|
||||
'shared': !exists(json, 'shared') ? undefined : ((json['shared'] as Array<any>).map(UserFromJSON)),
|
||||
'createdBy': !exists(json, 'created_by') ? undefined : json['created_by'],
|
||||
'filter': !exists(json, 'filter') ? undefined : CustomFilterFromJSON(json['filter']),
|
||||
'order': !exists(json, 'order') ? undefined : json['order'],
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'name': json['name'] == null ? undefined : json['name'],
|
||||
'description': json['description'] == null ? undefined : json['description'],
|
||||
'shared': json['shared'] == null ? undefined : ((json['shared'] as Array<any>).map(UserFromJSON)),
|
||||
'createdBy': json['created_by'] == null ? undefined : json['created_by'],
|
||||
'filter': json['filter'] == null ? undefined : CustomFilterFromJSON(json['filter']),
|
||||
'order': json['order'] == null ? undefined : json['order'],
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedRecipeBookToJSON(value?: PatchedRecipeBook | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'name': value.name,
|
||||
'description': value.description,
|
||||
'shared': value.shared === undefined ? undefined : ((value.shared as Array<any>).map(UserToJSON)),
|
||||
'filter': CustomFilterToJSON(value.filter),
|
||||
'order': value.order,
|
||||
'name': value['name'],
|
||||
'description': value['description'],
|
||||
'shared': value['shared'] == null ? undefined : ((value['shared'] as Array<any>).map(UserToJSON)),
|
||||
'filter': CustomFilterToJSON(value['filter']),
|
||||
'order': value['order'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
@@ -51,36 +51,39 @@ export interface PatchedRecipeBookEntry {
|
||||
readonly recipeContent?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedRecipeBookEntry interface.
|
||||
*/
|
||||
export function instanceOfPatchedRecipeBookEntry(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedRecipeBookEntryFromJSON(json: any): PatchedRecipeBookEntry {
|
||||
return PatchedRecipeBookEntryFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PatchedRecipeBookEntryFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedRecipeBookEntry {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'book': !exists(json, 'book') ? undefined : json['book'],
|
||||
'bookContent': !exists(json, 'book_content') ? undefined : json['book_content'],
|
||||
'recipe': !exists(json, 'recipe') ? undefined : json['recipe'],
|
||||
'recipeContent': !exists(json, 'recipe_content') ? undefined : json['recipe_content'],
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'book': json['book'] == null ? undefined : json['book'],
|
||||
'bookContent': json['book_content'] == null ? undefined : json['book_content'],
|
||||
'recipe': json['recipe'] == null ? undefined : json['recipe'],
|
||||
'recipeContent': json['recipe_content'] == null ? undefined : json['recipe_content'],
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedRecipeBookEntryToJSON(value?: PatchedRecipeBookEntry | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'book': value.book,
|
||||
'recipe': value.recipe,
|
||||
'book': value['book'],
|
||||
'recipe': value['recipe'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,25 +12,31 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { Food } from './Food';
|
||||
import {
|
||||
Food,
|
||||
FoodFromJSON,
|
||||
FoodFromJSONTyped,
|
||||
FoodToJSON,
|
||||
ShoppingListRecipe,
|
||||
} from './Food';
|
||||
import type { ShoppingListRecipe } from './ShoppingListRecipe';
|
||||
import {
|
||||
ShoppingListRecipeFromJSON,
|
||||
ShoppingListRecipeFromJSONTyped,
|
||||
ShoppingListRecipeToJSON,
|
||||
Unit,
|
||||
} from './ShoppingListRecipe';
|
||||
import type { Unit } from './Unit';
|
||||
import {
|
||||
UnitFromJSON,
|
||||
UnitFromJSONTyped,
|
||||
UnitToJSON,
|
||||
User,
|
||||
} from './Unit';
|
||||
import type { User } from './User';
|
||||
import {
|
||||
UserFromJSON,
|
||||
UserFromJSONTyped,
|
||||
UserToJSON,
|
||||
} from './';
|
||||
} from './User';
|
||||
|
||||
/**
|
||||
* Adds nested create feature
|
||||
@@ -49,19 +55,19 @@ export interface PatchedShoppingListEntry {
|
||||
* @type {number}
|
||||
* @memberof PatchedShoppingListEntry
|
||||
*/
|
||||
listRecipe?: number | null;
|
||||
listRecipe?: number;
|
||||
/**
|
||||
*
|
||||
* @type {Food}
|
||||
* @memberof PatchedShoppingListEntry
|
||||
*/
|
||||
food?: Food | null;
|
||||
food?: Food;
|
||||
/**
|
||||
*
|
||||
* @type {Unit}
|
||||
* @memberof PatchedShoppingListEntry
|
||||
*/
|
||||
unit?: Unit | null;
|
||||
unit?: Unit;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@@ -109,13 +115,20 @@ export interface PatchedShoppingListEntry {
|
||||
* @type {Date}
|
||||
* @memberof PatchedShoppingListEntry
|
||||
*/
|
||||
completedAt?: Date | null;
|
||||
completedAt?: Date;
|
||||
/**
|
||||
*
|
||||
* @type {Date}
|
||||
* @memberof PatchedShoppingListEntry
|
||||
*/
|
||||
delayUntil?: Date | null;
|
||||
delayUntil?: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedShoppingListEntry interface.
|
||||
*/
|
||||
export function instanceOfPatchedShoppingListEntry(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedShoppingListEntryFromJSON(json: any): PatchedShoppingListEntry {
|
||||
@@ -123,45 +136,41 @@ export function PatchedShoppingListEntryFromJSON(json: any): PatchedShoppingList
|
||||
}
|
||||
|
||||
export function PatchedShoppingListEntryFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedShoppingListEntry {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'listRecipe': !exists(json, 'list_recipe') ? undefined : json['list_recipe'],
|
||||
'food': !exists(json, 'food') ? undefined : FoodFromJSON(json['food']),
|
||||
'unit': !exists(json, 'unit') ? undefined : UnitFromJSON(json['unit']),
|
||||
'amount': !exists(json, 'amount') ? undefined : json['amount'],
|
||||
'order': !exists(json, 'order') ? undefined : json['order'],
|
||||
'checked': !exists(json, 'checked') ? undefined : json['checked'],
|
||||
'recipeMealplan': !exists(json, 'recipe_mealplan') ? undefined : ShoppingListRecipeFromJSON(json['recipe_mealplan']),
|
||||
'createdBy': !exists(json, 'created_by') ? undefined : UserFromJSON(json['created_by']),
|
||||
'createdAt': !exists(json, 'created_at') ? undefined : (new Date(json['created_at'])),
|
||||
'updatedAt': !exists(json, 'updated_at') ? undefined : (new Date(json['updated_at'])),
|
||||
'completedAt': !exists(json, 'completed_at') ? undefined : (json['completed_at'] === null ? null : new Date(json['completed_at'])),
|
||||
'delayUntil': !exists(json, 'delay_until') ? undefined : (json['delay_until'] === null ? null : new Date(json['delay_until'])),
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'listRecipe': json['list_recipe'] == null ? undefined : json['list_recipe'],
|
||||
'food': json['food'] == null ? undefined : FoodFromJSON(json['food']),
|
||||
'unit': json['unit'] == null ? undefined : UnitFromJSON(json['unit']),
|
||||
'amount': json['amount'] == null ? undefined : json['amount'],
|
||||
'order': json['order'] == null ? undefined : json['order'],
|
||||
'checked': json['checked'] == null ? undefined : json['checked'],
|
||||
'recipeMealplan': json['recipe_mealplan'] == null ? undefined : ShoppingListRecipeFromJSON(json['recipe_mealplan']),
|
||||
'createdBy': json['created_by'] == null ? undefined : UserFromJSON(json['created_by']),
|
||||
'createdAt': json['created_at'] == null ? undefined : (new Date(json['created_at'])),
|
||||
'updatedAt': json['updated_at'] == null ? undefined : (new Date(json['updated_at'])),
|
||||
'completedAt': json['completed_at'] == null ? undefined : (new Date(json['completed_at'])),
|
||||
'delayUntil': json['delay_until'] == null ? undefined : (new Date(json['delay_until'])),
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedShoppingListEntryToJSON(value?: PatchedShoppingListEntry | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'list_recipe': value.listRecipe,
|
||||
'food': FoodToJSON(value.food),
|
||||
'unit': UnitToJSON(value.unit),
|
||||
'amount': value.amount,
|
||||
'order': value.order,
|
||||
'checked': value.checked,
|
||||
'completed_at': value.completedAt === undefined ? undefined : (value.completedAt === null ? null : value.completedAt.toISOString()),
|
||||
'delay_until': value.delayUntil === undefined ? undefined : (value.delayUntil === null ? null : value.delayUntil.toISOString()),
|
||||
'list_recipe': value['listRecipe'],
|
||||
'food': FoodToJSON(value['food']),
|
||||
'unit': UnitToJSON(value['unit']),
|
||||
'amount': value['amount'],
|
||||
'order': value['order'],
|
||||
'checked': value['checked'],
|
||||
'completed_at': value['completedAt'] == null ? undefined : ((value['completedAt'] as any).toISOString()),
|
||||
'delay_until': value['delayUntil'] == null ? undefined : ((value['delayUntil'] as any).toISOString()),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
@@ -42,13 +42,13 @@ export interface PatchedShoppingListRecipe {
|
||||
* @type {number}
|
||||
* @memberof PatchedShoppingListRecipe
|
||||
*/
|
||||
recipe?: number | null;
|
||||
recipe?: number;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof PatchedShoppingListRecipe
|
||||
*/
|
||||
mealplan?: number | null;
|
||||
mealplan?: number;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@@ -75,41 +75,44 @@ export interface PatchedShoppingListRecipe {
|
||||
readonly mealplanType?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedShoppingListRecipe interface.
|
||||
*/
|
||||
export function instanceOfPatchedShoppingListRecipe(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedShoppingListRecipeFromJSON(json: any): PatchedShoppingListRecipe {
|
||||
return PatchedShoppingListRecipeFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PatchedShoppingListRecipeFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedShoppingListRecipe {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'recipeName': !exists(json, 'recipe_name') ? undefined : json['recipe_name'],
|
||||
'name': !exists(json, 'name') ? undefined : json['name'],
|
||||
'recipe': !exists(json, 'recipe') ? undefined : json['recipe'],
|
||||
'mealplan': !exists(json, 'mealplan') ? undefined : json['mealplan'],
|
||||
'servings': !exists(json, 'servings') ? undefined : json['servings'],
|
||||
'mealplanNote': !exists(json, 'mealplan_note') ? undefined : json['mealplan_note'],
|
||||
'mealplanFromDate': !exists(json, 'mealplan_from_date') ? undefined : (new Date(json['mealplan_from_date'])),
|
||||
'mealplanType': !exists(json, 'mealplan_type') ? undefined : json['mealplan_type'],
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'recipeName': json['recipe_name'] == null ? undefined : json['recipe_name'],
|
||||
'name': json['name'] == null ? undefined : json['name'],
|
||||
'recipe': json['recipe'] == null ? undefined : json['recipe'],
|
||||
'mealplan': json['mealplan'] == null ? undefined : json['mealplan'],
|
||||
'servings': json['servings'] == null ? undefined : json['servings'],
|
||||
'mealplanNote': json['mealplan_note'] == null ? undefined : json['mealplan_note'],
|
||||
'mealplanFromDate': json['mealplan_from_date'] == null ? undefined : (new Date(json['mealplan_from_date'])),
|
||||
'mealplanType': json['mealplan_type'] == null ? undefined : json['mealplan_type'],
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedShoppingListRecipeToJSON(value?: PatchedShoppingListRecipe | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'recipe': value.recipe,
|
||||
'mealplan': value.mealplan,
|
||||
'servings': value.servings,
|
||||
'recipe': value['recipe'],
|
||||
'mealplan': value['mealplan'],
|
||||
'servings': value['servings'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,25 +12,31 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { FoodInheritField } from './FoodInheritField';
|
||||
import {
|
||||
FoodInheritField,
|
||||
FoodInheritFieldFromJSON,
|
||||
FoodInheritFieldFromJSONTyped,
|
||||
FoodInheritFieldToJSON,
|
||||
SpaceNavTextColorEnum,
|
||||
} from './FoodInheritField';
|
||||
import type { SpaceNavTextColorEnum } from './SpaceNavTextColorEnum';
|
||||
import {
|
||||
SpaceNavTextColorEnumFromJSON,
|
||||
SpaceNavTextColorEnumFromJSONTyped,
|
||||
SpaceNavTextColorEnumToJSON,
|
||||
SpaceThemeEnum,
|
||||
} from './SpaceNavTextColorEnum';
|
||||
import type { SpaceThemeEnum } from './SpaceThemeEnum';
|
||||
import {
|
||||
SpaceThemeEnumFromJSON,
|
||||
SpaceThemeEnumFromJSONTyped,
|
||||
SpaceThemeEnumToJSON,
|
||||
UserFileView,
|
||||
} from './SpaceThemeEnum';
|
||||
import type { UserFileView } from './UserFileView';
|
||||
import {
|
||||
UserFileViewFromJSON,
|
||||
UserFileViewFromJSONTyped,
|
||||
UserFileViewToJSON,
|
||||
} from './';
|
||||
} from './UserFileView';
|
||||
|
||||
/**
|
||||
* Adds nested create feature
|
||||
@@ -55,7 +61,7 @@ export interface PatchedSpace {
|
||||
* @type {number}
|
||||
* @memberof PatchedSpace
|
||||
*/
|
||||
readonly createdBy?: number | null;
|
||||
readonly createdBy?: number;
|
||||
/**
|
||||
*
|
||||
* @type {Date}
|
||||
@@ -127,13 +133,13 @@ export interface PatchedSpace {
|
||||
* @type {UserFileView}
|
||||
* @memberof PatchedSpace
|
||||
*/
|
||||
image?: UserFileView | null;
|
||||
image?: UserFileView;
|
||||
/**
|
||||
*
|
||||
* @type {UserFileView}
|
||||
* @memberof PatchedSpace
|
||||
*/
|
||||
navLogo?: UserFileView | null;
|
||||
navLogo?: UserFileView;
|
||||
/**
|
||||
*
|
||||
* @type {SpaceThemeEnum}
|
||||
@@ -145,7 +151,7 @@ export interface PatchedSpace {
|
||||
* @type {UserFileView}
|
||||
* @memberof PatchedSpace
|
||||
*/
|
||||
customSpaceTheme?: UserFileView | null;
|
||||
customSpaceTheme?: UserFileView;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@@ -163,43 +169,50 @@ export interface PatchedSpace {
|
||||
* @type {UserFileView}
|
||||
* @memberof PatchedSpace
|
||||
*/
|
||||
logoColor32?: UserFileView | null;
|
||||
logoColor32?: UserFileView;
|
||||
/**
|
||||
*
|
||||
* @type {UserFileView}
|
||||
* @memberof PatchedSpace
|
||||
*/
|
||||
logoColor128?: UserFileView | null;
|
||||
logoColor128?: UserFileView;
|
||||
/**
|
||||
*
|
||||
* @type {UserFileView}
|
||||
* @memberof PatchedSpace
|
||||
*/
|
||||
logoColor144?: UserFileView | null;
|
||||
logoColor144?: UserFileView;
|
||||
/**
|
||||
*
|
||||
* @type {UserFileView}
|
||||
* @memberof PatchedSpace
|
||||
*/
|
||||
logoColor180?: UserFileView | null;
|
||||
logoColor180?: UserFileView;
|
||||
/**
|
||||
*
|
||||
* @type {UserFileView}
|
||||
* @memberof PatchedSpace
|
||||
*/
|
||||
logoColor192?: UserFileView | null;
|
||||
logoColor192?: UserFileView;
|
||||
/**
|
||||
*
|
||||
* @type {UserFileView}
|
||||
* @memberof PatchedSpace
|
||||
*/
|
||||
logoColor512?: UserFileView | null;
|
||||
logoColor512?: UserFileView;
|
||||
/**
|
||||
*
|
||||
* @type {UserFileView}
|
||||
* @memberof PatchedSpace
|
||||
*/
|
||||
logoColorSvg?: UserFileView | null;
|
||||
logoColorSvg?: UserFileView;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedSpace interface.
|
||||
*/
|
||||
export function instanceOfPatchedSpace(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedSpaceFromJSON(json: any): PatchedSpace {
|
||||
@@ -207,67 +220,63 @@ export function PatchedSpaceFromJSON(json: any): PatchedSpace {
|
||||
}
|
||||
|
||||
export function PatchedSpaceFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedSpace {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'name': !exists(json, 'name') ? undefined : json['name'],
|
||||
'createdBy': !exists(json, 'created_by') ? undefined : json['created_by'],
|
||||
'createdAt': !exists(json, 'created_at') ? undefined : (new Date(json['created_at'])),
|
||||
'message': !exists(json, 'message') ? undefined : json['message'],
|
||||
'maxRecipes': !exists(json, 'max_recipes') ? undefined : json['max_recipes'],
|
||||
'maxFileStorageMb': !exists(json, 'max_file_storage_mb') ? undefined : json['max_file_storage_mb'],
|
||||
'maxUsers': !exists(json, 'max_users') ? undefined : json['max_users'],
|
||||
'allowSharing': !exists(json, 'allow_sharing') ? undefined : json['allow_sharing'],
|
||||
'demo': !exists(json, 'demo') ? undefined : json['demo'],
|
||||
'foodInherit': !exists(json, 'food_inherit') ? undefined : ((json['food_inherit'] as Array<any>).map(FoodInheritFieldFromJSON)),
|
||||
'userCount': !exists(json, 'user_count') ? undefined : json['user_count'],
|
||||
'recipeCount': !exists(json, 'recipe_count') ? undefined : json['recipe_count'],
|
||||
'fileSizeMb': !exists(json, 'file_size_mb') ? undefined : json['file_size_mb'],
|
||||
'image': !exists(json, 'image') ? undefined : UserFileViewFromJSON(json['image']),
|
||||
'navLogo': !exists(json, 'nav_logo') ? undefined : UserFileViewFromJSON(json['nav_logo']),
|
||||
'spaceTheme': !exists(json, 'space_theme') ? undefined : SpaceThemeEnumFromJSON(json['space_theme']),
|
||||
'customSpaceTheme': !exists(json, 'custom_space_theme') ? undefined : UserFileViewFromJSON(json['custom_space_theme']),
|
||||
'navBgColor': !exists(json, 'nav_bg_color') ? undefined : json['nav_bg_color'],
|
||||
'navTextColor': !exists(json, 'nav_text_color') ? undefined : SpaceNavTextColorEnumFromJSON(json['nav_text_color']),
|
||||
'logoColor32': !exists(json, 'logo_color_32') ? undefined : UserFileViewFromJSON(json['logo_color_32']),
|
||||
'logoColor128': !exists(json, 'logo_color_128') ? undefined : UserFileViewFromJSON(json['logo_color_128']),
|
||||
'logoColor144': !exists(json, 'logo_color_144') ? undefined : UserFileViewFromJSON(json['logo_color_144']),
|
||||
'logoColor180': !exists(json, 'logo_color_180') ? undefined : UserFileViewFromJSON(json['logo_color_180']),
|
||||
'logoColor192': !exists(json, 'logo_color_192') ? undefined : UserFileViewFromJSON(json['logo_color_192']),
|
||||
'logoColor512': !exists(json, 'logo_color_512') ? undefined : UserFileViewFromJSON(json['logo_color_512']),
|
||||
'logoColorSvg': !exists(json, 'logo_color_svg') ? undefined : UserFileViewFromJSON(json['logo_color_svg']),
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'name': json['name'] == null ? undefined : json['name'],
|
||||
'createdBy': json['created_by'] == null ? undefined : json['created_by'],
|
||||
'createdAt': json['created_at'] == null ? undefined : (new Date(json['created_at'])),
|
||||
'message': json['message'] == null ? undefined : json['message'],
|
||||
'maxRecipes': json['max_recipes'] == null ? undefined : json['max_recipes'],
|
||||
'maxFileStorageMb': json['max_file_storage_mb'] == null ? undefined : json['max_file_storage_mb'],
|
||||
'maxUsers': json['max_users'] == null ? undefined : json['max_users'],
|
||||
'allowSharing': json['allow_sharing'] == null ? undefined : json['allow_sharing'],
|
||||
'demo': json['demo'] == null ? undefined : json['demo'],
|
||||
'foodInherit': json['food_inherit'] == null ? undefined : ((json['food_inherit'] as Array<any>).map(FoodInheritFieldFromJSON)),
|
||||
'userCount': json['user_count'] == null ? undefined : json['user_count'],
|
||||
'recipeCount': json['recipe_count'] == null ? undefined : json['recipe_count'],
|
||||
'fileSizeMb': json['file_size_mb'] == null ? undefined : json['file_size_mb'],
|
||||
'image': json['image'] == null ? undefined : UserFileViewFromJSON(json['image']),
|
||||
'navLogo': json['nav_logo'] == null ? undefined : UserFileViewFromJSON(json['nav_logo']),
|
||||
'spaceTheme': json['space_theme'] == null ? undefined : SpaceThemeEnumFromJSON(json['space_theme']),
|
||||
'customSpaceTheme': json['custom_space_theme'] == null ? undefined : UserFileViewFromJSON(json['custom_space_theme']),
|
||||
'navBgColor': json['nav_bg_color'] == null ? undefined : json['nav_bg_color'],
|
||||
'navTextColor': json['nav_text_color'] == null ? undefined : SpaceNavTextColorEnumFromJSON(json['nav_text_color']),
|
||||
'logoColor32': json['logo_color_32'] == null ? undefined : UserFileViewFromJSON(json['logo_color_32']),
|
||||
'logoColor128': json['logo_color_128'] == null ? undefined : UserFileViewFromJSON(json['logo_color_128']),
|
||||
'logoColor144': json['logo_color_144'] == null ? undefined : UserFileViewFromJSON(json['logo_color_144']),
|
||||
'logoColor180': json['logo_color_180'] == null ? undefined : UserFileViewFromJSON(json['logo_color_180']),
|
||||
'logoColor192': json['logo_color_192'] == null ? undefined : UserFileViewFromJSON(json['logo_color_192']),
|
||||
'logoColor512': json['logo_color_512'] == null ? undefined : UserFileViewFromJSON(json['logo_color_512']),
|
||||
'logoColorSvg': json['logo_color_svg'] == null ? undefined : UserFileViewFromJSON(json['logo_color_svg']),
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedSpaceToJSON(value?: PatchedSpace | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'name': value.name,
|
||||
'message': value.message,
|
||||
'food_inherit': value.foodInherit === undefined ? undefined : ((value.foodInherit as Array<any>).map(FoodInheritFieldToJSON)),
|
||||
'image': UserFileViewToJSON(value.image),
|
||||
'nav_logo': UserFileViewToJSON(value.navLogo),
|
||||
'space_theme': SpaceThemeEnumToJSON(value.spaceTheme),
|
||||
'custom_space_theme': UserFileViewToJSON(value.customSpaceTheme),
|
||||
'nav_bg_color': value.navBgColor,
|
||||
'nav_text_color': SpaceNavTextColorEnumToJSON(value.navTextColor),
|
||||
'logo_color_32': UserFileViewToJSON(value.logoColor32),
|
||||
'logo_color_128': UserFileViewToJSON(value.logoColor128),
|
||||
'logo_color_144': UserFileViewToJSON(value.logoColor144),
|
||||
'logo_color_180': UserFileViewToJSON(value.logoColor180),
|
||||
'logo_color_192': UserFileViewToJSON(value.logoColor192),
|
||||
'logo_color_512': UserFileViewToJSON(value.logoColor512),
|
||||
'logo_color_svg': UserFileViewToJSON(value.logoColorSvg),
|
||||
'name': value['name'],
|
||||
'message': value['message'],
|
||||
'food_inherit': value['foodInherit'] == null ? undefined : ((value['foodInherit'] as Array<any>).map(FoodInheritFieldToJSON)),
|
||||
'image': UserFileViewToJSON(value['image']),
|
||||
'nav_logo': UserFileViewToJSON(value['navLogo']),
|
||||
'space_theme': SpaceThemeEnumToJSON(value['spaceTheme']),
|
||||
'custom_space_theme': UserFileViewToJSON(value['customSpaceTheme']),
|
||||
'nav_bg_color': value['navBgColor'],
|
||||
'nav_text_color': SpaceNavTextColorEnumToJSON(value['navTextColor']),
|
||||
'logo_color_32': UserFileViewToJSON(value['logoColor32']),
|
||||
'logo_color_128': UserFileViewToJSON(value['logoColor128']),
|
||||
'logo_color_144': UserFileViewToJSON(value['logoColor144']),
|
||||
'logo_color_180': UserFileViewToJSON(value['logoColor180']),
|
||||
'logo_color_192': UserFileViewToJSON(value['logoColor192']),
|
||||
'logo_color_512': UserFileViewToJSON(value['logoColor512']),
|
||||
'logo_color_svg': UserFileViewToJSON(value['logoColorSvg']),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,17 +12,19 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { Ingredient } from './Ingredient';
|
||||
import {
|
||||
Ingredient,
|
||||
IngredientFromJSON,
|
||||
IngredientFromJSONTyped,
|
||||
IngredientToJSON,
|
||||
UserFileView,
|
||||
} from './Ingredient';
|
||||
import type { UserFileView } from './UserFileView';
|
||||
import {
|
||||
UserFileViewFromJSON,
|
||||
UserFileViewFromJSONTyped,
|
||||
UserFileViewToJSON,
|
||||
} from './';
|
||||
} from './UserFileView';
|
||||
|
||||
/**
|
||||
* Adds nested create feature
|
||||
@@ -83,13 +85,13 @@ export interface PatchedStep {
|
||||
* @type {UserFileView}
|
||||
* @memberof PatchedStep
|
||||
*/
|
||||
file?: UserFileView | null;
|
||||
file?: UserFileView;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof PatchedStep
|
||||
*/
|
||||
stepRecipe?: number | null;
|
||||
stepRecipe?: number;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
@@ -110,51 +112,54 @@ export interface PatchedStep {
|
||||
showIngredientsTable?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedStep interface.
|
||||
*/
|
||||
export function instanceOfPatchedStep(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedStepFromJSON(json: any): PatchedStep {
|
||||
return PatchedStepFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PatchedStepFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedStep {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'name': !exists(json, 'name') ? undefined : json['name'],
|
||||
'instruction': !exists(json, 'instruction') ? undefined : json['instruction'],
|
||||
'ingredients': !exists(json, 'ingredients') ? undefined : ((json['ingredients'] as Array<any>).map(IngredientFromJSON)),
|
||||
'instructionsMarkdown': !exists(json, 'instructions_markdown') ? undefined : json['instructions_markdown'],
|
||||
'time': !exists(json, 'time') ? undefined : json['time'],
|
||||
'order': !exists(json, 'order') ? undefined : json['order'],
|
||||
'showAsHeader': !exists(json, 'show_as_header') ? undefined : json['show_as_header'],
|
||||
'file': !exists(json, 'file') ? undefined : UserFileViewFromJSON(json['file']),
|
||||
'stepRecipe': !exists(json, 'step_recipe') ? undefined : json['step_recipe'],
|
||||
'stepRecipeData': !exists(json, 'step_recipe_data') ? undefined : json['step_recipe_data'],
|
||||
'numrecipe': !exists(json, 'numrecipe') ? undefined : json['numrecipe'],
|
||||
'showIngredientsTable': !exists(json, 'show_ingredients_table') ? undefined : json['show_ingredients_table'],
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'name': json['name'] == null ? undefined : json['name'],
|
||||
'instruction': json['instruction'] == null ? undefined : json['instruction'],
|
||||
'ingredients': json['ingredients'] == null ? undefined : ((json['ingredients'] as Array<any>).map(IngredientFromJSON)),
|
||||
'instructionsMarkdown': json['instructions_markdown'] == null ? undefined : json['instructions_markdown'],
|
||||
'time': json['time'] == null ? undefined : json['time'],
|
||||
'order': json['order'] == null ? undefined : json['order'],
|
||||
'showAsHeader': json['show_as_header'] == null ? undefined : json['show_as_header'],
|
||||
'file': json['file'] == null ? undefined : UserFileViewFromJSON(json['file']),
|
||||
'stepRecipe': json['step_recipe'] == null ? undefined : json['step_recipe'],
|
||||
'stepRecipeData': json['step_recipe_data'] == null ? undefined : json['step_recipe_data'],
|
||||
'numrecipe': json['numrecipe'] == null ? undefined : json['numrecipe'],
|
||||
'showIngredientsTable': json['show_ingredients_table'] == null ? undefined : json['show_ingredients_table'],
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedStepToJSON(value?: PatchedStep | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'name': value.name,
|
||||
'instruction': value.instruction,
|
||||
'ingredients': value.ingredients === undefined ? undefined : ((value.ingredients as Array<any>).map(IngredientToJSON)),
|
||||
'time': value.time,
|
||||
'order': value.order,
|
||||
'show_as_header': value.showAsHeader,
|
||||
'file': UserFileViewToJSON(value.file),
|
||||
'step_recipe': value.stepRecipe,
|
||||
'show_ingredients_table': value.showIngredientsTable,
|
||||
'name': value['name'],
|
||||
'instruction': value['instruction'],
|
||||
'ingredients': value['ingredients'] == null ? undefined : ((value['ingredients'] as Array<any>).map(IngredientToJSON)),
|
||||
'time': value['time'],
|
||||
'order': value['order'],
|
||||
'show_as_header': value['showAsHeader'],
|
||||
'file': UserFileViewToJSON(value['file']),
|
||||
'step_recipe': value['stepRecipe'],
|
||||
'show_ingredients_table': value['showIngredientsTable'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { MethodEnum } from './MethodEnum';
|
||||
import {
|
||||
MethodEnum,
|
||||
MethodEnumFromJSON,
|
||||
MethodEnumFromJSONTyped,
|
||||
MethodEnumToJSON,
|
||||
} from './';
|
||||
} from './MethodEnum';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -49,19 +49,19 @@ export interface PatchedStorage {
|
||||
* @type {string}
|
||||
* @memberof PatchedStorage
|
||||
*/
|
||||
username?: string | null;
|
||||
username?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PatchedStorage
|
||||
*/
|
||||
password?: string | null;
|
||||
password?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PatchedStorage
|
||||
*/
|
||||
token?: string | null;
|
||||
token?: string;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
@@ -70,41 +70,44 @@ export interface PatchedStorage {
|
||||
readonly createdBy?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedStorage interface.
|
||||
*/
|
||||
export function instanceOfPatchedStorage(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedStorageFromJSON(json: any): PatchedStorage {
|
||||
return PatchedStorageFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PatchedStorageFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedStorage {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'name': !exists(json, 'name') ? undefined : json['name'],
|
||||
'method': !exists(json, 'method') ? undefined : MethodEnumFromJSON(json['method']),
|
||||
'username': !exists(json, 'username') ? undefined : json['username'],
|
||||
'password': !exists(json, 'password') ? undefined : json['password'],
|
||||
'token': !exists(json, 'token') ? undefined : json['token'],
|
||||
'createdBy': !exists(json, 'created_by') ? undefined : json['created_by'],
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'name': json['name'] == null ? undefined : json['name'],
|
||||
'method': json['method'] == null ? undefined : MethodEnumFromJSON(json['method']),
|
||||
'username': json['username'] == null ? undefined : json['username'],
|
||||
'password': json['password'] == null ? undefined : json['password'],
|
||||
'token': json['token'] == null ? undefined : json['token'],
|
||||
'createdBy': json['created_by'] == null ? undefined : json['created_by'],
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedStorageToJSON(value?: PatchedStorage | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'name': value.name,
|
||||
'method': MethodEnumToJSON(value.method),
|
||||
'username': value.username,
|
||||
'password': value.password,
|
||||
'token': value.token,
|
||||
'name': value['name'],
|
||||
'method': MethodEnumToJSON(value['method']),
|
||||
'username': value['username'],
|
||||
'password': value['password'],
|
||||
'token': value['token'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,50 +12,50 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { SupermarketCategoryRelation } from './SupermarketCategoryRelation';
|
||||
import {
|
||||
SupermarketCategoryRelation,
|
||||
SupermarketCategoryRelationFromJSON,
|
||||
SupermarketCategoryRelationFromJSONTyped,
|
||||
SupermarketCategoryRelationToJSON,
|
||||
} from './';
|
||||
} from './SupermarketCategoryRelation';
|
||||
|
||||
/**
|
||||
* 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 PatchedSupermarket
|
||||
*/
|
||||
@@ -77,7 +77,7 @@ export interface PatchedSupermarket {
|
||||
* @type {string}
|
||||
* @memberof PatchedSupermarket
|
||||
*/
|
||||
description?: string | null;
|
||||
description?: string;
|
||||
/**
|
||||
*
|
||||
* @type {Array<SupermarketCategoryRelation>}
|
||||
@@ -89,7 +89,14 @@ export interface PatchedSupermarket {
|
||||
* @type {string}
|
||||
* @memberof PatchedSupermarket
|
||||
*/
|
||||
openDataSlug?: string | null;
|
||||
openDataSlug?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedSupermarket interface.
|
||||
*/
|
||||
export function instanceOfPatchedSupermarket(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedSupermarketFromJSON(json: any): PatchedSupermarket {
|
||||
@@ -97,32 +104,28 @@ export function PatchedSupermarketFromJSON(json: any): PatchedSupermarket {
|
||||
}
|
||||
|
||||
export function PatchedSupermarketFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedSupermarket {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'name': !exists(json, 'name') ? undefined : json['name'],
|
||||
'description': !exists(json, 'description') ? undefined : json['description'],
|
||||
'categoryToSupermarket': !exists(json, 'category_to_supermarket') ? undefined : ((json['category_to_supermarket'] as Array<any>).map(SupermarketCategoryRelationFromJSON)),
|
||||
'openDataSlug': !exists(json, 'open_data_slug') ? undefined : json['open_data_slug'],
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'name': json['name'] == null ? undefined : json['name'],
|
||||
'description': json['description'] == null ? undefined : json['description'],
|
||||
'categoryToSupermarket': json['category_to_supermarket'] == null ? undefined : ((json['category_to_supermarket'] as Array<any>).map(SupermarketCategoryRelationFromJSON)),
|
||||
'openDataSlug': json['open_data_slug'] == null ? undefined : json['open_data_slug'],
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedSupermarketToJSON(value?: PatchedSupermarket | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'name': value.name,
|
||||
'description': value.description,
|
||||
'open_data_slug': value.openDataSlug,
|
||||
'name': value['name'],
|
||||
'description': value['description'],
|
||||
'open_data_slug': value['openDataSlug'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,43 +12,43 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
* 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 PatchedSupermarketCategory
|
||||
*/
|
||||
@@ -70,7 +70,14 @@ export interface PatchedSupermarketCategory {
|
||||
* @type {string}
|
||||
* @memberof PatchedSupermarketCategory
|
||||
*/
|
||||
description?: string | null;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedSupermarketCategory interface.
|
||||
*/
|
||||
export function instanceOfPatchedSupermarketCategory(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedSupermarketCategoryFromJSON(json: any): PatchedSupermarketCategory {
|
||||
@@ -78,29 +85,25 @@ export function PatchedSupermarketCategoryFromJSON(json: any): PatchedSupermarke
|
||||
}
|
||||
|
||||
export function PatchedSupermarketCategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedSupermarketCategory {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'name': !exists(json, 'name') ? undefined : json['name'],
|
||||
'description': !exists(json, 'description') ? undefined : json['description'],
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'name': json['name'] == null ? undefined : json['name'],
|
||||
'description': json['description'] == null ? undefined : json['description'],
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedSupermarketCategoryToJSON(value?: PatchedSupermarketCategory | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'name': value.name,
|
||||
'description': value.description,
|
||||
'name': value['name'],
|
||||
'description': value['description'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { SupermarketCategory } from './SupermarketCategory';
|
||||
import {
|
||||
SupermarketCategory,
|
||||
SupermarketCategoryFromJSON,
|
||||
SupermarketCategoryFromJSONTyped,
|
||||
SupermarketCategoryToJSON,
|
||||
} from './';
|
||||
} from './SupermarketCategory';
|
||||
|
||||
/**
|
||||
* Adds nested create feature
|
||||
@@ -52,36 +52,39 @@ export interface PatchedSupermarketCategoryRelation {
|
||||
order?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedSupermarketCategoryRelation interface.
|
||||
*/
|
||||
export function instanceOfPatchedSupermarketCategoryRelation(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedSupermarketCategoryRelationFromJSON(json: any): PatchedSupermarketCategoryRelation {
|
||||
return PatchedSupermarketCategoryRelationFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PatchedSupermarketCategoryRelationFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedSupermarketCategoryRelation {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'category': !exists(json, 'category') ? undefined : SupermarketCategoryFromJSON(json['category']),
|
||||
'supermarket': !exists(json, 'supermarket') ? undefined : json['supermarket'],
|
||||
'order': !exists(json, 'order') ? undefined : json['order'],
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'category': json['category'] == null ? undefined : SupermarketCategoryFromJSON(json['category']),
|
||||
'supermarket': json['supermarket'] == null ? undefined : json['supermarket'],
|
||||
'order': json['order'] == null ? undefined : json['order'],
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedSupermarketCategoryRelationToJSON(value?: PatchedSupermarketCategoryRelation | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'category': SupermarketCategoryToJSON(value.category),
|
||||
'supermarket': value.supermarket,
|
||||
'order': value.order,
|
||||
'category': SupermarketCategoryToJSON(value['category']),
|
||||
'supermarket': value['supermarket'],
|
||||
'order': value['order'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
@@ -48,7 +48,7 @@ export interface PatchedSync {
|
||||
* @type {Date}
|
||||
* @memberof PatchedSync
|
||||
*/
|
||||
lastChecked?: Date | null;
|
||||
lastChecked?: Date;
|
||||
/**
|
||||
*
|
||||
* @type {Date}
|
||||
@@ -63,40 +63,43 @@ export interface PatchedSync {
|
||||
readonly updatedAt?: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedSync interface.
|
||||
*/
|
||||
export function instanceOfPatchedSync(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedSyncFromJSON(json: any): PatchedSync {
|
||||
return PatchedSyncFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PatchedSyncFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedSync {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'storage': !exists(json, 'storage') ? undefined : json['storage'],
|
||||
'path': !exists(json, 'path') ? undefined : json['path'],
|
||||
'active': !exists(json, 'active') ? undefined : json['active'],
|
||||
'lastChecked': !exists(json, 'last_checked') ? undefined : (json['last_checked'] === null ? null : new Date(json['last_checked'])),
|
||||
'createdAt': !exists(json, 'created_at') ? undefined : (new Date(json['created_at'])),
|
||||
'updatedAt': !exists(json, 'updated_at') ? undefined : (new Date(json['updated_at'])),
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'storage': json['storage'] == null ? undefined : json['storage'],
|
||||
'path': json['path'] == null ? undefined : json['path'],
|
||||
'active': json['active'] == null ? undefined : json['active'],
|
||||
'lastChecked': json['last_checked'] == null ? undefined : (new Date(json['last_checked'])),
|
||||
'createdAt': json['created_at'] == null ? undefined : (new Date(json['created_at'])),
|
||||
'updatedAt': json['updated_at'] == null ? undefined : (new Date(json['updated_at'])),
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedSyncToJSON(value?: PatchedSync | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'storage': value.storage,
|
||||
'path': value.path,
|
||||
'active': value.active,
|
||||
'last_checked': value.lastChecked === undefined ? undefined : (value.lastChecked === null ? null : value.lastChecked.toISOString()),
|
||||
'storage': value['storage'],
|
||||
'path': value['path'],
|
||||
'active': value['active'],
|
||||
'last_checked': value['lastChecked'] == null ? undefined : ((value['lastChecked'] as any).toISOString()),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,43 +12,43 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
* 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 PatchedUnit
|
||||
*/
|
||||
@@ -70,25 +70,32 @@ export interface PatchedUnit {
|
||||
* @type {string}
|
||||
* @memberof PatchedUnit
|
||||
*/
|
||||
pluralName?: string | null;
|
||||
pluralName?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PatchedUnit
|
||||
*/
|
||||
description?: string | null;
|
||||
description?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PatchedUnit
|
||||
*/
|
||||
baseUnit?: string | null;
|
||||
baseUnit?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PatchedUnit
|
||||
*/
|
||||
openDataSlug?: string | null;
|
||||
openDataSlug?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedUnit interface.
|
||||
*/
|
||||
export function instanceOfPatchedUnit(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedUnitFromJSON(json: any): PatchedUnit {
|
||||
@@ -96,35 +103,31 @@ export function PatchedUnitFromJSON(json: any): PatchedUnit {
|
||||
}
|
||||
|
||||
export function PatchedUnitFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedUnit {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (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'],
|
||||
'baseUnit': !exists(json, 'base_unit') ? undefined : json['base_unit'],
|
||||
'openDataSlug': !exists(json, 'open_data_slug') ? undefined : json['open_data_slug'],
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'name': json['name'] == null ? undefined : json['name'],
|
||||
'pluralName': json['plural_name'] == null ? undefined : json['plural_name'],
|
||||
'description': json['description'] == null ? undefined : json['description'],
|
||||
'baseUnit': json['base_unit'] == null ? undefined : json['base_unit'],
|
||||
'openDataSlug': json['open_data_slug'] == null ? undefined : json['open_data_slug'],
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedUnitToJSON(value?: PatchedUnit | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'name': value.name,
|
||||
'plural_name': value.pluralName,
|
||||
'description': value.description,
|
||||
'base_unit': value.baseUnit,
|
||||
'open_data_slug': value.openDataSlug,
|
||||
'name': value['name'],
|
||||
'plural_name': value['pluralName'],
|
||||
'description': value['description'],
|
||||
'base_unit': value['baseUnit'],
|
||||
'open_data_slug': value['openDataSlug'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,17 +12,19 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { Food } from './Food';
|
||||
import {
|
||||
Food,
|
||||
FoodFromJSON,
|
||||
FoodFromJSONTyped,
|
||||
FoodToJSON,
|
||||
Unit,
|
||||
} from './Food';
|
||||
import type { Unit } from './Unit';
|
||||
import {
|
||||
UnitFromJSON,
|
||||
UnitFromJSONTyped,
|
||||
UnitToJSON,
|
||||
} from './';
|
||||
} from './Unit';
|
||||
|
||||
/**
|
||||
* Adds nested create feature
|
||||
@@ -71,13 +73,20 @@ export interface PatchedUnitConversion {
|
||||
* @type {Food}
|
||||
* @memberof PatchedUnitConversion
|
||||
*/
|
||||
food?: Food | null;
|
||||
food?: Food;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof PatchedUnitConversion
|
||||
*/
|
||||
openDataSlug?: string | null;
|
||||
openDataSlug?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedUnitConversion interface.
|
||||
*/
|
||||
export function instanceOfPatchedUnitConversion(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedUnitConversionFromJSON(json: any): PatchedUnitConversion {
|
||||
@@ -85,38 +94,34 @@ export function PatchedUnitConversionFromJSON(json: any): PatchedUnitConversion
|
||||
}
|
||||
|
||||
export function PatchedUnitConversionFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedUnitConversion {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'name': !exists(json, 'name') ? undefined : json['name'],
|
||||
'baseAmount': !exists(json, 'base_amount') ? undefined : json['base_amount'],
|
||||
'baseUnit': !exists(json, 'base_unit') ? undefined : UnitFromJSON(json['base_unit']),
|
||||
'convertedAmount': !exists(json, 'converted_amount') ? undefined : json['converted_amount'],
|
||||
'convertedUnit': !exists(json, 'converted_unit') ? undefined : UnitFromJSON(json['converted_unit']),
|
||||
'food': !exists(json, 'food') ? undefined : FoodFromJSON(json['food']),
|
||||
'openDataSlug': !exists(json, 'open_data_slug') ? undefined : json['open_data_slug'],
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'name': json['name'] == null ? undefined : json['name'],
|
||||
'baseAmount': json['base_amount'] == null ? undefined : json['base_amount'],
|
||||
'baseUnit': json['base_unit'] == null ? undefined : UnitFromJSON(json['base_unit']),
|
||||
'convertedAmount': json['converted_amount'] == null ? undefined : json['converted_amount'],
|
||||
'convertedUnit': json['converted_unit'] == null ? undefined : UnitFromJSON(json['converted_unit']),
|
||||
'food': json['food'] == null ? undefined : FoodFromJSON(json['food']),
|
||||
'openDataSlug': json['open_data_slug'] == null ? undefined : json['open_data_slug'],
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedUnitConversionToJSON(value?: PatchedUnitConversion | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'base_amount': value.baseAmount,
|
||||
'base_unit': UnitToJSON(value.baseUnit),
|
||||
'converted_amount': value.convertedAmount,
|
||||
'converted_unit': UnitToJSON(value.convertedUnit),
|
||||
'food': FoodToJSON(value.food),
|
||||
'open_data_slug': value.openDataSlug,
|
||||
'base_amount': value['baseAmount'],
|
||||
'base_unit': UnitToJSON(value['baseUnit']),
|
||||
'converted_amount': value['convertedAmount'],
|
||||
'converted_unit': UnitToJSON(value['convertedUnit']),
|
||||
'food': FoodToJSON(value['food']),
|
||||
'open_data_slug': value['openDataSlug'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
* Adds nested create feature
|
||||
* @export
|
||||
@@ -51,36 +51,39 @@ export interface PatchedUser {
|
||||
readonly displayName?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedUser interface.
|
||||
*/
|
||||
export function instanceOfPatchedUser(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedUserFromJSON(json: any): PatchedUser {
|
||||
return PatchedUserFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PatchedUserFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedUser {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'username': !exists(json, 'username') ? undefined : json['username'],
|
||||
'firstName': !exists(json, 'first_name') ? undefined : json['first_name'],
|
||||
'lastName': !exists(json, 'last_name') ? undefined : json['last_name'],
|
||||
'displayName': !exists(json, 'display_name') ? undefined : json['display_name'],
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'username': json['username'] == null ? undefined : json['username'],
|
||||
'firstName': json['first_name'] == null ? undefined : json['first_name'],
|
||||
'lastName': json['last_name'] == null ? undefined : json['last_name'],
|
||||
'displayName': json['display_name'] == null ? undefined : json['display_name'],
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedUserToJSON(value?: PatchedUser | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'first_name': value.firstName,
|
||||
'last_name': value.lastName,
|
||||
'first_name': value['firstName'],
|
||||
'last_name': value['lastName'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,29 +12,37 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { DefaultPageEnum } from './DefaultPageEnum';
|
||||
import {
|
||||
DefaultPageEnum,
|
||||
DefaultPageEnumFromJSON,
|
||||
DefaultPageEnumFromJSONTyped,
|
||||
DefaultPageEnumToJSON,
|
||||
ThemeEnum,
|
||||
} from './DefaultPageEnum';
|
||||
import type { ThemeEnum } from './ThemeEnum';
|
||||
import {
|
||||
ThemeEnumFromJSON,
|
||||
ThemeEnumFromJSONTyped,
|
||||
ThemeEnumToJSON,
|
||||
User,
|
||||
} from './ThemeEnum';
|
||||
import type { User } from './User';
|
||||
import {
|
||||
UserFromJSON,
|
||||
UserFromJSONTyped,
|
||||
UserToJSON,
|
||||
UserFileView,
|
||||
} from './User';
|
||||
import type { UserFileView } from './UserFileView';
|
||||
import {
|
||||
UserFileViewFromJSON,
|
||||
UserFileViewFromJSONTyped,
|
||||
UserFileViewToJSON,
|
||||
UserPreferenceNavTextColorEnum,
|
||||
} from './UserFileView';
|
||||
import type { UserPreferenceNavTextColorEnum } from './UserPreferenceNavTextColorEnum';
|
||||
import {
|
||||
UserPreferenceNavTextColorEnumFromJSON,
|
||||
UserPreferenceNavTextColorEnumFromJSONTyped,
|
||||
UserPreferenceNavTextColorEnumToJSON,
|
||||
} from './';
|
||||
} from './UserPreferenceNavTextColorEnum';
|
||||
|
||||
/**
|
||||
* Adds nested create feature
|
||||
@@ -53,7 +61,7 @@ export interface PatchedUserPreference {
|
||||
* @type {UserFileView}
|
||||
* @memberof PatchedUserPreference
|
||||
*/
|
||||
image?: UserFileView | null;
|
||||
image?: UserFileView;
|
||||
/**
|
||||
*
|
||||
* @type {ThemeEnum}
|
||||
@@ -107,7 +115,7 @@ export interface PatchedUserPreference {
|
||||
* @type {Array<User>}
|
||||
* @memberof PatchedUserPreference
|
||||
*/
|
||||
planShare?: Array<User> | null;
|
||||
planShare?: Array<User>;
|
||||
/**
|
||||
*
|
||||
* @type {boolean}
|
||||
@@ -167,7 +175,7 @@ export interface PatchedUserPreference {
|
||||
* @type {Array<User>}
|
||||
* @memberof PatchedUserPreference
|
||||
*/
|
||||
shoppingShare?: Array<User> | null;
|
||||
shoppingShare?: Array<User>;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
@@ -218,85 +226,88 @@ export interface PatchedUserPreference {
|
||||
readonly foodChildrenExist?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedUserPreference interface.
|
||||
*/
|
||||
export function instanceOfPatchedUserPreference(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedUserPreferenceFromJSON(json: any): PatchedUserPreference {
|
||||
return PatchedUserPreferenceFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PatchedUserPreferenceFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedUserPreference {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'user': !exists(json, 'user') ? undefined : json['user'],
|
||||
'image': !exists(json, 'image') ? undefined : UserFileViewFromJSON(json['image']),
|
||||
'theme': !exists(json, 'theme') ? undefined : ThemeEnumFromJSON(json['theme']),
|
||||
'navBgColor': !exists(json, 'nav_bg_color') ? undefined : json['nav_bg_color'],
|
||||
'navTextColor': !exists(json, 'nav_text_color') ? undefined : UserPreferenceNavTextColorEnumFromJSON(json['nav_text_color']),
|
||||
'navShowLogo': !exists(json, 'nav_show_logo') ? undefined : json['nav_show_logo'],
|
||||
'defaultUnit': !exists(json, 'default_unit') ? undefined : json['default_unit'],
|
||||
'defaultPage': !exists(json, 'default_page') ? undefined : DefaultPageEnumFromJSON(json['default_page']),
|
||||
'useFractions': !exists(json, 'use_fractions') ? undefined : json['use_fractions'],
|
||||
'useKj': !exists(json, 'use_kj') ? undefined : json['use_kj'],
|
||||
'planShare': !exists(json, 'plan_share') ? undefined : (json['plan_share'] === null ? null : (json['plan_share'] as Array<any>).map(UserFromJSON)),
|
||||
'navSticky': !exists(json, 'nav_sticky') ? undefined : json['nav_sticky'],
|
||||
'ingredientDecimals': !exists(json, 'ingredient_decimals') ? undefined : json['ingredient_decimals'],
|
||||
'comments': !exists(json, 'comments') ? undefined : json['comments'],
|
||||
'shoppingAutoSync': !exists(json, 'shopping_auto_sync') ? undefined : json['shopping_auto_sync'],
|
||||
'mealplanAutoaddShopping': !exists(json, 'mealplan_autoadd_shopping') ? undefined : json['mealplan_autoadd_shopping'],
|
||||
'foodInheritDefault': !exists(json, 'food_inherit_default') ? undefined : json['food_inherit_default'],
|
||||
'defaultDelay': !exists(json, 'default_delay') ? undefined : json['default_delay'],
|
||||
'mealplanAutoincludeRelated': !exists(json, 'mealplan_autoinclude_related') ? undefined : json['mealplan_autoinclude_related'],
|
||||
'mealplanAutoexcludeOnhand': !exists(json, 'mealplan_autoexclude_onhand') ? undefined : json['mealplan_autoexclude_onhand'],
|
||||
'shoppingShare': !exists(json, 'shopping_share') ? undefined : (json['shopping_share'] === null ? null : (json['shopping_share'] as Array<any>).map(UserFromJSON)),
|
||||
'shoppingRecentDays': !exists(json, 'shopping_recent_days') ? undefined : json['shopping_recent_days'],
|
||||
'csvDelim': !exists(json, 'csv_delim') ? undefined : json['csv_delim'],
|
||||
'csvPrefix': !exists(json, 'csv_prefix') ? undefined : json['csv_prefix'],
|
||||
'filterToSupermarket': !exists(json, 'filter_to_supermarket') ? undefined : json['filter_to_supermarket'],
|
||||
'shoppingAddOnhand': !exists(json, 'shopping_add_onhand') ? undefined : json['shopping_add_onhand'],
|
||||
'leftHanded': !exists(json, 'left_handed') ? undefined : json['left_handed'],
|
||||
'showStepIngredients': !exists(json, 'show_step_ingredients') ? undefined : json['show_step_ingredients'],
|
||||
'foodChildrenExist': !exists(json, 'food_children_exist') ? undefined : json['food_children_exist'],
|
||||
'user': json['user'] == null ? undefined : json['user'],
|
||||
'image': json['image'] == null ? undefined : UserFileViewFromJSON(json['image']),
|
||||
'theme': json['theme'] == null ? undefined : ThemeEnumFromJSON(json['theme']),
|
||||
'navBgColor': json['nav_bg_color'] == null ? undefined : json['nav_bg_color'],
|
||||
'navTextColor': json['nav_text_color'] == null ? undefined : UserPreferenceNavTextColorEnumFromJSON(json['nav_text_color']),
|
||||
'navShowLogo': json['nav_show_logo'] == null ? undefined : json['nav_show_logo'],
|
||||
'defaultUnit': json['default_unit'] == null ? undefined : json['default_unit'],
|
||||
'defaultPage': json['default_page'] == null ? undefined : DefaultPageEnumFromJSON(json['default_page']),
|
||||
'useFractions': json['use_fractions'] == null ? undefined : json['use_fractions'],
|
||||
'useKj': json['use_kj'] == null ? undefined : json['use_kj'],
|
||||
'planShare': json['plan_share'] == null ? undefined : ((json['plan_share'] as Array<any>).map(UserFromJSON)),
|
||||
'navSticky': json['nav_sticky'] == null ? undefined : json['nav_sticky'],
|
||||
'ingredientDecimals': json['ingredient_decimals'] == null ? undefined : json['ingredient_decimals'],
|
||||
'comments': json['comments'] == null ? undefined : json['comments'],
|
||||
'shoppingAutoSync': json['shopping_auto_sync'] == null ? undefined : json['shopping_auto_sync'],
|
||||
'mealplanAutoaddShopping': json['mealplan_autoadd_shopping'] == null ? undefined : json['mealplan_autoadd_shopping'],
|
||||
'foodInheritDefault': json['food_inherit_default'] == null ? undefined : json['food_inherit_default'],
|
||||
'defaultDelay': json['default_delay'] == null ? undefined : json['default_delay'],
|
||||
'mealplanAutoincludeRelated': json['mealplan_autoinclude_related'] == null ? undefined : json['mealplan_autoinclude_related'],
|
||||
'mealplanAutoexcludeOnhand': json['mealplan_autoexclude_onhand'] == null ? undefined : json['mealplan_autoexclude_onhand'],
|
||||
'shoppingShare': json['shopping_share'] == null ? undefined : ((json['shopping_share'] as Array<any>).map(UserFromJSON)),
|
||||
'shoppingRecentDays': json['shopping_recent_days'] == null ? undefined : json['shopping_recent_days'],
|
||||
'csvDelim': json['csv_delim'] == null ? undefined : json['csv_delim'],
|
||||
'csvPrefix': json['csv_prefix'] == null ? undefined : json['csv_prefix'],
|
||||
'filterToSupermarket': json['filter_to_supermarket'] == null ? undefined : json['filter_to_supermarket'],
|
||||
'shoppingAddOnhand': json['shopping_add_onhand'] == null ? undefined : json['shopping_add_onhand'],
|
||||
'leftHanded': json['left_handed'] == null ? undefined : json['left_handed'],
|
||||
'showStepIngredients': json['show_step_ingredients'] == null ? undefined : json['show_step_ingredients'],
|
||||
'foodChildrenExist': json['food_children_exist'] == null ? undefined : json['food_children_exist'],
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedUserPreferenceToJSON(value?: PatchedUserPreference | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'user': value.user,
|
||||
'image': UserFileViewToJSON(value.image),
|
||||
'theme': ThemeEnumToJSON(value.theme),
|
||||
'nav_bg_color': value.navBgColor,
|
||||
'nav_text_color': UserPreferenceNavTextColorEnumToJSON(value.navTextColor),
|
||||
'nav_show_logo': value.navShowLogo,
|
||||
'default_unit': value.defaultUnit,
|
||||
'default_page': DefaultPageEnumToJSON(value.defaultPage),
|
||||
'use_fractions': value.useFractions,
|
||||
'use_kj': value.useKj,
|
||||
'plan_share': value.planShare === undefined ? undefined : (value.planShare === null ? null : (value.planShare as Array<any>).map(UserToJSON)),
|
||||
'nav_sticky': value.navSticky,
|
||||
'ingredient_decimals': value.ingredientDecimals,
|
||||
'comments': value.comments,
|
||||
'shopping_auto_sync': value.shoppingAutoSync,
|
||||
'mealplan_autoadd_shopping': value.mealplanAutoaddShopping,
|
||||
'default_delay': value.defaultDelay,
|
||||
'mealplan_autoinclude_related': value.mealplanAutoincludeRelated,
|
||||
'mealplan_autoexclude_onhand': value.mealplanAutoexcludeOnhand,
|
||||
'shopping_share': value.shoppingShare === undefined ? undefined : (value.shoppingShare === null ? null : (value.shoppingShare as Array<any>).map(UserToJSON)),
|
||||
'shopping_recent_days': value.shoppingRecentDays,
|
||||
'csv_delim': value.csvDelim,
|
||||
'csv_prefix': value.csvPrefix,
|
||||
'filter_to_supermarket': value.filterToSupermarket,
|
||||
'shopping_add_onhand': value.shoppingAddOnhand,
|
||||
'left_handed': value.leftHanded,
|
||||
'show_step_ingredients': value.showStepIngredients,
|
||||
'user': value['user'],
|
||||
'image': UserFileViewToJSON(value['image']),
|
||||
'theme': ThemeEnumToJSON(value['theme']),
|
||||
'nav_bg_color': value['navBgColor'],
|
||||
'nav_text_color': UserPreferenceNavTextColorEnumToJSON(value['navTextColor']),
|
||||
'nav_show_logo': value['navShowLogo'],
|
||||
'default_unit': value['defaultUnit'],
|
||||
'default_page': DefaultPageEnumToJSON(value['defaultPage']),
|
||||
'use_fractions': value['useFractions'],
|
||||
'use_kj': value['useKj'],
|
||||
'plan_share': value['planShare'] == null ? undefined : ((value['planShare'] as Array<any>).map(UserToJSON)),
|
||||
'nav_sticky': value['navSticky'],
|
||||
'ingredient_decimals': value['ingredientDecimals'],
|
||||
'comments': value['comments'],
|
||||
'shopping_auto_sync': value['shoppingAutoSync'],
|
||||
'mealplan_autoadd_shopping': value['mealplanAutoaddShopping'],
|
||||
'default_delay': value['defaultDelay'],
|
||||
'mealplan_autoinclude_related': value['mealplanAutoincludeRelated'],
|
||||
'mealplan_autoexclude_onhand': value['mealplanAutoexcludeOnhand'],
|
||||
'shopping_share': value['shoppingShare'] == null ? undefined : ((value['shoppingShare'] as Array<any>).map(UserToJSON)),
|
||||
'shopping_recent_days': value['shoppingRecentDays'],
|
||||
'csv_delim': value['csvDelim'],
|
||||
'csv_prefix': value['csvPrefix'],
|
||||
'filter_to_supermarket': value['filterToSupermarket'],
|
||||
'shopping_add_onhand': value['shoppingAddOnhand'],
|
||||
'left_handed': value['leftHanded'],
|
||||
'show_step_ingredients': value['showStepIngredients'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,17 +12,19 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
import type { Group } from './Group';
|
||||
import {
|
||||
Group,
|
||||
GroupFromJSON,
|
||||
GroupFromJSONTyped,
|
||||
GroupToJSON,
|
||||
User,
|
||||
} from './Group';
|
||||
import type { User } from './User';
|
||||
import {
|
||||
UserFromJSON,
|
||||
UserFromJSONTyped,
|
||||
UserToJSON,
|
||||
} from './';
|
||||
} from './User';
|
||||
|
||||
/**
|
||||
* Adds nested create feature
|
||||
@@ -65,13 +67,13 @@ export interface PatchedUserSpace {
|
||||
* @type {string}
|
||||
* @memberof PatchedUserSpace
|
||||
*/
|
||||
internalNote?: string | null;
|
||||
internalNote?: string;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof PatchedUserSpace
|
||||
*/
|
||||
readonly inviteLink?: number | null;
|
||||
readonly inviteLink?: number;
|
||||
/**
|
||||
*
|
||||
* @type {Date}
|
||||
@@ -86,41 +88,44 @@ export interface PatchedUserSpace {
|
||||
readonly updatedAt?: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedUserSpace interface.
|
||||
*/
|
||||
export function instanceOfPatchedUserSpace(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedUserSpaceFromJSON(json: any): PatchedUserSpace {
|
||||
return PatchedUserSpaceFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PatchedUserSpaceFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedUserSpace {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'user': !exists(json, 'user') ? undefined : UserFromJSON(json['user']),
|
||||
'space': !exists(json, 'space') ? undefined : json['space'],
|
||||
'groups': !exists(json, 'groups') ? undefined : ((json['groups'] as Array<any>).map(GroupFromJSON)),
|
||||
'active': !exists(json, 'active') ? undefined : json['active'],
|
||||
'internalNote': !exists(json, 'internal_note') ? undefined : json['internal_note'],
|
||||
'inviteLink': !exists(json, 'invite_link') ? undefined : json['invite_link'],
|
||||
'createdAt': !exists(json, 'created_at') ? undefined : (new Date(json['created_at'])),
|
||||
'updatedAt': !exists(json, 'updated_at') ? undefined : (new Date(json['updated_at'])),
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'user': json['user'] == null ? undefined : UserFromJSON(json['user']),
|
||||
'space': json['space'] == null ? undefined : json['space'],
|
||||
'groups': json['groups'] == null ? undefined : ((json['groups'] as Array<any>).map(GroupFromJSON)),
|
||||
'active': json['active'] == null ? undefined : json['active'],
|
||||
'internalNote': json['internal_note'] == null ? undefined : json['internal_note'],
|
||||
'inviteLink': json['invite_link'] == null ? undefined : json['invite_link'],
|
||||
'createdAt': json['created_at'] == null ? undefined : (new Date(json['created_at'])),
|
||||
'updatedAt': json['updated_at'] == null ? undefined : (new Date(json['updated_at'])),
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedUserSpaceToJSON(value?: PatchedUserSpace | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'groups': value.groups === undefined ? undefined : ((value.groups as Array<any>).map(GroupToJSON)),
|
||||
'active': value.active,
|
||||
'internal_note': value.internalNote,
|
||||
'groups': value['groups'] == null ? undefined : ((value['groups'] as Array<any>).map(GroupToJSON)),
|
||||
'active': value['active'],
|
||||
'internal_note': value['internalNote'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { exists, mapValues } from '../runtime';
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
@@ -45,34 +45,37 @@ export interface PatchedViewLog {
|
||||
readonly createdAt?: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the PatchedViewLog interface.
|
||||
*/
|
||||
export function instanceOfPatchedViewLog(value: object): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function PatchedViewLogFromJSON(json: any): PatchedViewLog {
|
||||
return PatchedViewLogFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function PatchedViewLogFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedViewLog {
|
||||
if ((json === undefined) || (json === null)) {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'id': !exists(json, 'id') ? undefined : json['id'],
|
||||
'recipe': !exists(json, 'recipe') ? undefined : json['recipe'],
|
||||
'createdBy': !exists(json, 'created_by') ? undefined : json['created_by'],
|
||||
'createdAt': !exists(json, 'created_at') ? undefined : (new Date(json['created_at'])),
|
||||
'id': json['id'] == null ? undefined : json['id'],
|
||||
'recipe': json['recipe'] == null ? undefined : json['recipe'],
|
||||
'createdBy': json['created_by'] == null ? undefined : json['created_by'],
|
||||
'createdAt': json['created_at'] == null ? undefined : (new Date(json['created_at'])),
|
||||
};
|
||||
}
|
||||
|
||||
export function PatchedViewLogToJSON(value?: PatchedViewLog | null): any {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
if (value === null) {
|
||||
return null;
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'recipe': value.recipe,
|
||||
'recipe': value['recipe'],
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user