Query external API and store in database

Hi all,
I would like to store into the database of my app some information that I periodically pull from an external API.

The plan is:
- create an plain Next.js API endpoint
- store the data that I care into my database
- ping the endpoint with a cron (Upstash)

The thing that's not clear to me is that I have created the model when I try to use createMany I get the error in the image.

I am pretty sure I am missing something here. I thought I could not use tRPC for this kind of call so I haven't created the route for the token model but as soon as I try to use a method on the token table I get the error, even though TS suggest me the table.

What is the best way to do this? I have to follow the tRPC route, create a caller and call it from my external API?

Thanks in advance to anyone will help me.
CleanShot_2023-05-16_at_20.43.51.jpg
CleanShot_2023-05-16_at_20.45.22.jpg
Was this page helpful?