Monday 18 June 2018

Help with a service that works with 2 databases in Node.js, using Sequelize/Postgres and MongoDB

I've been currently tasked with creating an invoice service, it needs to process/create the invoices in 1 service and process the charges with stripe in another service. I have to count and pair sms with a specific id, total count and then use the ID on those to know who to charge and look for my specific user for the stripe charge.I started my first dev job as a Jr Node Dev, currently on my second month. I'm struggling with some things about this.1.- We have 2 different databases that are going to "interact" for this so I kinda need a way to store the ID of the sms and use them to create the invoice for the specific user and later charge them.2.- In the case of the MongoDB one there's a collection for every new day, so I haven't found a way of specifying the name of the collection when making queries, or multiple ones since I need to create an invoice for the last 15 days.This is the mongo model for the smsMy sequelize model for the invoicesThe file with the status detailsI already have a service for the sms sending part and I think this service could work as a blueprint for the invoice service, obviously changing a few stuff but I'm pretty much lost on how to interact with those 2 databases in an easy way.Any help would be appreciated!

Submitted June 18, 2018 at 03:42PM by SeraphineX93

No comments:

Post a Comment