Thread route
In this section, we will update our Thread
component, which provides our thread route. We're going to be touching on a lot of files as we go through this. Follow these steps:
- Open
typeDefs
and edit theThread
andThreadItem
types. Then, add this field just belowviews
:points: Int!
- Now, open the
ThreadRepo
file and update thegetThreadById
function, like this:export const getThreadById = async ( id: string ): Promise<QueryOneResult<Thread>> => { const thread = await Thread.findOne({ where: { id, }, relations: ["user", "threadItems", "threadItems. user", "category"], });
All we did here was add the following
relations
to ourfindOne
query:if (!thread) { return { ...