Proper way to define data that comes back as a query


#1

Sorry for an unclear title. I have a model called File. A File has a series of attributes that are then used to construct a query and get corresponding data (a graph). At the moment, a file has the bare minimum it pulls from the backend. After this, a controller on a route injects a service that is used to construct and execute this query. I’m looking to refactor this such that the query is tightly coupled with the model. That is, I’ll end up injecting this service to the model. I found some discussion that suggests against this here: About Injecting a service in model .

What should I do with data that comes as the result of a query and doesn’t have an ID? It feels like a model to me, but its very dependent on the File model. That is, if an attribute changes in the file, the corresponding query needs to change.

I hope I explained this well. I’ll follow up if anyone has questions. Thanks!