-
-
Save bartosz-maciaszek/ef24af28692ccb8ec07da5cd87849641 to your computer and use it in GitHub Desktop.
client level
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type User { | |
id: ID! | |
... | |
displayName: String! | |
... | |
friends: [User!] | |
friendshipRequestsSent: [FriendshipRequestSent!]! | |
friendshipRequestsReceived: [FriendshipRequestReceived!]! | |
} | |
type FriendshipRequestSent { | |
id: ID! | |
to: User! | |
status: FriendshipRequestStatus! | |
... | |
} | |
type FriendshipRequestReceived { | |
id: ID! | |
from: User! | |
status: FriendshipRequestStatus! | |
... | |
} | |
enum FriendshipRequestStatus { | |
PENDING | |
ACCEPTED | |
REJECTED | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default { | |
Query: { | |
async me(root, args, context) { | |
return await context.prisma.user({id: context.request.user.id}); | |
} | |
}, | |
User: { | |
async friendshipRequestsSent(root, args, context) { | |
return await context.prisma.user({ | |
id: root.id | |
}).friendshipRequestsSent({ | |
where: { | |
status: "PENDING" | |
} | |
}); | |
}, | |
async friendshipRequestsReceived(root, args, context) { | |
return await context.prisma.user({ | |
id: root.id | |
}).friendshipRequestsReceived({ | |
where: { | |
status: "PENDING" | |
} | |
}); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment