Is it possible to add field to a type of a custom ...
# prisma-whats-new
i
Is it possible to add field to a type of a custom resolver? or only to add top level query?
m
You could probably just create a new type and assign it this field? You can then use this type inside a resolver definition. Is that what you had in mind? πŸ™‚
i
Not sure I get it… πŸ™‚ I wanted query for field that is a custom resolver
Copy code
type Ticket {
  name
  canPurchase
}
and the canPurchase is a custom function aggregating some logic: e.g is the movie started is there still available tickets for the movie and some other staff
m
Hmm, I hope I get it πŸ˜„
Copy code
type LoggedInUserPayload {
  id: ID
}

extend type Query {
  loggedInUser: LoggedInUserPayload!
}
Is that what you were looking for?
hmm aaa, now I get it, I guess you can just implement additional type (also named Ticket, but probably best to name it somehow different) and then use your existing Ticket type query in resolver to get all the fields which already exist and combine them with new one in the response
i
thanks, I will try it