change user to uuid

This commit is contained in:
Julian Krauser 2025-01-29 08:53:42 +01:00
parent 50cbf94ee5
commit 4c5d132de8
17 changed files with 86 additions and 93 deletions

View file

@ -82,27 +82,30 @@ const props = defineProps({
});
const slots = defineSlots<{
pageRow(props: { row: T }): void;
pageRow(props: { row: T; key: number }): void;
}>();
const timer = ref(undefined) as undefined | any;
const currentPage = ref(0);
const searchString = ref("");
const deferingSearch = ref(false)
const deferingSearch = ref(false);
watch(searchString, async () => {
deferingSearch.value = true
deferingSearch.value = true;
clearTimeout(timer.value);
timer.value = setTimeout(() => {
currentPage.value = 0;
deferingSearch.value = false
deferingSearch.value = false;
emit("search", searchString.value);
}, 600);
});
watch(() => props.totalCount, async () => {
watch(
() => props.totalCount,
async () => {
currentPage.value = 0;
});
}
);
const emit = defineEmits({
submit(id: number) {

View file

@ -93,7 +93,7 @@ import Spinner from "../Spinner.vue";
export default defineComponent({
props: {
modelValue: {
type: Array as PropType<Array<number>>,
type: Array as PropType<Array<string>>,
default: [],
},
title: String,
@ -133,7 +133,7 @@ export default defineComponent({
get() {
return this.modelValue;
},
set(val: Array<number>) {
set(val: Array<string>) {
this.$emit("update:model-value", val);
if (this.modelValue.length < val.length) {
let diff = difference(val, this.modelValue);
@ -166,7 +166,7 @@ export default defineComponent({
this.loading = false;
});
},
getMemberFromSearch(id: number) {
getMemberFromSearch(id: string) {
return this.filtered.find((f) => f.id == id);
},
loadMembersInitial() {

View file

@ -178,12 +178,12 @@ export default defineComponent({
if (!this.permissionUpdate[section]) {
this.permissionUpdate[section] = {};
}
this.permissionUpdate[section].all = permissions;
this.permissionUpdate[section]!.all = permissions;
} else {
if (!this.permissionUpdate[section]) {
this.permissionUpdate[section] = {};
}
this.permissionUpdate[section][modul] = permissions;
this.permissionUpdate[section]![modul] = permissions;
}
},
reset() {

View file

@ -14,7 +14,7 @@ export const useMemberStore = defineStore("member", {
members: [] as Array<MemberViewModel & { tab_pos: number }>,
totalCount: 0 as number,
loading: "loading" as "loading" | "fetched" | "failed",
activeMember: null as number | null,
activeMember: null as string | null,
activeMemberObj: null as MemberViewModel | null,
activeMemberStatistics: null as MemberStatisticsViewModel | null,
loadingActive: "loading" as "loading" | "fetched" | "failed",
@ -50,7 +50,7 @@ export const useMemberStore = defineStore("member", {
return { ...res, data: res.data.members };
});
},
async getMembersByIds(ids: Array<number>): Promise<AxiosResponse<any, any>> {
async getMembersByIds(ids: Array<string>): Promise<AxiosResponse<any, any>> {
return await http.get(`/admin/member?ids=${ids.join(",")}&noLimit=true`).then((res) => {
return { ...res, data: res.data.members };
});
@ -72,7 +72,7 @@ export const useMemberStore = defineStore("member", {
this.loadingActive = "failed";
});
},
fetchMemberById(id: number) {
fetchMemberById(id: string) {
return http.get(`/admin/member/${id}`);
},
fetchMemberStatisticsByActiveId() {
@ -83,7 +83,7 @@ export const useMemberStore = defineStore("member", {
})
.catch((err) => {});
},
fetchMemberStatisticsById(id: number) {
fetchMemberStatisticsById(id: string) {
return http.get(`/admin/member/${id}/statistics`);
},
async createMember(member: CreateMemberViewModel): Promise<AxiosResponse<any, any>> {

View file

@ -12,8 +12,8 @@ export const useNewsletterRecipientsStore = defineStore("newsletterRecipients",
state: () => {
return {
initialized: false as boolean,
recipients: [] as Array<number>,
origin: [] as Array<number>,
recipients: [] as Array<string>,
origin: [] as Array<string>,
loading: "loading" as "loading" | "fetched" | "failed",
syncingNewsletterRecipients: "synced" as "synced" | "syncing" | "detectedChanges" | "failed",
};

View file

@ -22,8 +22,8 @@ export const useProtocolPresenceStore = defineStore("protocolPresence", {
getters: {
detectedChangeProtocolPresence: (state) =>
!isEqual(
state.origin.sort((a: ProtocolPresenceViewModel, b: ProtocolPresenceViewModel) => a.memberId - b.memberId),
state.presence.sort((a: ProtocolPresenceViewModel, b: ProtocolPresenceViewModel) => a.memberId - b.memberId)
state.origin, //.sort((a: ProtocolPresenceViewModel, b: ProtocolPresenceViewModel) => a.memberId - b.memberId),
state.presence //.sort((a: ProtocolPresenceViewModel, b: ProtocolPresenceViewModel) => a.memberId - b.memberId)
) && state.syncingProtocolPresence != "syncing",
},
actions: {

View file

@ -24,47 +24,37 @@ export const useUserStore = defineStore("user", {
this.loading = "failed";
});
},
fetchUserById(id: number): Promise<AxiosResponse<any, any>> {
fetchUserById(id: string): Promise<AxiosResponse<any, any>> {
return http.get(`/admin/user/${id}`);
},
updateActiveUser(user: UpdateUserViewModel): Promise<AxiosResponse<any, any>> {
return http
.patch(`/admin/user/${user.id}`, {
async updateActiveUser(user: UpdateUserViewModel): Promise<AxiosResponse<any, any>> {
const result = await http.patch(`/admin/user/${user.id}`, {
username: user.username,
firstname: user.firstname,
lastname: user.lastname,
mail: user.mail,
})
.then((result) => {
});
this.fetchUsers();
return result;
});
},
updateActiveUserPermissions(user: number, permission: PermissionObject): Promise<AxiosResponse<any, any>> {
return http
.patch(`/admin/user/${user}/permissions`, {
async updateActiveUserPermissions(userId: string, permission: PermissionObject): Promise<AxiosResponse<any, any>> {
const result = await http.patch(`/admin/user/${userId}/permissions`, {
permissions: permission,
})
.then((result) => {
});
this.fetchUsers();
return result;
});
},
updateActiveUserRoles(user: number, roles: Array<number>): Promise<AxiosResponse<any, any>> {
return http
.patch(`/admin/user/${user}/roles`, {
async updateActiveUserRoles(userId: string, roles: Array<number>): Promise<AxiosResponse<any, any>> {
const result = await http.patch(`/admin/user/${userId}/roles`, {
roleIds: roles,
})
.then((result) => {
});
this.fetchUsers();
return result;
});
},
deleteUser(user: number): Promise<AxiosResponse<any, any>> {
return http.delete(`/admin/user/${user}`).then((result) => {
async deleteUser(userId: string): Promise<AxiosResponse<any, any>> {
const result = await http.delete(`/admin/user/${userId}`);
this.fetchUsers();
return result;
});
},
},
});

View file

@ -3,7 +3,7 @@ import type { MembershipViewModel } from "./membership.models";
import type { SalutationViewModel } from "../../settings/salutation.models";
export interface MemberViewModel {
id: number;
id: string;
salutation: SalutationViewModel;
firstname: string;
lastname: string;
@ -18,7 +18,7 @@ export interface MemberViewModel {
}
export interface MemberStatisticsViewModel {
id: number;
id: string;
salutation: string;
firstname: string;
lastname: string;
@ -39,7 +39,7 @@ export interface CreateMemberViewModel {
}
export interface UpdateMemberViewModel {
id: number;
id: string;
salutationId: number;
firstname: string;
lastname: string;

View file

@ -2,10 +2,10 @@ import type { MemberViewModel } from "../member/member.models";
export interface NewsletterRecipientsViewModel {
newsletterId: number;
memberId: number;
memberId: string;
member: MemberViewModel;
}
export interface SyncNewsletterRecipientsViewModel {
memberId: number;
memberId: string;
}

View file

@ -1,10 +1,10 @@
export interface ProtocolPresenceViewModel {
memberId: number;
memberId: string;
absent: boolean;
excused: boolean;
protocolId: number;
}
export interface SyncProtocolPresenceViewModel {
memberIds: Array<number>;
memberIds: Array<string>;
}

View file

@ -2,7 +2,7 @@ import type { PermissionObject } from "@/types/permissionTypes";
import type { RoleViewModel } from "./role.models";
export interface UserViewModel {
id: number;
id: string;
username: string;
mail: string;
firstname: string;
@ -21,7 +21,7 @@ export interface CreateUserViewModel {
}
export interface UpdateUserViewModel {
id: number;
id: string;
username: string;
mail: string;
firstname: string;

View file

@ -154,7 +154,7 @@ export default defineComponent({
...mapActions(useNewsletterRecipientsStore, ["fetchNewsletterRecipients"]),
...mapActions(useQueryStoreStore, ["fetchQueries"]),
...mapActions(useQueryBuilderStore, ["sendQuery"]),
removeSelected(id: number) {
removeSelected(id: string) {
let index = this.recipients.findIndex((s) => s == id);
if (index != -1) {
this.recipients.splice(index, 1);

View file

@ -10,7 +10,7 @@
:model-value="presence.map((p) => p.memberId)"
:disabled="!can('create', 'club', 'protocol')"
@add:difference="
(id: number) =>
(id: string) =>
presence.push({ memberId: id, absent: false, excused: true, protocolId: parseInt(protocolId ?? '') })
"
@add:member="(s) => members.push(s)"
@ -78,7 +78,7 @@ export default defineComponent({
...mapWritableState(useProtocolPresenceStore, ["presence", "loading"]),
...mapState(useAbilityStore, ["can"]),
getMember() {
return (memberId: number) => {
return (memberId: string) => {
return this.members.find((m) => memberId == m.id);
};
},
@ -86,7 +86,7 @@ export default defineComponent({
mounted() {},
methods: {
...mapActions(useProtocolPresenceStore, ["fetchProtocolPresence"]),
removeSelected(id: number) {
removeSelected(id: string) {
let index = this.presence.findIndex((s) => s.memberId == id);
if (index != -1) {
this.presence.splice(index, 1);

View file

@ -95,7 +95,7 @@ export default defineComponent({
this.user = cloneDeep(this.origin);
},
fetchItem() {
this.fetchUserById(parseInt(this.id ?? ""))
this.fetchUserById(this.id ?? "")
.then((result) => {
this.user = result.data;
this.origin = cloneDeep(result.data);

View file

@ -57,7 +57,7 @@ export default defineComponent({
methods: {
...mapActions(useUserStore, ["fetchUserById", "updateActiveUserPermissions"]),
fetchItem() {
this.fetchUserById(parseInt(this.id ?? ""))
this.fetchUserById(this.id ?? "")
.then((result) => {
this.user = result.data;
this.loading = "fetched";

View file

@ -111,7 +111,7 @@ export default defineComponent({
this.assigned = this.origin?.roles.map((r) => r.id) ?? [];
},
fetchItem() {
this.fetchUserById(parseInt(this.id ?? ""))
this.fetchUserById(this.id ?? "")
.then((result) => {
this.origin = cloneDeep(result.data);
this.assigned = this.origin?.roles.map((r) => r.id) ?? [];

View file

@ -17,47 +17,47 @@
</template>
<script setup lang="ts">
import { defineAsyncComponent, defineComponent, markRaw} from "vue";
import { defineAsyncComponent, defineComponent, markRaw } from "vue";
import MainTemplate from "@/templates/Main.vue";
import 'highlight.js/styles/atom-one-dark.css';
import "highlight.js/styles/atom-one-dark.css";
</script>
<script lang="ts">
export default defineComponent({
props: {
page: String
page: String,
},
watch:{
watch: {
page() {
this.loadPage()
}
this.loadPage();
},
},
data() {
return {
markdownComponent: null,
markdownComponent: null as any,
};
},
async mounted() {
this.loadPage()
this.loadPage();
},
methods:{
loadPage(){
this.markdownComponent = null
methods: {
loadPage() {
this.markdownComponent = null;
this.markdownComponent = markRaw(defineAsyncComponent(() => import(`$/${this.page?.toLowerCase()}.md`)));
}
}
},
},
});
</script>
<style>
.markdown-container {
font-family: 'Open Sans', sans-serif;
font-family: "Open Sans", sans-serif;
color: #555;
background-color: #f8f8f8;
border: 2px solid gray;
padding: 20px;
border-radius: 5px;
height: 100%
height: 100%;
}
.markdown-container h1 {