I created a user model ```type User { id: ID! ...
# orm-help
o
I created a user model
Copy code
type User {
  id: ID!
  first_name: String!
  last_name: String!
  email_address: String!
}
and would like to group
first_name
and
last_name
into a
name
object that, when the user is queried, nests the two names like
name: { first, last }
so I can do a
name.first
etc. Can this be done without creating a 'name' table in the database? I.e. Simply at the Prisma interpretation level, not database. Thanks for any advice for converting my current (flat) structure.
n
You can do that in your GraphQL server
o
Thanks. I actually already looked that guide but its not quite what I'm after. I don't want to add an auto-calculated field like
fullname
, but rather nest the name details or (another example) email information, say if I store
email_address
and
email_verified
, I would like to know if I can make an
email
type (just without creating another table for this type) that nests the two fields (e.g.
email: { address, verified }
) instead of a flat structure.
n
You can do that. In your GraphQL API, define the
email
type and the resolvers for it's fields