diff --git a/src/components/admin/user/webapi/CreateWebapiModal.vue b/src/components/admin/user/webapi/CreateWebapiModal.vue new file mode 100644 index 0000000..1b3df8d --- /dev/null +++ b/src/components/admin/user/webapi/CreateWebapiModal.vue @@ -0,0 +1,81 @@ + + + + + diff --git a/src/components/admin/user/webapi/DeleteWebapiModal.vue b/src/components/admin/user/webapi/DeleteWebapiModal.vue new file mode 100644 index 0000000..002157c --- /dev/null +++ b/src/components/admin/user/webapi/DeleteWebapiModal.vue @@ -0,0 +1,75 @@ + + + + + diff --git a/src/components/admin/user/webapi/WebapiListItem.vue b/src/components/admin/user/webapi/WebapiListItem.vue new file mode 100644 index 0000000..64b2d19 --- /dev/null +++ b/src/components/admin/user/webapi/WebapiListItem.vue @@ -0,0 +1,107 @@ + + + + + diff --git a/src/components/admin/user/webapi/WebapiTokenModal.vue b/src/components/admin/user/webapi/WebapiTokenModal.vue new file mode 100644 index 0000000..e3b6d91 --- /dev/null +++ b/src/components/admin/user/webapi/WebapiTokenModal.vue @@ -0,0 +1,56 @@ + + + + + diff --git a/src/router/index.ts b/src/router/index.ts index 335f7fa..ad7f073 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -582,6 +582,36 @@ const router = createRouter({ }, ], }, + { + path: "webapi", + name: "admin-user-webapi-route", + component: () => import("@/views/RouterView.vue"), + meta: { type: "read", section: "user", module: "webapi" }, + beforeEnter: [abilityAndNavUpdate], + children: [ + { + path: "", + name: "admin-user-webapi", + component: () => import("@/views/admin/user/webapi/Webapi.vue"), + }, + { + path: ":id/edit", + name: "admin-user-webapi-edit", + component: () => import("@/views/admin/user/webapi/WebapiEdit.vue"), + meta: { type: "update", section: "user", module: "webapi" }, + beforeEnter: [abilityAndNavUpdate], + props: true, + }, + { + path: ":id/permission", + name: "admin-user-webapi-permission", + component: () => import("@/views/admin/user/webapi/WebapiEditPermission.vue"), + meta: { type: "update", section: "user", module: "webapi" }, + beforeEnter: [abilityAndNavUpdate], + props: true, + }, + ], + }, ], }, { @@ -622,6 +652,11 @@ const router = createRouter({ name: "account-administration", component: () => import("@/views/account/Administration.vue"), }, + { + path: "version", + name: "account-version", + component: () => import("@/views/account/VersionDisplay.vue"), + }, { path: ":pathMatch(.*)*", name: "account-404", diff --git a/src/stores/admin/club/member/member.ts b/src/stores/admin/club/member/member.ts index c7892c2..1d96dc7 100644 --- a/src/stores/admin/club/member/member.ts +++ b/src/stores/admin/club/member/member.ts @@ -1,5 +1,9 @@ import { defineStore } from "pinia"; -import type { CreateMemberViewModel, UpdateMemberViewModel } from "@/viewmodels/admin/club/member/member.models"; +import type { + CreateMemberViewModel, + MemberStatisticsViewModel, + UpdateMemberViewModel, +} from "@/viewmodels/admin/club/member/member.models"; import { http } from "@/serverCom"; import type { AxiosResponse } from "axios"; import type { MemberViewModel } from "@/viewmodels/admin/club/member/member.models"; @@ -12,6 +16,7 @@ export const useMemberStore = defineStore("member", { loading: "loading" as "loading" | "fetched" | "failed", activeMember: null as number | null, activeMemberObj: null as MemberViewModel | null, + activeMemberStatistics: null as MemberStatisticsViewModel | null, loadingActive: "loading" as "loading" | "fetched" | "failed", }; }, @@ -70,6 +75,17 @@ export const useMemberStore = defineStore("member", { fetchMemberById(id: number) { return http.get(`/admin/member/${id}`); }, + fetchMemberStatisticsByActiveId() { + http + .get(`/admin/member/${this.activeMember}/statistics`) + .then((res) => { + this.activeMemberStatistics = res.data; + }) + .catch((err) => {}); + }, + fetchMemberStatisticsById(id: number) { + return http.get(`/admin/member/${id}/statistics`); + }, async createMember(member: CreateMemberViewModel): Promise> { const result = await http.post(`/admin/member`, { salutation: member.salutation, diff --git a/src/stores/admin/club/member/membership.ts b/src/stores/admin/club/member/membership.ts index a430bf4..fd2aaf8 100644 --- a/src/stores/admin/club/member/membership.ts +++ b/src/stores/admin/club/member/membership.ts @@ -6,6 +6,7 @@ import type { MemberViewModel } from "@/viewmodels/admin/club/member/member.mode import { useMemberStore } from "./member"; import type { CreateMembershipViewModel, + MembershipStatisticsViewModel, MembershipViewModel, UpdateMembershipViewModel, } from "@/viewmodels/admin/club/member/membership.models"; @@ -14,6 +15,7 @@ export const useMembershipStore = defineStore("membership", { state: () => { return { memberships: [] as Array, + membershipStatistics: [] as Array, loading: "loading" as "loading" | "fetched" | "failed", }; }, @@ -31,6 +33,15 @@ export const useMembershipStore = defineStore("membership", { this.loading = "failed"; }); }, + fetchMembershipStatisticsForMember() { + const memberId = useMemberStore().activeMember; + http + .get(`/admin/member/${memberId}/memberships/statistics`) + .then((result) => { + this.membershipStatistics = result.data; + }) + .catch((err) => {}); + }, fetchMembershipById(id: number) { const memberId = useMemberStore().activeMember; return http.get(`/admin/member/${memberId}/membership/${id}`); diff --git a/src/stores/admin/navigation.ts b/src/stores/admin/navigation.ts index 782e42f..bd1bc84 100644 --- a/src/stores/admin/navigation.ts +++ b/src/stores/admin/navigation.ts @@ -131,6 +131,7 @@ export const useNavigationStore = defineStore("navigation", { main: [ ...(abilityStore.can("read", "user", "user") ? [{ key: "user", title: "Benutzer" }] : []), ...(abilityStore.can("read", "user", "role") ? [{ key: "role", title: "Rollen" }] : []), + ...(abilityStore.can("read", "user", "webapi") ? [{ key: "webapi", title: "Webapi-Token" }] : []), ], }, } as navigationModel; diff --git a/src/stores/admin/user/webapi.ts b/src/stores/admin/user/webapi.ts new file mode 100644 index 0000000..66a57e7 --- /dev/null +++ b/src/stores/admin/user/webapi.ts @@ -0,0 +1,63 @@ +import { defineStore } from "pinia"; +import type { + CreateWebapiViewModel, + UpdateWebapiViewModel, + WebapiViewModel, +} from "@/viewmodels/admin/user/webapi.models"; +import { http } from "@/serverCom"; +import type { PermissionObject } from "@/types/permissionTypes"; +import type { AxiosResponse } from "axios"; + +export const useWebapiStore = defineStore("webapi", { + state: () => { + return { + webapis: [] as Array, + loading: null as null | "loading" | "success" | "failed", + }; + }, + actions: { + fetchWebapis() { + this.loading = "loading"; + http + .get("/admin/webapi") + .then((result) => { + this.webapis = result.data; + this.loading = "success"; + }) + .catch((err) => { + this.loading = "failed"; + }); + }, + fetchWebapiById(id: number): Promise> { + return http.get(`/admin/webapi/${id}`); + }, + fetchWebapiTokenById(id: number): Promise> { + return http.get(`/admin/webapi/${id}/token`); + }, + async createWebapi(webapi: CreateWebapiViewModel): Promise> { + const result = await http.post("/admin/webapi", webapi); + this.fetchWebapis(); + return result; + }, + async updateActiveWebapi(id: number, webapi: UpdateWebapiViewModel): Promise> { + const result = await http.patch(`/admin/webapi/${id}`, webapi); + this.fetchWebapis(); + return result; + }, + async updateActiveWebapiPermissions( + webapi: number, + permission: PermissionObject + ): Promise> { + const result = await http.patch(`/admin/webapi/${webapi}/permissions`, { + permissions: permission, + }); + this.fetchWebapis(); + return result; + }, + async deleteWebapi(webapi: number): Promise> { + const result = await http.delete(`/admin/webapi/${webapi}`); + this.fetchWebapis(); + return result; + }, + }, +}); diff --git a/src/types/permissionTypes.ts b/src/types/permissionTypes.ts index 95ea543..5ba5cb4 100644 --- a/src/types/permissionTypes.ts +++ b/src/types/permissionTypes.ts @@ -14,6 +14,7 @@ export type PermissionModule = | "calendar_type" | "user" | "role" + | "webapi" | "query" | "query_store" | "template" @@ -55,6 +56,7 @@ export const permissionModules: Array = [ "calendar_type", "user", "role", + "webapi", "query", "query_store", "template", @@ -75,5 +77,5 @@ export const sectionsAndModules: SectionsAndModulesObject = { "template_usage", "newsletter_config", ], - user: ["user", "role"], + user: ["user", "role", "webapi"], }; diff --git a/src/viewmodels/admin/club/member/member.models.ts b/src/viewmodels/admin/club/member/member.models.ts index ca5fcc1..0283545 100644 --- a/src/viewmodels/admin/club/member/member.models.ts +++ b/src/viewmodels/admin/club/member/member.models.ts @@ -17,6 +17,18 @@ export interface MemberViewModel { preferredCommunication?: Array; } +export interface MemberStatisticsViewModel { + id: number; + salutation: Salutation; + firstname: string; + lastname: string; + nameaffix: string; + birthdate: Date; + todayAge: number; + ageThisYear: number; + exactAge: string; +} + export interface CreateMemberViewModel { salutation: Salutation; firstname: string; diff --git a/src/viewmodels/admin/club/member/membership.models.ts b/src/viewmodels/admin/club/member/membership.models.ts index 82ede06..b2114c0 100644 --- a/src/viewmodels/admin/club/member/membership.models.ts +++ b/src/viewmodels/admin/club/member/membership.models.ts @@ -1,3 +1,5 @@ +import type { Salutation } from "../../../../enums/salutation"; + export interface MembershipViewModel { id: number; start: Date; @@ -7,6 +9,19 @@ export interface MembershipViewModel { statusId: number; } +export interface MembershipStatisticsViewModel { + durationInDays: number; + durationInYears: string; + status: string; + statusId: number; + memberId: number; + memberSalutation: Salutation; + memberFirstname: string; + memberLastname: string; + memberNameaffix: string; + memberBirthdate: Date; +} + export interface CreateMembershipViewModel { start: Date; statusId: number; diff --git a/src/viewmodels/admin/user/webapi.models.ts b/src/viewmodels/admin/user/webapi.models.ts new file mode 100644 index 0000000..015837c --- /dev/null +++ b/src/viewmodels/admin/user/webapi.models.ts @@ -0,0 +1,20 @@ +import type { PermissionObject } from "@/types/permissionTypes"; + +export interface WebapiViewModel { + id: number; + permissions: PermissionObject; + title: string; + createdAt: Date; + lastUsage?: Date; + expiry?: Date; +} + +export interface CreateWebapiViewModel { + title: string; + expiry?: Date; +} + +export interface UpdateWebapiViewModel { + title: string; + expiry?: Date; +} diff --git a/src/viewmodels/version.models.ts b/src/viewmodels/version.models.ts new file mode 100644 index 0000000..fe2bf37 --- /dev/null +++ b/src/viewmodels/version.models.ts @@ -0,0 +1,21 @@ +export interface Release { + creator: string; + title: string; + link: string; + pubDate: string; + author: string; + "content:encoded": string; + "content:encodedSnippet": string; + content: string; + contentSnippet: string; + guid: string; + isoDate: string; +} + +export interface Releases { + items: Release[]; + title: string; + description: string; + pubDate: string; + link: string; +} diff --git a/src/views/account/Administration.vue b/src/views/account/Administration.vue index e6dd5ca..558e3a6 100644 --- a/src/views/account/Administration.vue +++ b/src/views/account/Administration.vue @@ -15,7 +15,9 @@
diff --git a/src/views/account/VersionDisplay.vue b/src/views/account/VersionDisplay.vue new file mode 100644 index 0000000..9b6cc12 --- /dev/null +++ b/src/views/account/VersionDisplay.vue @@ -0,0 +1,154 @@ + + + + + diff --git a/src/views/account/View.vue b/src/views/account/View.vue index 5c870b3..465f913 100644 --- a/src/views/account/View.vue +++ b/src/views/account/View.vue @@ -1,13 +1,22 @@