HelloCurrently, I am using objectionjs with nestjs. ObjectionJs model is injected in services and I am doing database querying stuff from my there.The project itself is very simple now, so this approach works well for me, but I don't know If I will have issues after more functionality. This is my first project on the backend side, so I am trying to learn doing things the right way.Is there better way, to move information related logic into another layer? Like Repository or model itself?I can declare static & instance methods in Objectionjs model and move information getting logic there. (Like finding item by email, find related items from another tables, etc...)I can create an injectable repository (an idea borrowed from Typeform), which will extend the model and add querying stuff there.
Submitted July 27, 2020 at 03:45PM by Lasha9
No comments:
Post a Comment