Open slightlytyler opened 8 years ago
Implemented as Conversations and Messages
type Conversation implements Node {
id:ID!
createdAt: Date!
updatedAt: Date!
subject: String
refPost: Post @relationship(path:"<-REFERENCED-")
users: User @relationship(path: "<=CHATTED=")
messages: Message @relationship(path:"=HELD=>")
}
type Message implements Node {
id:ID!
createdAt: Date!
body: String!
author: User! @relationship(path:"<-AUTHORED-")
chat: Conversation! @relationship(path:"<-HELD-")
}
conversations are nodes, so for bullet 4
query{
node(id:[id]){
... as Conversation{
id
subject
users
etc
}
}
}
for all conversations:
query{
session{
currentUser{
conversations{
$conversationFragment
}
}
}
}
@jacobhausler we'll need to track if messages have been viewed or not and the be able to query for the number that haven't been
Notification
might be it's own type actually
Need to figure out the logic of (post and message notifications separately):
going to create 1 sendMessage mutation that takes an optional postId to satisfy 1 and 2
are these email style conversations (many conversations between 2 users) or facebook (1 convo between 2 users); many would be easier
email style conversations will use these two forms of the sendMessage mutation; i don't think we need you to be able to access Conversations directly if the following are true:
##This one takes in optional params to create a new conversation; no chatID = new Conv.
mutation{
sendMessage(input:{
clientMutationId:"sendMessage to new conversation"
toUserId:"ID of receiver"
refPost: "ID of referenced post"
subject:"test subject"
body: "test message body"
}){
changedConversation{
id
subject
users{
id
fullName
}
messages{
id
author{
id
fullName
}
body
}
}
}
}
##This one takes in less params for an existing conversation
mutation{
sendMessage(input:{
clientMutationId:"sendMessage to existing conversation"
body: "test message body"
}){
changedConversation{
id
subject
users{
id
fullName
}
messages{
id
author{
id
fullName
}
body
}
}
}
}