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

@ -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}`, {
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`, {
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`, {
roleIds: roles,
})
.then((result) => {
this.fetchUsers();
return result;
});
},
deleteUser(user: number): Promise<AxiosResponse<any, any>> {
return http.delete(`/admin/user/${user}`).then((result) => {
this.fetchUsers();
return result;
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,
});
this.fetchUsers();
return result;
},
async updateActiveUserPermissions(userId: string, permission: PermissionObject): Promise<AxiosResponse<any, any>> {
const result = await http.patch(`/admin/user/${userId}/permissions`, {
permissions: permission,
});
this.fetchUsers();
return result;
},
async updateActiveUserRoles(userId: string, roles: Array<number>): Promise<AxiosResponse<any, any>> {
const result = await http.patch(`/admin/user/${userId}/roles`, {
roleIds: roles,
});
this.fetchUsers();
return result;
},
async deleteUser(userId: string): Promise<AxiosResponse<any, any>> {
const result = await http.delete(`/admin/user/${userId}`);
this.fetchUsers();
return result;
},
},
});