Phuong
WWasp
•Created by Phuong on 1/16/2025 in #🙋questions
console database
@kapa.ai const messages = await getListMessages();
I want get userMassage in getListMessages() base on conversationId
66 replies
WWasp
•Created by Phuong on 1/16/2025 in #🙋questions
console database
@kapa.ai find Unique
66 replies
WWasp
•Created by Phuong on 1/16/2025 in #🙋questions
console database
@kapa.ai all types of orderBy
66 replies
WWasp
•Created by Phuong on 1/16/2025 in #🙋questions
console database
all type of orderBy
66 replies
WWasp
•Created by Phuong on 1/16/2025 in #🙋questions
console database
@kapa.ai this is my current code:
export const getListMessages = async (args: { conversationId: string }, context: any) => {
// if (!context.user) {
// throw new HttpError(401);
// }
const messages = await context.entities.Message.findUnique({
where: {
id: args.conversationId,
},
orderBy: {
createdAt: 'desc'
},
select:{
userMessage: true,
}
});
return messages;
};
another file:
const createCover = async () => {
try {
const conversations = await getListConversation(); setConversationId(conversations[0].id); const matchedConversation = conversations.find( (conversation) => conversation.userId === user.id );
// Set the conversationId to the matched conversation's id if (matchedConversation) { setConversationId(matchedConversation.id); console.log("success", matchedConversation.id); const messages = await getListMessages(matchedConversation); // setMessages(messages) console.log("asdasd", messages);
} else { console.warn("No matching conversation found for user."); } } catch (error) { console.error("🚀 ~ createCover ~ error:", error); } }; fix it
const conversations = await getListConversation(); setConversationId(conversations[0].id); const matchedConversation = conversations.find( (conversation) => conversation.userId === user.id );
// Set the conversationId to the matched conversation's id if (matchedConversation) { setConversationId(matchedConversation.id); console.log("success", matchedConversation.id); const messages = await getListMessages(matchedConversation); // setMessages(messages) console.log("asdasd", messages);
} else { console.warn("No matching conversation found for user."); } } catch (error) { console.error("🚀 ~ createCover ~ error:", error); } }; fix it
66 replies
WWasp
•Created by Phuong on 1/16/2025 in #🙋questions
console database
@kapa.ai I findUnique which is userMessage
66 replies
WWasp
•Created by Phuong on 1/16/2025 in #🙋questions
console database
@kapa.ai const messages = await getListMessages(matchedConversation);
66 replies
WWasp
•Created by Phuong on 1/16/2025 in #🙋questions
console database
const messages = await getListMessages(matchedConversation);
Do I put parameter right?
66 replies
WWasp
•Created by Phuong on 1/16/2025 in #🙋questions
console database
@kapa.ai I want get 1 variables of conversations like userId
66 replies
WWasp
•Created by Phuong on 1/16/2025 in #🙋questions
console database
@kapa.ai I want get 1 variables of conversations like userId
66 replies
WWasp
•Created by Phuong on 1/16/2025 in #🙋questions
console database
@kapa.ai I want where:{ conversation:{ id:}} is this right?
66 replies
WWasp
•Created by Phuong on 1/16/2025 in #🙋questions
console database
@kapa.ai assume that I have a parameter togetLastestConversation, what code look like?
66 replies
WWasp
•Created by Phuong on 1/16/2025 in #🙋questions
console database
@kapa.ai your code is useful, but I want to get latest conversation
66 replies
WWasp
•Created by Phuong on 1/16/2025 in #🙋questions
console database
@kapa.ai
export const createConversation = async (args: any, context: any) => {
// if (!context.user) {
// throw new HttpError(401);
// }
const conversation = context.entities.Conversation.create({
data: {
user: { connect: { id: context.user.id } },
}
})
return conversation;
};
base on this code create getListConversation
66 replies
WWasp
•Created by Phuong on 1/16/2025 in #🙋questions
console database
@kapa.ai how about Conversation?
66 replies
WWasp
•Created by Phuong on 12/20/2024 in #🙋questions
I am trying to use helpers keycloak
@Filip
13 replies
WWasp
•Created by Phuong on 12/20/2024 in #🙋questions
I am trying to use helpers keycloak
but it show above page
13 replies
WWasp
•Created by Phuong on 12/20/2024 in #🙋questions
I am trying to use helpers keycloak
I fixed
13 replies
WWasp
•Created by Phuong on 12/20/2024 in #🙋questions
I am trying to use helpers keycloak
13 replies
WWasp
•Created by Phuong on 12/11/2024 in #🙋questions
apply SSOS
I have another question, can Wasp-lang support SSO?
12 replies