mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2025-12-24 02:39:20 -05:00
playing with search
This commit is contained in:
@@ -1095,6 +1095,15 @@ class RecipeViewSet(viewsets.ModelViewSet):
|
||||
levels=levels) # TODO: make levels a user setting, included in request data?, keep solely in the backend?
|
||||
return Response(self.serializer_class(qs, many=True).data)
|
||||
|
||||
@decorators.action(
|
||||
detail=False,
|
||||
methods=['GET'],
|
||||
)
|
||||
def flat(self, request):
|
||||
return JsonResponse({'data': list(Recipe.objects.filter(space=request.space).filter(
|
||||
Q(private=False) | (Q(private=True) & (Q(created_by=self.request.user) | Q(shared=self.request.user)))
|
||||
).values_list('name', flat=True))})
|
||||
|
||||
|
||||
class UnitConversionViewSet(viewsets.ModelViewSet):
|
||||
queryset = UnitConversion.objects
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
<script lang="ts">
|
||||
|
||||
import {defineComponent, PropType} from 'vue'
|
||||
import {Ingredient, Recipe} from "@/openapi"
|
||||
import {ApiApi, Ingredient, Recipe} from "@/openapi"
|
||||
import KeywordsBar from "@/components/display/KeywordsBar.vue"
|
||||
import NumberScalerDialog from "@/components/inputs/NumberScalerDialog.vue"
|
||||
import IngredientsTable from "@/components/display/IngredientsTable.vue";
|
||||
@@ -83,14 +83,20 @@ import RecipeActivity from "@/components/display/RecipeActivity.vue";
|
||||
export default defineComponent({
|
||||
name: "RecipeView",
|
||||
components: {RecipeActivity, Step, StepsOverview, IngredientsTable, NumberScalerDialog, KeywordsBar},
|
||||
computed: {
|
||||
computed: {},
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
props: {
|
||||
recipe: {
|
||||
type: Object as PropType<Recipe>,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
methods: {}
|
||||
})
|
||||
|
||||
@@ -3781,6 +3781,32 @@ export class ApiApi extends runtime.BaseAPI {
|
||||
return await response.value();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
async flatRecipeRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Recipe>> {
|
||||
const queryParameters: any = {};
|
||||
|
||||
const headerParameters: runtime.HTTPHeaders = {};
|
||||
|
||||
const response = await this.request({
|
||||
path: `/api/recipe/flat/`,
|
||||
method: 'GET',
|
||||
headers: headerParameters,
|
||||
query: queryParameters,
|
||||
}, initOverrides);
|
||||
|
||||
return new runtime.JSONApiResponse(response, (jsonValue) => RecipeFromJSON(jsonValue));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
async flatRecipe(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Recipe> {
|
||||
const response = await this.flatRecipeRaw(initOverrides);
|
||||
return await response.value();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user