Skip to content

Update adding-fields.md #480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ibrahim-embaby
Copy link

  1. Clarified the Purpose of Field Resolvers

    • Updated the introduction to explicitly state that typegraphql-prisma generates GraphQL types from the Prisma schema by default.
    • Emphasized that additional fields added via @FieldResolver are not stored in the database and are computed dynamically.
    • Highlighted a key limitation: these fields cannot be used in Prisma queries for filtering or sorting.
  2. Fixed Incorrect Prisma Query Syntax

    • Replaced first: 1 with take: 1 in the Prisma query.
    • Reason: Prisma does not support first, and take is the correct way to limit results when fetching related records.
  3. Improved Code Readability and Structure

    • Ensured the example clearly follows best practices.
    • Kept variable names meaningful for better understanding.
  4. Provided Additional Explanation

    • Added a breakdown of why @FieldResolver is necessary.
    • Explained the difference between Prisma fields and computed fields in the GraphQL schema.

These improvements make the documentation clearer, ensuring that developers understand why and how to use @FieldResolver effectively in a typegraphql-prisma project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant