diff --git a/src/lib/components/MultiSelect.svelte b/src/lib/components/MultiSelect.svelte index 8d949fc..b9ec30a 100644 --- a/src/lib/components/MultiSelect.svelte +++ b/src/lib/components/MultiSelect.svelte @@ -67,7 +67,7 @@ Erstellt am {new Date(topic.createdAt).toLocaleDateString('de-DE')}
+ {getLanguageIcon(topic.language ?? 'de')} {#each topic.thesisType as tt} {tt} {/each} diff --git a/src/lib/utils/index.js b/src/lib/utils/index.js new file mode 100644 index 0000000..3b7c880 --- /dev/null +++ b/src/lib/utils/index.js @@ -0,0 +1,12 @@ +export function getLanguageIcon(language){ + switch(language){ + case 'de': + return '🇩🇪'; + case 'en': + return '🇬🇧'; + case 'de_en': + return '🇩🇪/🇬🇧'; + default: + return language; + } +} \ No newline at end of file diff --git a/src/routes/(protectedRoutes)/api/suggestions/+server.js b/src/routes/(protectedRoutes)/api/suggestions/+server.js index 82c79df..8238108 100644 --- a/src/routes/(protectedRoutes)/api/suggestions/+server.js +++ b/src/routes/(protectedRoutes)/api/suggestions/+server.js @@ -8,7 +8,7 @@ export async function POST({ request }) { for (let sub of query) { if (sub.length == 0 && query != '') continue; let result = await db.query( - `SELECT * FROM topics WHERE string::lowercase($value) INSIDE string::lowercase(${field}) LIMIT 5`, + `SELECT * FROM topics WHERE ${field} ?~ $value LIMIT 5`, { value: sub } diff --git a/src/routes/(protectedRoutes)/create/+page.server.js b/src/routes/(protectedRoutes)/create/+page.server.js index 4f7b802..dc16326 100644 --- a/src/routes/(protectedRoutes)/create/+page.server.js +++ b/src/routes/(protectedRoutes)/create/+page.server.js @@ -14,6 +14,7 @@ const filterSchema = z.object({ specialization: z .array(z.string({ required_error: 'Eine Spezialisierung wird benötigt' }).trim()) .min(1, { message: 'Eine Spezialisierung wird benötigt' }), + language: z.string(), thesisType: z .array(z.string({ required_error: 'Thesistyp(en) wird benötigt' })) .min(1, { message: 'Thesistyp(en) wird benötigt' }) diff --git a/src/routes/(protectedRoutes)/create/+page.svelte b/src/routes/(protectedRoutes)/create/+page.svelte index a0fe25d..7fb9bc0 100644 --- a/src/routes/(protectedRoutes)/create/+page.svelte +++ b/src/routes/(protectedRoutes)/create/+page.svelte @@ -2,7 +2,7 @@ export let data; export let form; - import { Input, Textarea } from '$lib/components'; + import { Input, Textarea, Select } from '$lib/components'; let thesisType = [ { id: 'Bachelor', text: 'Bachelor Thesis' }, @@ -59,7 +59,7 @@ errorMsg={form?.errors?.areaOfExpertise ?? ''} required />
-
+
+
+ - import { Input, TopicView, Pagination } from '$lib/components'; + import { Input, TopicView, Pagination, Select } from '$lib/components'; import Search from 'svelte-material-icons/Magnify.svelte'; import ArrowDown from 'svelte-material-icons/ChevronDown.svelte'; import ArrowUp from 'svelte-material-icons/ChevronUp.svelte'; @@ -105,6 +105,9 @@ suggestions bind:value={formData.technologies} />
+
+