Files
recipes/vue3/models/PatchedMealPlan.ts
2024-04-18 10:56:15 -05:00

178 lines
4.7 KiB
TypeScript

/* tslint:disable */
/* eslint-disable */
/**
* Tandoor
* Tandoor API Docs
*
* The version of the OpenAPI document: 0.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
import type { MealType } from './MealType';
import {
MealTypeFromJSON,
MealTypeFromJSONTyped,
MealTypeToJSON,
} from './MealType';
import type { RecipeOverview } from './RecipeOverview';
import {
RecipeOverviewFromJSON,
RecipeOverviewFromJSONTyped,
RecipeOverviewToJSON,
} from './RecipeOverview';
import type { User } from './User';
import {
UserFromJSON,
UserFromJSONTyped,
UserToJSON,
} from './User';
/**
* Adds nested create feature
* @export
* @interface PatchedMealPlan
*/
export interface PatchedMealPlan {
/**
*
* @type {number}
* @memberof PatchedMealPlan
*/
readonly id?: number;
/**
*
* @type {string}
* @memberof PatchedMealPlan
*/
title?: string;
/**
*
* @type {RecipeOverview}
* @memberof PatchedMealPlan
*/
recipe?: RecipeOverview;
/**
*
* @type {number}
* @memberof PatchedMealPlan
*/
servings?: number;
/**
*
* @type {string}
* @memberof PatchedMealPlan
*/
note?: string;
/**
*
* @type {string}
* @memberof PatchedMealPlan
*/
readonly noteMarkdown?: string;
/**
*
* @type {Date}
* @memberof PatchedMealPlan
*/
fromDate?: Date;
/**
*
* @type {Date}
* @memberof PatchedMealPlan
*/
toDate?: Date;
/**
*
* @type {MealType}
* @memberof PatchedMealPlan
*/
mealType?: MealType;
/**
*
* @type {number}
* @memberof PatchedMealPlan
*/
readonly createdBy?: number;
/**
*
* @type {Array<User>}
* @memberof PatchedMealPlan
*/
shared?: Array<User>;
/**
*
* @type {string}
* @memberof PatchedMealPlan
*/
readonly recipeName?: string;
/**
*
* @type {string}
* @memberof PatchedMealPlan
*/
readonly mealTypeName?: string;
/**
*
* @type {boolean}
* @memberof PatchedMealPlan
*/
readonly shopping?: boolean;
}
/**
* 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 == null) {
return json;
}
return {
'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?: Omit<PatchedMealPlan, 'id'|'note_markdown'|'created_by'|'recipe_name'|'meal_type_name'|'shopping'> | null): any {
if (value == null) {
return value;
}
return {
'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)),
};
}