In my mongo collection, there is a field named amount. My requirement is to have the amount automatically divided by 100 whenever it is requested. In Django, this can be achieved with a custom function within the model. Here's how I implemented it:
class Book(models.Model):
title = models.CharField(...)
price = models.IntegerField()
def get_price(self):
return self.price // 100
I'm curious about the Prisma equivalent of this in TypeScript.
I tested out the Django implementation and it worked well. Now, I am looking for guidance on how to implement the same logic in a Prisma setup within NestJS.
class Book(models.Model):
title = models.CharField(...)
price = models.IntegerField()
def get_price(self):
return self.price // 100