created CustomFilter model and api

This commit is contained in:
Chris Scoggins 2022-01-21 15:50:26 -06:00
parent 492febe626
commit 890e9e7242
No known key found for this signature in database
GPG Key ID: 41617A4206CCBAC6
14 changed files with 637 additions and 49 deletions

View File

@ -0,0 +1,36 @@
# Generated by Django 3.2.11 on 2022-01-21 20:27
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import cookbook.models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('cookbook', '0167_userpreference_left_handed'),
]
operations = [
migrations.CreateModel(
name='CustomFilter',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=128)),
('type', models.CharField(choices=[('RECIPE', 'Recipe'), ('FOOD', 'Food'), ('KEYWORD', 'Keyword')], default=('RECIPE', 'Recipe'), max_length=128)),
('search', models.TextField()),
('created_at', models.DateTimeField(auto_now_add=True)),
('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
('shared', models.ManyToManyField(blank=True, related_name='f_shared_with', to=settings.AUTH_USER_MODEL)),
('space', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='cookbook.space')),
],
bases=(models.Model, cookbook.models.PermissionModelMixin),
),
migrations.AddConstraint(
model_name='customfilter',
constraint=models.UniqueConstraint(fields=('space', 'name'), name='cf_unique_name_per_space'),
),
]

View File

