diff --git a/.eslintrc.json b/.eslintrc.json index d506fa2..3fff59d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,6 +1,12 @@ { "root": true, - "ignorePatterns": ["dist/**", ".output/**", ".nuxt/**", "dockerdata/**"], + "ignorePatterns": [ + "dist/**", + ".output/**", + ".nuxt/**", + "dockerdata/**", + "node_modules/**" + ], "extends": [ "eslint:recommended", "plugin:json/recommended", @@ -37,6 +43,7 @@ "*~/server/logic", "*~/server/prisma", "*~/server/sync", + "*~/server/types", "*~/server/validation", "*~/server/utils", "*~/utils/*" diff --git a/components/Breadcrumbs.vue b/components/Breadcrumbs.vue new file mode 100644 index 0000000..d0877b2 --- /dev/null +++ b/components/Breadcrumbs.vue @@ -0,0 +1,18 @@ + + + diff --git a/components/Input/Select.vue b/components/Input/Select.vue index ae39305..ac4916c 100644 --- a/components/Input/Select.vue +++ b/components/Input/Select.vue @@ -1,5 +1,5 @@ diff --git a/composables/useBreadcrumbs.ts b/composables/useBreadcrumbs.ts new file mode 100644 index 0000000..7c24536 --- /dev/null +++ b/composables/useBreadcrumbs.ts @@ -0,0 +1,59 @@ +import { Group, Member } from "~/server/types"; + +export const useBreadcrumbs = () => { + const route = computed(() => useRoute().path.slice(1).split("/")); + + const breadCrumbs = computed(() => { + const crumbs = []; + let link = ""; + + for (const crumb of route.value) { + crumbs.push({ + name: formatCrumb(crumb), + link: (link = link + "/" + crumb), + }); + } + return crumbs; + }); + + const groupCrumbs = (group: Group) => + computed(() => { + const crumbs = []; + let link = ""; + + for (const crumb of route.value) { + link = link + "/" + crumb; + const name = crumb === group.id ? group.name : formatCrumb(crumb); + crumbs.push({ name, link }); + } + return crumbs; + }); + + const memberCrumbs = (member: Member) => + computed(() => { + const crumbs = []; + let link = ""; + + for (const crumb of route.value) { + link = link + "/" + crumb; + const name = + crumb === member.id + ? `${member.firstName} ${member.insertion} ${member.lastName}` + : formatCrumb(crumb); + crumbs.push({ name, link }); + } + return crumbs; + }); + + return { + breadCrumbs, + memberCrumbs, + groupCrumbs, + }; +}; + +const formatCrumb = (crumb: string) => { + let parts = crumb.split("-"); + parts = parts.map((p) => p.charAt(0).toUpperCase() + p.slice(1)); + return parts.join(" "); +}; diff --git a/composables/useDateFormatter.ts b/composables/useDateFormatter.ts new file mode 100644 index 0000000..31685c6 --- /dev/null +++ b/composables/useDateFormatter.ts @@ -0,0 +1,31 @@ +export const useDateFormatter = () => { + const dateToString = (date?: Date) => + computed(() => { + if (!date) return "-"; + const day = date.getDate(); + const month = date.getMonth() + 1; + const year = date.getFullYear(); + return `${day}-${month}-${year}`; + }); + + const ISOToString = (date?: string) => + computed(() => { + if (!date) return "-"; + const day = date.slice(8, 10); + const month = date.slice(5, 7); + const year = date.slice(0, 4); + return `${day}-${month}-${year}`; + }); + + const ISOToDateInputString = (date?: string) => + computed(() => { + if (!date) return ""; + return date.slice(0, 10); + }); + + return { + dateToString, + ISOToString, + ISOToDateInputString, + }; +}; diff --git a/middleware/validateRouteUUID.global.ts b/middleware/validateRouteUUID.global.ts new file mode 100644 index 0000000..c0950b4 --- /dev/null +++ b/middleware/validateRouteUUID.global.ts @@ -0,0 +1,13 @@ +import validator from "validator"; + +export default defineNuxtRouteMiddleware((to) => { + if (!to.params.id) { + return true; + } + + if (typeof to.params.id !== "string") { + return false; + } + + return validator.isUUID(to.params.id); +}); diff --git a/package.json b/package.json index 729dd03..7c0afd7 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "devDependencies": { "@nuxtjs/eslint-config-typescript": "^11.0.0", "@nuxtjs/tailwindcss": "^6.1.3", - "@prisma/client": "^4.6.1", + "@prisma/client": "^4.7.1", "@types/node": "^18.11.9", "@types/validator": "^13.7.10", "@typescript-eslint/eslint-plugin": "^5.42.0", @@ -39,12 +39,12 @@ "nuxt-icon": "^0.1.7", "postcss-custom-properties": "^13.0.0", "prettier": "^2.7.1", - "prisma": "^4.6.1", + "prisma": "^4.7.1", "typescript": "^4.8.4", "vue-eslint-parser": "^9.1.0" }, "dependencies": { - "@sidebase/nuxt-auth": "^0.3.0-alpha.1", + "@sidebase/nuxt-auth": "^0.3.0", "daisyui": "^2.38.0", "superstruct": "^1.0.3", "validator": "^13.7.0" diff --git a/pages/groepen.vue b/pages/groepen.vue new file mode 100644 index 0000000..913943e --- /dev/null +++ b/pages/groepen.vue @@ -0,0 +1,50 @@ + + + diff --git a/pages/groepen/[id].vue b/pages/groepen/[id].vue new file mode 100644 index 0000000..35f61f1 --- /dev/null +++ b/pages/groepen/[id].vue @@ -0,0 +1,14 @@ + + + diff --git a/pages/groepen/[id]/index.vue b/pages/groepen/[id]/index.vue new file mode 100644 index 0000000..ef9763e --- /dev/null +++ b/pages/groepen/[id]/index.vue @@ -0,0 +1,108 @@ + + + diff --git a/pages/groepen/[id]/instellingen.vue b/pages/groepen/[id]/instellingen.vue new file mode 100644 index 0000000..3287193 --- /dev/null +++ b/pages/groepen/[id]/instellingen.vue @@ -0,0 +1,31 @@ + + + diff --git a/pages/groepen/[id]/leden.vue b/pages/groepen/[id]/leden.vue new file mode 100644 index 0000000..d9db6a4 --- /dev/null +++ b/pages/groepen/[id]/leden.vue @@ -0,0 +1,32 @@ + + + diff --git a/pages/groepen/[id]/toevoegen.vue b/pages/groepen/[id]/toevoegen.vue new file mode 100644 index 0000000..6baf423 --- /dev/null +++ b/pages/groepen/[id]/toevoegen.vue @@ -0,0 +1,11 @@ + + + diff --git a/pages/groepen/[id]/uitschrijvingen.vue b/pages/groepen/[id]/uitschrijvingen.vue new file mode 100644 index 0000000..7d175fe --- /dev/null +++ b/pages/groepen/[id]/uitschrijvingen.vue @@ -0,0 +1,11 @@ + + + diff --git a/pages/groepen/index.vue b/pages/groepen/index.vue new file mode 100644 index 0000000..0f6047c --- /dev/null +++ b/pages/groepen/index.vue @@ -0,0 +1,52 @@ + + + diff --git a/pages/groepen/mijn-groepen.vue b/pages/groepen/mijn-groepen.vue new file mode 100644 index 0000000..00a9b34 --- /dev/null +++ b/pages/groepen/mijn-groepen.vue @@ -0,0 +1,57 @@ + + + diff --git a/pages/groepen/nieuw.vue b/pages/groepen/nieuw.vue new file mode 100644 index 0000000..a91bb06 --- /dev/null +++ b/pages/groepen/nieuw.vue @@ -0,0 +1,92 @@ + + + diff --git a/pages/leden.vue b/pages/leden.vue new file mode 100644 index 0000000..27d4797 --- /dev/null +++ b/pages/leden.vue @@ -0,0 +1,85 @@ + + + diff --git a/pages/leden/[id].vue b/pages/leden/[id].vue new file mode 100644 index 0000000..3ac574f --- /dev/null +++ b/pages/leden/[id].vue @@ -0,0 +1,14 @@ + + + diff --git a/pages/leden/[id]/contact.vue b/pages/leden/[id]/contact.vue new file mode 100644 index 0000000..a75edbd --- /dev/null +++ b/pages/leden/[id]/contact.vue @@ -0,0 +1,11 @@ + + + diff --git a/pages/leden/[id]/gegevens.vue b/pages/leden/[id]/gegevens.vue new file mode 100644 index 0000000..78dcfea --- /dev/null +++ b/pages/leden/[id]/gegevens.vue @@ -0,0 +1,158 @@ + + + diff --git a/pages/leden/[id]/groepen.vue b/pages/leden/[id]/groepen.vue new file mode 100644 index 0000000..4d1bf7a --- /dev/null +++ b/pages/leden/[id]/groepen.vue @@ -0,0 +1,11 @@ + + + diff --git a/pages/leden/[id]/index.vue b/pages/leden/[id]/index.vue new file mode 100644 index 0000000..fabf3b7 --- /dev/null +++ b/pages/leden/[id]/index.vue @@ -0,0 +1,58 @@ + + + diff --git a/pages/leden/[id]/instellingen.vue b/pages/leden/[id]/instellingen.vue new file mode 100644 index 0000000..01fb617 --- /dev/null +++ b/pages/leden/[id]/instellingen.vue @@ -0,0 +1,11 @@ + + + diff --git a/pages/leden/[id]/studies.vue b/pages/leden/[id]/studies.vue new file mode 100644 index 0000000..fb62bac --- /dev/null +++ b/pages/leden/[id]/studies.vue @@ -0,0 +1,11 @@ + + + diff --git a/pages/leden/exporteren.vue b/pages/leden/exporteren.vue new file mode 100644 index 0000000..a384b94 --- /dev/null +++ b/pages/leden/exporteren.vue @@ -0,0 +1,8 @@ + + + diff --git a/pages/leden/index.vue b/pages/leden/index.vue new file mode 100644 index 0000000..9efed9f --- /dev/null +++ b/pages/leden/index.vue @@ -0,0 +1,55 @@ + + + diff --git a/pages/leden/toevoegen.vue b/pages/leden/toevoegen.vue new file mode 100644 index 0000000..799098a --- /dev/null +++ b/pages/leden/toevoegen.vue @@ -0,0 +1,151 @@ + + + diff --git a/pages/leden/uitnodigen.vue b/pages/leden/uitnodigen.vue new file mode 100644 index 0000000..6a2194e --- /dev/null +++ b/pages/leden/uitnodigen.vue @@ -0,0 +1,11 @@ + + + diff --git a/pages/material.vue b/pages/material.vue index 4671f1f..886b6fc 100644 --- a/pages/material.vue +++ b/pages/material.vue @@ -1,17 +1,18 @@ + + diff --git a/pages/material/index.vue b/pages/material/index.vue index 2400b77..c753797 100644 --- a/pages/material/index.vue +++ b/pages/material/index.vue @@ -1,3 +1,7 @@ + + diff --git a/pages/material/types.vue b/pages/material/types.vue index 4172a66..9ca762a 100644 --- a/pages/material/types.vue +++ b/pages/material/types.vue @@ -1,5 +1,5 @@