kripod / kripod/knex-orm

Saving related properties of Models

Open
#3 0 comments 0 reactions 0 assignees View on GitHub
feature
Dominant language
JavaScript
Stars
61
Forks
6
PR merge metrics
No merged PRs in 30d

Description

The easiest way to describe this feature is by providing a syntactical example:

``` js
const company = new Company({
email: 'famous@company.com',
employees: [
new Employee({ name: 'John Doe' }), // New Employee
new Employee({ id: 6 }, false), // Existing Employee
],
});

await company.save();
```

The code above should insert a new Company to the database, but before that, the new Employee (first in the array) shall be stored. Related object trees should be stored recursively, in an order defined by the relations of the referenced objects.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the provided Company/Employee example and trace the existing model persistence entry point used by company.save(). Done means recursively storing new related objects before their parent, preserving existing related records, and respecting relation order; verify these cases with focused tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.