@ -1100,3 +1100,34 @@ class Automation(ExportModelOperationsMixin('automations'), models.Model, Permis
objects = ScopedManager(space='space')
space = models.ForeignKey(Space, on_delete=models.CASCADE)
class CustomFilter(models.Model, PermissionModelMixin):
RECIPE = 'RECIPE'
FOOD = 'FOOD'
KEYWORD = 'KEYWORD'
MODELS = (
(RECIPE, _('Recipe')),
(FOOD, _('Food')),
(KEYWORD, _('Keyword')),
)
name = models.CharField(max_length=128, null=False, blank=False)
type = models.CharField(max_length=128, choices=(MODELS), default=MODELS[0])
# could use JSONField, but requires installing extension on SQLite, don't need to search the objects, so seems unecessary
search = models.TextField(blank=False, null=False)
created_at = models.DateTimeField(auto_now_add=True)
created_by = models.ForeignKey(User, on_delete=models.CASCADE)
shared = models.ManyToManyField(User, blank=True, related_name='f_shared_with')
objects = ScopedManager(space='space')
space = models.ForeignKey(Space, on_delete=models.CASCADE)
def __str__(self):
return self.name
class Meta:
constraints = [
models.UniqueConstraint(fields=['space', 'name'], name='cf_unique_name_per_space')
]

View File

@ -14,7 +14,7 @@ from rest_framework.fields import empty
from cookbook.helper.HelperFunctions import str2bool
from cookbook.helper.shopping_helper import RecipeShoppingEditor
from cookbook.models import (Automation, BookmarkletImport, Comment, CookLog, Food,
from cookbook.models import (Automation, BookmarkletImport, Comment, CookLog, CustomFilter, Food,
FoodInheritField, ImportLog, Ingredient, Keyword, MealPlan, MealType,
NutritionInformation, Recipe, RecipeBook, RecipeBookEntry,
RecipeImport, ShareLink, ShoppingList, ShoppingListEntry,
@ -976,3 +976,16 @@ class FoodShoppingUpdateSerializer(serializers.ModelSerializer):
class Meta:
model = Recipe
fields = ['id', 'amount', 'unit', 'delete', ]
class CustomFilterSerializer(SpacedModelSerializer, WritableNestedModelSerializer):
shared = UserNameSerializer(many=True, required=False)
def create(self, validated_data):
validated_data['created_by'] = self.context['request'].user
return super().create(validated_data)
class Meta:
model = CustomFilter
fields = ('id', 'name', 'search', 'shared', 'created_by')
read_only_fields = ('created_by',)

File diff suppressed because one or more lines are too long

View File

@ -9,15 +9,17 @@ from cookbook.helper import dal
from recipes.settings import DEBUG
from recipes.version import VERSION_NUMBER
from .models import (Automation, Comment, Food, InviteLink, Keyword, MealPlan, Recipe, RecipeBook,
RecipeBookEntry, RecipeImport, ShoppingList, Step, Storage, Supermarket,
SupermarketCategory, Sync, SyncLog, Unit, UserFile, get_model_name)
from .models import (Automation, Comment, CustomFilter, Food, InviteLink, Keyword, MealPlan, Recipe,
RecipeBook, RecipeBookEntry, RecipeImport, ShoppingList, Step, Storage,
Supermarket, SupermarketCategory, Sync, SyncLog, Unit, UserFile,
get_model_name)
from .views import api, data, delete, edit, import_export, lists, new, telegram, views
router = routers.DefaultRouter()
router.register(r'automation', api.AutomationViewSet)
router.register(r'bookmarklet-import', api.BookmarkletImportViewSet)
router.register(r'cook-log', api.CookLogViewSet)
router.register(r'custom-filter', api.CustomFilterViewSet)
router.register(r'food', api.FoodViewSet)
router.register(r'food-inherit-field', api.FoodInheritFieldViewSet)
router.register(r'import-log', api.ImportLogViewSet)
@ -178,7 +180,7 @@ for m in generic_models:
)
)
vue_models = [Food, Keyword, Unit, Supermarket, SupermarketCategory, Automation, UserFile, Step]
vue_models = [Food, Keyword, Unit, Supermarket, SupermarketCategory, Automation, UserFile, Step, CustomFilter]
for m in vue_models:
py_name = get_model_name(m)
url_name = py_name.replace('_', '-')

View File

@ -42,18 +42,19 @@ from cookbook.helper.recipe_html_import import get_recipe_from_source
from cookbook.helper.recipe_search import RecipeFacet, RecipeSearch, old_search
from cookbook.helper.recipe_url_import import get_from_scraper
from cookbook.helper.shopping_helper import RecipeShoppingEditor, shopping_helper
from cookbook.models import (Automation, BookmarkletImport, CookLog, Food, FoodInheritField,
ImportLog, Ingredient, Keyword, MealPlan, MealType, Recipe, RecipeBook,
RecipeBookEntry, ShareLink, ShoppingList, ShoppingListEntry,
ShoppingListRecipe, Step, Storage, Supermarket, SupermarketCategory,
SupermarketCategoryRelation, Sync, SyncLog, Unit, UserFile,
UserPreference, ViewLog)
from cookbook.models import (Automation, BookmarkletImport, CookLog, CustomFilter, Food,
FoodInheritField, ImportLog, Ingredient, Keyword, MealPlan, MealType,
Recipe, RecipeBook, RecipeBookEntry, ShareLink, ShoppingList,
ShoppingListEntry, ShoppingListRecipe, Step, Storage, Supermarket,
SupermarketCategory, SupermarketCategoryRelation, Sync, SyncLog, Unit,
UserFile, UserPreference, ViewLog)
from cookbook.provider.dropbox import Dropbox
from cookbook.provider.local import Local
from cookbook.provider.nextcloud import Nextcloud
from cookbook.schemas import FilterSchema, QueryParam, QueryParamAutoSchema, TreeSchema
from cookbook.serializer import (AutomationSerializer, BookmarkletImportSerializer,
CookLogSerializer, FoodInheritFieldSerializer, FoodSerializer,
CookLogSerializer, CustomFilterSerializer,
FoodInheritFieldSerializer, FoodSerializer,
FoodShoppingUpdateSerializer, ImportLogSerializer,
IngredientSerializer, KeywordSerializer, MealPlanSerializer,
MealTypeSerializer, RecipeBookEntrySerializer,
@ -900,7 +901,19 @@ class AutomationViewSet(viewsets.ModelViewSet, StandardFilterMixin):
return super().get_queryset()
class CustomFilterViewSet(viewsets.ModelViewSet, StandardFilterMixin):
queryset = CustomFilter.objects
serializer_class = CustomFilterSerializer
permission_classes = [CustomIsOwner]
def get_queryset(self):
self.queryset = self.queryset.filter(Q(created_by=self.request.user) | Q(shared=self.request.user)).filter(
space=self.request.space).distinct()
return super().get_queryset()
# -------------- non django rest api views --------------------
def get_recipe_provider(recipe):
if recipe.storage.method == Storage.DROPBOX:
return Dropbox

View File

@ -185,6 +185,22 @@ def automation(request):
)
@group_required('user')
def custom_filter(request):
# recipe-param is the name of the parameters used when filtering recipes by this attribute
# model-name is the models.js name of the model, probably ALL-CAPS
return render(
request,
'generic/model_template.html',
{
"title": _("Custom Filters"),
"config": {
'model': "CUSTOM_FILTER", # *REQUIRED* name of the model in models.js
}
}
)
@group_required('user')
def user_file(request):
try:

View File

@ -19,7 +19,7 @@
<!-- <span><b-button variant="link" size="sm" class="text-dark shadow-none"><i class="fas fa-chevron-down"></i></b-button></span> -->
<model-menu />
<span>{{ $t(this.this_model.name) }}</span>
<span v-if="apiName !== 'Step'">
<span v-if="apiName !== 'Step' && apiName !== 'CustomFilter'">
<b-button variant="link" @click="startAction({ action: 'new' })">
<i class="fas fa-plus-circle fa-2x"></i>
</b-button> </span

View File

@ -422,7 +422,7 @@ import "bootstrap-vue/dist/bootstrap-vue.css"
import moment from "moment"
import _debounce from "lodash/debounce"
import { ApiMixin, ResolveUrlMixin } from "@/utils/utils"
import { ApiMixin, ResolveUrlMixin, StandardToasts, ToastMixin } from "@/utils/utils"
import LoadingSpinner from "@/components/LoadingSpinner" // TODO: is this deprecated?
import RecipeCard from "@/components/RecipeCard"
import GenericMultiselect from "@/components/GenericMultiselect"
@ -438,7 +438,7 @@ let UI_COOKIE_NAME = "ui_search_settings"
export default {
name: "RecipeSearchView",
mixins: [ResolveUrlMixin, ApiMixin],
mixins: [ResolveUrlMixin, ApiMixin, ToastMixin],
components: { GenericMultiselect, RecipeCard, Treeselect, RecipeSwitcher },
data() {
return {
@ -503,6 +503,7 @@ export default {
pagination_count: 0,
random_search: false,
debug: false,
custom_filters: [],
}
},
computed: {
@ -857,7 +858,19 @@ export default {
},
saveSearch: function () {
let filtername = window.prompt(this.$t("save_filter"), this.$t("filter_name"))
console.log("you saved: ", filtername, this.buildParams(false))
let params = {
name: filtername,
search: JSON.stringify(this.buildParams(false)),
}
this.genericAPI(this.Models.CUSTOM_FILTER, this.Actions.CREATE, params)
.then((result) => {
StandardToasts.makeStandardToast(StandardToasts.SUCCESS_CREATE)
console.log("you saved: ", filtername, this.buildParams(false), result)
})
.catch((err) => {
console.log(err, Object.keys(err))
StandardToasts.makeStandardToast(StandardToasts.FAIL_CREATE)
})
},
},
}

View File

@ -19,7 +19,9 @@
<b-dropdown-item :href="resolveDjangoUrl('list_user_file')"> <i class="fas fa-file fa-fw"></i> {{ $t(Models["USERFILE"].name) }} </b-dropdown-item>
<b-dropdown-item :href="resolveDjangoUrl('list_step')"> <i class="fas fa-puzzle-piece fa-fw"></i>{{ $t(Models["STEP"].name) }} </b-dropdown-item>
<b-dropdown-item :href="resolveDjangoUrl('list_step')"> <i class="fas fa-puzzle-piece fa-fw"></i>{{ Models["STEP"].name }} </b-dropdown-item>
<b-dropdown-item :href="resolveDjangoUrl('list_custom_filter')"> <i class="fas fa-filter fa-fw"></i>{{ Models["CUSTOM_FILTER"].name }} </b-dropdown-item>
</b-dropdown>
</span>
</template>

View File

@ -14,6 +14,7 @@
:allow_create="form.allow_create"
:create_placeholder="createPlaceholder"
:clear="clear"
:label="list_label"
style="flex-grow: 1; flex-shrink: 1; flex-basis: 0"
:placeholder="modelName"
@new="addNew"
@ -55,6 +56,7 @@ export default {
new_value: undefined,
field: undefined,
label: undefined,
list_label: undefined,
sticky_options: undefined,
first_run: true,
}
@ -64,6 +66,7 @@ export default {
this.field = this.form?.field ?? "You Forgot To Set Field Name"
this.label = this.form?.label ?? ""
this.sticky_options = this.form?.sticky_options ?? []
this.list_label = this.form?.list_label ?? undefined
},
computed: {
modelName() {
@ -149,9 +152,9 @@ export default {
unflattenItem: function (itemList) {
let unflat_items = []
let item = undefined
let this_label = undefined
let label = this.form.list_label.split("::")
let order = 0
let this_label
itemList.forEach((x) => {
item = {}
item[label[0]] = {}

View File

@ -311,5 +311,9 @@
"show_filters": "Show Filters",
"not": "not",
"save_filter": "Save Filter",
"filter_name": "Filter Name"
"filter_name": "Filter Name",
"left_handed": "Left-handed mode",
"left_handed_help": "Will optimize the UI for use with your left hand.",
"Custom Filter": "Custom Filter",
"shared_with": "Shared With"
}

View File

@ -470,6 +470,33 @@ export class Models {
},
}
static CUSTOM_FILTER = {
name: i18n.t("Custom Filter"),
apiName: "CustomFilter",
create: {
params: [["name", "search", "shared"]],
form: {
name: {
form_field: true,
type: "text",
field: "name",
label: i18n.t("Name"),
placeholder: "",
},
shared: {
form_field: true,
type: "lookup",
field: "shared",
list: "USER",
list_label: "username",
label: i18n.t("shared_with"),
multiple: true,
},
},
},
}
static USER_NAME = {
name: "User",
apiName: "User",

View File

@ -173,6 +173,62 @@ export interface CookLog {
*/
created_at?: string;
}
/**
*
* @export
* @interface CustomFilter
*/
export interface CustomFilter {
/**
*
* @type {number}
* @memberof CustomFilter
*/
id?: number;
/**
*
* @type {string}
* @memberof CustomFilter
*/
name: string;
/**
*
* @type {string}
* @memberof CustomFilter
*/
search: string;
/**
*
* @type {Array<CustomFilterShared>}
* @memberof CustomFilter
*/
shared: Array<CustomFilterShared>;
/**
*
* @type {string}
* @memberof CustomFilter
*/
created_by?: string;
}
/**
*
* @export
* @interface CustomFilterShared
*/
export interface CustomFilterShared {
/**
*
* @type {number}
* @memberof CustomFilterShared
*/
id?: number;
/**
*
* @type {string}
* @memberof CustomFilterShared
*/
username?: string;
}
/**
*
* @export
@ -1093,10 +1149,10 @@ export interface MealPlan {
created_by?: string;
/**
*
* @type {Array<MealPlanShared>}
* @type {Array<CustomFilterShared>}
* @memberof MealPlan
*/
shared?: Array<MealPlanShared> | null;
shared?: Array<CustomFilterShared> | null;
/**
*
* @type {string}
@ -1293,25 +1349,6 @@ export interface MealPlanRecipeKeywords {
*/
label?: string;
}
/**
*
* @export
* @interface MealPlanShared
*/
export interface MealPlanShared {
/**
*
* @type {number}
* @memberof MealPlanShared
*/
id?: number;
/**
*
* @type {string}
* @memberof MealPlanShared
*/
username?: string;
}
/**
*
* @export
@ -1508,10 +1545,10 @@ export interface RecipeBook {
icon?: string | null;
/**
*
* @type {Array<MealPlanShared>}
* @type {Array<CustomFilterShared>}
* @memberof RecipeBook
*/
shared: Array<MealPlanShared>;
shared: Array<CustomFilterShared>;
/**
*
* @type {string}
@ -2047,10 +2084,10 @@ export interface ShoppingList {
entries: Array<ShoppingListEntries> | null;
/**
*
* @type {Array<MealPlanShared>}
* @type {Array<CustomFilterShared>}
* @memberof ShoppingList
*/
shared: Array<MealPlanShared>;
shared: Array<CustomFilterShared>;
/**
*
* @type {boolean}
@ -2966,10 +3003,10 @@ export interface UserPreference {
show_recent?: boolean;
/**
*
* @type {Array<MealPlanShared>}
* @type {Array<CustomFilterShared>}
* @memberof UserPreference
*/
plan_share?: Array<MealPlanShared> | null;
plan_share?: Array<CustomFilterShared> | null;
/**
*
* @type {number}
@ -3020,10 +3057,10 @@ export interface UserPreference {
mealplan_autoexclude_onhand?: boolean;
/**
*
* @type {Array<MealPlanShared>}
* @type {Array<CustomFilterShared>}
* @memberof UserPreference
*/
shopping_share?: Array<MealPlanShared> | null;
shopping_share?: Array<CustomFilterShared> | null;
/**
*
* @type {number}
@ -3055,14 +3092,20 @@ export interface UserPreference {
*/
shopping_add_onhand?: boolean;
<<<<<<< HEAD
<<<<<<< HEAD
=======
>>>>>>> created CustomFilter model and api
/**
*
* @type {boolean}
* @memberof UserPreference
*/
left_handed?: boolean;
<<<<<<< HEAD
=======
>>>>>>> complex keyword filters
=======
>>>>>>> created CustomFilter model and api
}
/**
@ -3246,6 +3289,39 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration)
options: localVarRequestOptions,
};
},
/**
*
* @param {CustomFilter} [customFilter]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createCustomFilter: async (customFilter?: CustomFilter, options: any = {}): Promise<RequestArgs> => {
const localVarPath = `/api/custom-filter/`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
localVarHeaderParameter['Content-Type'] = 'application/json';
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
localVarRequestOptions.data = serializeDataIfNeeded(customFilter, localVarRequestOptions, configuration)
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @param {Food} [food]
@ -4084,6 +4160,39 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration)
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @param {string} id A unique integer value identifying this custom filter.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
destroyCustomFilter: async (id: string, options: any = {}): Promise<RequestArgs> => {
// verify required parameter 'id' is not null or undefined
assertParamExists('destroyCustomFilter', 'id', id)
const localVarPath = `/api/custom-filter/{id}/`
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
@ -4949,6 +5058,35 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration)
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listCustomFilters: async (options: any = {}): Promise<RequestArgs> => {
const localVarPath = `/api/custom-filter/`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
@ -6254,6 +6392,43 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration)
options: localVarRequestOptions,
};
},
/**
*
* @param {string} id A unique integer value identifying this custom filter.
* @param {CustomFilter} [customFilter]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
partialUpdateCustomFilter: async (id: string, customFilter?: CustomFilter, options: any = {}): Promise<RequestArgs> => {
// verify required parameter 'id' is not null or undefined
assertParamExists('partialUpdateCustomFilter', 'id', id)
const localVarPath = `/api/custom-filter/{id}/`
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'PATCH', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
localVarHeaderParameter['Content-Type'] = 'application/json';
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
localVarRequestOptions.data = serializeDataIfNeeded(customFilter, localVarRequestOptions, configuration)
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @param {string} id A unique integer value identifying this food.
@ -7213,6 +7388,39 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration)
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @param {string} id A unique integer value identifying this custom filter.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
retrieveCustomFilter: async (id: string, options: any = {}): Promise<RequestArgs> => {
// verify required parameter 'id' is not null or undefined
assertParamExists('retrieveCustomFilter', 'id', id)
const localVarPath = `/api/custom-filter/{id}/`
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
@ -8232,6 +8440,43 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration)
options: localVarRequestOptions,
};
},
/**
*
* @param {string} id A unique integer value identifying this custom filter.
* @param {CustomFilter} [customFilter]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updateCustomFilter: async (id: string, customFilter?: CustomFilter, options: any = {}): Promise<RequestArgs> => {
// verify required parameter 'id' is not null or undefined
assertParamExists('updateCustomFilter', 'id', id)
const localVarPath = `/api/custom-filter/{id}/`
.replace(`{${"id"}}`, encodeURIComponent(String(id)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
localVarHeaderParameter['Content-Type'] = 'application/json';
setSearchParams(localVarUrlObj, localVarQueryParameter, options.query);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
localVarRequestOptions.data = serializeDataIfNeeded(customFilter, localVarRequestOptions, configuration)
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @param {string} id A unique integer value identifying this food.
@ -9108,6 +9353,16 @@ export const ApiApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = await localVarAxiosParamCreator.createCookLog(cookLog, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
*
* @param {CustomFilter} [customFilter]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async createCustomFilter(customFilter?: CustomFilter, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CustomFilter>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.createCustomFilter(customFilter, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
*
* @param {Food} [food]
@ -9361,6 +9616,16 @@ export const ApiApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = await localVarAxiosParamCreator.destroyCookLog(id, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
*
* @param {string} id A unique integer value identifying this custom filter.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async destroyCustomFilter(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.destroyCustomFilter(id, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
*
* @param {string} id A unique integer value identifying this food.
@ -9621,6 +9886,15 @@ export const ApiApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = await localVarAxiosParamCreator.listCookLogs(page, pageSize, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async listCustomFilters(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<CustomFilter>>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.listCustomFilters(options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
*
* @param {*} [options] Override http request option.
@ -9990,6 +10264,17 @@ export const ApiApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = await localVarAxiosParamCreator.partialUpdateCookLog(id, cookLog, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
*
* @param {string} id A unique integer value identifying this custom filter.
* @param {CustomFilter} [customFilter]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async partialUpdateCustomFilter(id: string, customFilter?: CustomFilter, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CustomFilter>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.partialUpdateCustomFilter(id, customFilter, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
*
* @param {string} id A unique integer value identifying this food.
@ -10275,6 +10560,16 @@ export const ApiApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveCookLog(id, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
*
* @param {string} id A unique integer value identifying this custom filter.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async retrieveCustomFilter(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CustomFilter>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveCustomFilter(id, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
*
* @param {string} id A unique integer value identifying this food.
@ -10580,6 +10875,17 @@ export const ApiApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = await localVarAxiosParamCreator.updateCookLog(id, cookLog, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
*
* @param {string} id A unique integer value identifying this custom filter.
* @param {CustomFilter} [customFilter]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async updateCustomFilter(id: string, customFilter?: CustomFilter, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CustomFilter>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.updateCustomFilter(id, customFilter, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
*
* @param {string} id A unique integer value identifying this food.
@ -10862,6 +11168,15 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?:
createCookLog(cookLog?: CookLog, options?: any): AxiosPromise<CookLog> {
return localVarFp.createCookLog(cookLog, options).then((request) => request(axios, basePath));
},
/**
*
* @param {CustomFilter} [customFilter]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createCustomFilter(customFilter?: CustomFilter, options?: any): AxiosPromise<CustomFilter> {
return localVarFp.createCustomFilter(customFilter, options).then((request) => request(axios, basePath));
},
/**
*
* @param {Food} [food]
@ -11090,6 +11405,15 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?:
destroyCookLog(id: string, options?: any): AxiosPromise<void> {
return localVarFp.destroyCookLog(id, options).then((request) => request(axios, basePath));
},
/**
*
* @param {string} id A unique integer value identifying this custom filter.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
destroyCustomFilter(id: string, options?: any): AxiosPromise<void> {
return localVarFp.destroyCustomFilter(id, options).then((request) => request(axios, basePath));
},
/**
*
* @param {string} id A unique integer value identifying this food.
@ -11324,6 +11648,14 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?:
listCookLogs(page?: number, pageSize?: number, options?: any): AxiosPromise<InlineResponse200> {
return localVarFp.listCookLogs(page, pageSize, options).then((request) => request(axios, basePath));
},
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listCustomFilters(options?: any): AxiosPromise<Array<CustomFilter>> {
return localVarFp.listCustomFilters(options).then((request) => request(axios, basePath));
},
/**
*
* @param {*} [options] Override http request option.
@ -11660,6 +11992,16 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?:
partialUpdateCookLog(id: string, cookLog?: CookLog, options?: any): AxiosPromise<CookLog> {
return localVarFp.partialUpdateCookLog(id, cookLog, options).then((request) => request(axios, basePath));
},
/**
*
* @param {string} id A unique integer value identifying this custom filter.
* @param {CustomFilter} [customFilter]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
partialUpdateCustomFilter(id: string, customFilter?: CustomFilter, options?: any): AxiosPromise<CustomFilter> {
return localVarFp.partialUpdateCustomFilter(id, customFilter, options).then((request) => request(axios, basePath));
},
/**
*
* @param {string} id A unique integer value identifying this food.
@ -11919,6 +12261,15 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?:
retrieveCookLog(id: string, options?: any): AxiosPromise<CookLog> {
return localVarFp.retrieveCookLog(id, options).then((request) => request(axios, basePath));
},
/**
*
* @param {string} id A unique integer value identifying this custom filter.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
retrieveCustomFilter(id: string, options?: any): AxiosPromise<CustomFilter> {
return localVarFp.retrieveCustomFilter(id, options).then((request) => request(axios, basePath));
},
/**
*
* @param {string} id A unique integer value identifying this food.
@ -12194,6 +12545,16 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?:
updateCookLog(id: string, cookLog?: CookLog, options?: any): AxiosPromise<CookLog> {
return localVarFp.updateCookLog(id, cookLog, options).then((request) => request(axios, basePath));
},
/**
*
* @param {string} id A unique integer value identifying this custom filter.
* @param {CustomFilter} [customFilter]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updateCustomFilter(id: string, customFilter?: CustomFilter, options?: any): AxiosPromise<CustomFilter> {
return localVarFp.updateCustomFilter(id, customFilter, options).then((request) => request(axios, basePath));
},
/**
*
* @param {string} id A unique integer value identifying this food.
@ -12460,6 +12821,17 @@ export class ApiApi extends BaseAPI {
return ApiApiFp(this.configuration).createCookLog(cookLog, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @param {CustomFilter} [customFilter]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ApiApi
*/
public createCustomFilter(customFilter?: CustomFilter, options?: any) {
return ApiApiFp(this.configuration).createCustomFilter(customFilter, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @param {Food} [food]
@ -12738,6 +13110,17 @@ export class ApiApi extends BaseAPI {
return ApiApiFp(this.configuration).destroyCookLog(id, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @param {string} id A unique integer value identifying this custom filter.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ApiApi
*/
public destroyCustomFilter(id: string, options?: any) {
return ApiApiFp(this.configuration).destroyCustomFilter(id, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @param {string} id A unique integer value identifying this food.
@ -13024,6 +13407,16 @@ export class ApiApi extends BaseAPI {
return ApiApiFp(this.configuration).listCookLogs(page, pageSize, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ApiApi
*/
public listCustomFilters(options?: any) {
return ApiApiFp(this.configuration).listCustomFilters(options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @param {*} [options] Override http request option.
@ -13426,6 +13819,18 @@ export class ApiApi extends BaseAPI {
return ApiApiFp(this.configuration).partialUpdateCookLog(id, cookLog, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @param {string} id A unique integer value identifying this custom filter.
* @param {CustomFilter} [customFilter]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ApiApi
*/
public partialUpdateCustomFilter(id: string, customFilter?: CustomFilter, options?: any) {
return ApiApiFp(this.configuration).partialUpdateCustomFilter(id, customFilter, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @param {string} id A unique integer value identifying this food.
@ -13737,6 +14142,17 @@ export class ApiApi extends BaseAPI {
return ApiApiFp(this.configuration).retrieveCookLog(id, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @param {string} id A unique integer value identifying this custom filter.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ApiApi
*/
public retrieveCustomFilter(id: string, options?: any) {
return ApiApiFp(this.configuration).retrieveCustomFilter(id, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @param {string} id A unique integer value identifying this food.
@ -14072,6 +14488,18 @@ export class ApiApi extends BaseAPI {
return ApiApiFp(this.configuration).updateCookLog(id, cookLog, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @param {string} id A unique integer value identifying this custom filter.
* @param {CustomFilter} [customFilter]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ApiApi
*/
public updateCustomFilter(id: string, customFilter?: CustomFilter, options?: any) {
return ApiApiFp(this.configuration).updateCustomFilter(id, customFilter, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @param {string} id A unique integer value identifying this food.