medz / prisma-dart

Prisma Client Dart is an auto-generated type-safe ORM. It uses Prisma Engine as the data access layer and is as consistent as possible with the Prisma Client JS/TS APIs.
https://prisma.pub
BSD 3-Clause "New" or "Revised" License
436 stars 29 forks source link

fixes: #365; #366

Closed atharvapalaskar closed 1 month ago

atharvapalaskar commented 1 month ago

fix: Correct encoding of DateTime and Enum fields in toJson(), ensuring proper JSON response generation Resolves #365

Example

Old Output of Generated Model Class The old output of the generated toJson() method was as follows:

Map<String, dynamic> toJson() => { 
        'role': role,  
        'created_at': createdAt,
        'updated_at': updatedAt, 
      };

New Output of Generated Model Class

The toJson() method correctly encodes DateTime fields using toIso8601String() and Enum fields using their string representations.

The expected output of the generated toJson() method is:

  Map<String, dynamic> toJson() => { 
        'role': role?.name,  
        'created_at': createdAt?.toIso8601String(),
        'updated_at': updatedAt?.toIso8601String(),        
      };

For more info check issue #365

netlify[bot] commented 1 month ago

Deploy Preview for prisma-dart ready!

Name Link
Latest commit d7cde03be9af0de4af2eee7bc23836aeac3415c5
Latest deploy log https://app.netlify.com/sites/prisma-dart/deploys/6655b0c6c5f3bd0008d939fd
Deploy Preview https://deploy-preview-366--prisma-dart.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

medz commented 1 month ago

Thx