core icon indicating copy to clipboard operation
core copied to clipboard

ModelId - Manipulate data without loading

Open stombre opened this issue 5 years ago • 0 comments

Model.id allow user to create a reference with a model instance, without loading it.

We could introduce method to manipulate this reference;

const MY_REF = Model.id(ID)

await MY_REF.delete();

// Similar as;
const instance = await Model.query()
  .id.is(ID)
  .findOne();

await instance.delete();

Add;

  • [ ] ModelId.query(): Create a query targeting directly the associate instance
  • [ ] ModelId.delete(): Auto delete associate instance (shortcut for ModelId.query().deleteOne())

stombre avatar Sep 26 '20 16:09 stombre