Brief one-line explanation of why this Prisma field is being selected.
Keep it concise and clear. Focus on which DTO property(ies) need this data.
For Write Phase (planning field selection):
For Correct Phase (documenting current state and fixes):
Even if a selection is correct, you MUST include it in the mapping and explain why. This ensures complete coverage and alignment with transform().
This is NOT code - just a simple description of the selection purpose.
The kind of Prisma schema member being selected.
Explicitly identifies whether this member is a scalar field or a relation, and if it's a relation, what type of relation it is. This classification forces the AI to think through the nature of each member before planning what to select, preventing common mistakes in the select() function.
Possible values:
"scalar": Regular database column (id, email, created_at, unit_price,
etc.)"belongsTo": Foreign key relation pointing to parent entity (customer,
article, category, etc.)"hasOne": One-to-one relation where this side owns the relationship"hasMany": One-to-many or many-to-many relation (comments, tags, reviews,
etc.)Why this matters for select():
trueExamples by kind:
// Scalar fields - simple selection
{ member: "id", kind: "scalar", nullable: false, how: "For DTO.id" }
{ member: "email", kind: "scalar", nullable: false, how: "For DTO.email" }
{ member: "created_at", kind: "scalar", nullable: false, how: "For DTO.createdAt" }
{ member: "deleted_at", kind: "scalar", nullable: true, how: "For DTO.deletedAt" }
// BelongsTo relations - nested selection with transformer
{ member: "customer", kind: "belongsTo", nullable: false, how: "For DTO.customer (nested)" }
{ member: "article", kind: "belongsTo", nullable: false, how: "For DTO.article (nested)" }
{ member: "parent", kind: "belongsTo", nullable: true, how: "For DTO.parent (optional)" }
// HasMany relations - nested selection with array transformer
{ member: "tags", kind: "hasMany", nullable: null, how: "For DTO.tags (array)" }
{ member: "comments", kind: "hasMany", nullable: null, how: "For DTO.comments (array)" }
The kind field works together with nullable and how: kind identifies
WHAT it is, nullable identifies IF it's optional, how explains WHY we're
selecting it.
Exact Prisma field or relation name from the Prisma schema.
MUST match the Prisma schema exactly (case-sensitive). Use snake_case as Prisma follows database conventions.
Field Types:
Examples:
// Scalar fields for direct mapping or conversion
{ member: "id", kind: "scalar", nullable: false, how: "For DTO.id" }
{ member: "email", kind: "scalar", nullable: false, how: "For DTO.email" }
{ member: "created_at", kind: "scalar", nullable: false, how: "For DTO.createdAt (needs .toISOString())" }
{ member: "unit_price", kind: "scalar", nullable: false, how: "For DTO.price (Decimal → Number)" }
{ member: "deleted_at", kind: "scalar", nullable: true, how: "For DTO.deletedAt (nullable DateTime)" }
// Scalar fields for computation
{ member: "quantity", kind: "scalar", nullable: false, how: "For DTO.totalPrice computation" }
{ member: "expiry_date", kind: "scalar", nullable: false, how: "For DTO.isExpired computation" }
// Aggregations (special scalar type)
{ member: "_count", kind: "scalar", nullable: false, how: "For DTO.reviewCount" }
// BelongsTo relations (nested objects)
{ member: "customer", kind: "belongsTo", nullable: false, how: "For DTO.customer (nested transformer)" }
{ member: "article", kind: "belongsTo", nullable: false, how: "For DTO.article (nested transformer)" }
{ member: "parent", kind: "belongsTo", nullable: true, how: "For DTO.parent (optional nested)" }
// HasMany relations (arrays)
{ member: "tags", kind: "hasMany", nullable: null, how: "For DTO.tags (array transformer)" }
{ member: "comments", kind: "hasMany", nullable: null, how: "For DTO.comments (array transformer)" }
DO NOT use DTO property names here - this is about Prisma schema members, not DTO properties.
Whether this Prisma member is nullable in the schema.
This property explicitly documents whether a field/relation can be null, forcing the AI to understand nullability constraints before deciding selection strategy. This affects how the transform() function will handle the data.
Value semantics by kind:
For scalar fields (kind: "scalar"):
false: Non-nullable column (e.g., email String, id String)
created_at DateTime → nullable: falsetrue: Nullable column (e.g., deleted_at DateTime?)
?? null)deleted_at DateTime? → nullable: trueFor belongsTo relations (kind: "belongsTo"):
false: Required foreign key (e.g., customer_id String)
customer relation → nullable: falsetrue: Optional foreign key (e.g., parent_id String?)
parent relation → nullable: trueFor hasMany/hasOne relations (kind: "hasMany" or kind: "hasOne"):
Always null: Nullability concept doesn't apply to these relations
nullable property has no semantic meaningWhy this matters for select():
Examples:
// Non-nullable scalar (nullable: false)
{ member: "id", kind: "scalar", nullable: false, how: "For DTO.id" }
{ member: "email", kind: "scalar", nullable: false, how: "For DTO.email" }
{ member: "created_at", kind: "scalar", nullable: false, how: "For DTO.createdAt" }
// Nullable scalar (nullable: true)
{ member: "deleted_at", kind: "scalar", nullable: true, how: "For DTO.deletedAt (nullable)" }
{ member: "description", kind: "scalar", nullable: true, how: "For DTO.description (optional)" }
// Required belongsTo (nullable: false)
{ member: "customer", kind: "belongsTo", nullable: false, how: "For DTO.customer (nested)" }
{ member: "article", kind: "belongsTo", nullable: false, how: "For DTO.article (nested)" }
// Optional belongsTo (nullable: true)
{ member: "parent", kind: "belongsTo", nullable: true, how: "For DTO.parent (optional)" }
{ member: "category", kind: "belongsTo", nullable: true, how: "For DTO.category (optional)" }
// HasMany relations (nullable: null - not applicable)
{ member: "comments", kind: "hasMany", nullable: null, how: "For DTO.comments (array)" }
{ member: "tags", kind: "hasMany", nullable: null, how: "For DTO.tags (array)" }
The nullable property works with kind and how: kind identifies WHAT
it is, nullable identifies IF it's optional, how explains WHY we're
selecting it.
Single Prisma field selection mapping for the select() function.
Documents which Prisma fields/relations must be selected from the database to enable the transform() function to build the DTO. This structured approach ensures no required data is missing from the query, preventing runtime errors.
Purpose:
Usage Contexts:
The validator cross-checks mappings against the Prisma schema and DTO requirements to ensure nothing is overlooked, rejecting incomplete selections.
Critical Principle:
Every DTO property in the transform() function requires corresponding Prisma data. This mapping documents what must be selected to satisfy those requirements. If transform() needs
prisma.created_at, select() MUST includecreated_at: true.Author
Samchon