diff --git a/src/routes/.jukit/.jukit_info.json b/src/routes/.jukit/.jukit_info.json deleted file mode 100644 index 92c7342..0000000 --- a/src/routes/.jukit/.jukit_info.json +++ /dev/null @@ -1 +0,0 @@ -{"terminal": "nvimterm"} \ No newline at end of file diff --git a/src/routes/api/items/all_brief/+server.ts b/src/routes/api/items/all_brief/+server.ts index 8dfd7c4..fc99258 100644 --- a/src/routes/api/items/all_brief/+server.ts +++ b/src/routes/api/items/all_brief/+server.ts @@ -2,10 +2,11 @@ import { json, type RequestHandler } from '@sveltejs/kit'; import type { BriefRecipeType } from '../../../../types/types'; import { Recipe } from '../../../../models/Recipe' import { dbConnect, dbDisconnect } from '../../../../utils/db'; +import { rand_array } from '$lib/js/randomize'; export const GET: RequestHandler = async ({params}) => { await dbConnect(); - let found_brief = (await Recipe.find({}, 'name short_name tags category icon description season').lean()) as BriefRecipeType[]; + let found_brief = rand_array(await Recipe.find({}, 'name short_name tags category icon description season').lean()) as BriefRecipeType[]; await dbDisconnect(); return json(JSON.parse(JSON.stringify(found_brief))); }; diff --git a/src/routes/api/items/category/[category]/+server.ts b/src/routes/api/items/category/[category]/+server.ts index 64a7f9d..e75a5b5 100644 --- a/src/routes/api/items/category/[category]/+server.ts +++ b/src/routes/api/items/category/[category]/+server.ts @@ -2,10 +2,11 @@ import { json, type RequestHandler } from '@sveltejs/kit'; import { Recipe } from '../../../../../models/Recipe'; import { dbConnect, dbDisconnect } from '../../../../../utils/db'; import type {BriefRecipeType} from '../../../../../types/types'; +import { rand_array } from '$lib/js/randomize'; export const GET: RequestHandler = async ({params}) => { await dbConnect(); - let recipes = (await Recipe.find({category: params.category}, 'name short_name images tags category icon description season').lean()) as BriefRecipeType[]; + let recipes = rand_array(await Recipe.find({category: params.category}, 'name short_name images tags category icon description season').lean()) as BriefRecipeType[]; await dbDisconnect(); recipes = JSON.parse(JSON.stringify(recipes)); diff --git a/src/routes/api/items/icon/[icon]/+server.ts b/src/routes/api/items/icon/[icon]/+server.ts index 9a50c55..0b22e5d 100644 --- a/src/routes/api/items/icon/[icon]/+server.ts +++ b/src/routes/api/items/icon/[icon]/+server.ts @@ -2,10 +2,11 @@ import { json, type RequestHandler } from '@sveltejs/kit'; import { Recipe } from '../../../../../models/Recipe'; import { dbConnect, dbDisconnect } from '../../../../../utils/db'; import type {BriefRecipeType} from '../../../../../types/types'; +import { rand_array } from '$lib/js/randomize'; export const GET: RequestHandler = async ({params}) => { await dbConnect(); - let recipes = (await Recipe.find({icon: params.icon}, 'name short_name images tags category icon description season').lean()) as BriefRecipeType[]; + let recipes = rand_array(await Recipe.find({icon: params.icon}, 'name short_name images tags category icon description season').lean()) as BriefRecipeType[]; await dbDisconnect(); recipes = JSON.parse(JSON.stringify(recipes)); diff --git a/src/routes/api/items/in_season/[month]/+server.ts b/src/routes/api/items/in_season/[month]/+server.ts index faeebbf..c5aebc7 100644 --- a/src/routes/api/items/in_season/[month]/+server.ts +++ b/src/routes/api/items/in_season/[month]/+server.ts @@ -1,10 +1,12 @@ +import type {rand_array} from '$lib/js/randomize'; import { json, type RequestHandler } from '@sveltejs/kit'; import { Recipe } from '../../../../../models/Recipe' import { dbConnect, dbDisconnect } from '../../../../../utils/db'; +import { rand_array } from '$lib/js/randomize'; export const GET: RequestHandler = async ({params}) => { await dbConnect(); - let found_in_season = (await Recipe.find({season: params.month}, 'name short_name images tags category icon description season').lean()); + let found_in_season = rand_array(await Recipe.find({season: params.month}, 'name short_name images tags category icon description season').lean()); await dbDisconnect(); found_in_season = JSON.parse(JSON.stringify(found_in_season)); return json(found_in_season); diff --git a/src/routes/api/items/tag/[tag]/+server.ts b/src/routes/api/items/tag/[tag]/+server.ts index f850280..962368e 100644 --- a/src/routes/api/items/tag/[tag]/+server.ts +++ b/src/routes/api/items/tag/[tag]/+server.ts @@ -2,10 +2,11 @@ import { json, type RequestHandler } from '@sveltejs/kit'; import { Recipe } from '../../../../../models/Recipe'; import { dbConnect, dbDisconnect } from '../../../../../utils/db'; import type {BriefRecipeType} from '../../../../../types/types'; +import { rand_array } from '$lib/js/randomize'; export const GET: RequestHandler = async ({params}) => { await dbConnect(); - let recipes = (await Recipe.find({tags: params.tag}, 'name short_name images tags category icon description season').lean()) as BriefRecipeType[]; + let recipes = rand_array(await Recipe.find({tags: params.tag}, 'name short_name images tags category icon description season').lean()) as BriefRecipeType[]; await dbDisconnect(); recipes = JSON.parse(JSON.stringify(recipes)); diff --git a/src/routes/rezepte/+page.svelte b/src/routes/rezepte/+page.svelte index ad15c0b..0beef27 100644 --- a/src/routes/rezepte/+page.svelte +++ b/src/routes/rezepte/+page.svelte @@ -7,7 +7,7 @@ export let data: PageData; export let current_month = new Date().getMonth() + 1 const all_categories = [ ...new Set (data.all_brief.map(item => item.category))]; - import { rand_array } from '$lib/js/randomize'; + const categories = ["Hauptspeise", "Nudel", "Brot", "Dessert", "Suppe", "Beilage", "Salat", "Kuchen", "Sauce", "Zutat", "Aufstrich", "Guetzli"] + diff --git a/src/routes/test/+page.svelte_ b/src/routes/test/+page.svelte_ deleted file mode 100644 index e8d5be9..0000000 --- a/src/routes/test/+page.svelte_ +++ /dev/null @@ -1,249 +0,0 @@ -
- - - - -