I'm currently working on implementing a counting function that can be utilized in all of my objects. In my 'core' file, Prisma is involved in this process. This allows me to execute commands like this.user.count()
or this.company.count()
I have attempted to create a function called count in the following manner
count(dataType) {
return this['dataType'].count()
}
This way, I could simply call count('dataType') from any other part of the application.
Although my actual function is more complex, the basic concept remains the same - the effort put into this one-to-one replacement seems unjustifiable. None of my attempts have been successful - is it even achievable?