updated db structure
This commit is contained in:
@@ -17,19 +17,17 @@ export const useChatStore = defineStore('chatStore',{
|
||||
return this.chats;
|
||||
},
|
||||
async loadChatsByUser() : Promise<chat[]>{
|
||||
this.chats = (await api.get("/users/chat/" + userStore.keycloakId)).data.response;
|
||||
this.chats = (await api.get("/users/chat/" + userStore.id)).data.response;
|
||||
return this.chats;
|
||||
},
|
||||
async createChat(chatName: string, members: string[]){
|
||||
if(userStore.keycloakId) {
|
||||
console.log("keycloakId is defined");
|
||||
if (!members.includes(userStore.keycloakId)) {
|
||||
members.push(userStore.keycloakId);
|
||||
if(userStore.id) {
|
||||
if (!members.includes(userStore.id)) {
|
||||
members.push(userStore.id);
|
||||
}
|
||||
}else if(userStore.user?.keycloakID){
|
||||
console.log("user is defined");
|
||||
if (! members.includes(userStore.user.keycloakID)) {
|
||||
members.push(userStore.user.keycloakID);
|
||||
}else if(userStore.user?.id){
|
||||
if (! members.includes(userStore.user.id)) {
|
||||
members.push(userStore.user.id);
|
||||
}
|
||||
}
|
||||
console.log(members);
|
||||
|
||||
@@ -31,18 +31,18 @@ export const useUserStore = defineStore('userStore', {
|
||||
user: null as ptpUser | null,
|
||||
userLoaded: false,
|
||||
keycloak: null as Keycloak | null,
|
||||
keycloakId: "",
|
||||
id: "",
|
||||
users: [] as ptpUser[],
|
||||
}),
|
||||
actions: {
|
||||
async getPtpUserByKeycloakID(keycloakID : string) {
|
||||
await this.loadPtpUsersByKeycloakID(keycloakID).then((response : responseModel) => {
|
||||
async getPtpUserById(id : string) {
|
||||
await this.loadPtpUsersById(id).then((response : responseModel) => {
|
||||
this.user = response.response;
|
||||
this.userLoaded = true;
|
||||
});
|
||||
},
|
||||
async loadPtpUsersByKeycloakID(keycloakID : string) : Promise<responseModel> {
|
||||
return (await api.get("/users/login/"+keycloakID)).data;
|
||||
async loadPtpUsersById(id : string) : Promise<responseModel> {
|
||||
return (await api.get("/users/login/"+id)).data;
|
||||
},
|
||||
async loadAllUsers(): Promise<ptpUser[]> {
|
||||
this.users = (await api.get("/users/user")).data;
|
||||
|
||||
Reference in New Issue
Block a user