joist-orm / joist-orm/joist-orm

Change factory opt order

Open
#1,174 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
385
Forks
26
Avg merge
8h 55m
Merged PRs (30d)
42

Description

Seems like factories should apply things like:

* Sort the fields using setDefault hints (done)
* Change `newTestInstance` to `em.create` without any fields/opts set yet
* We want to incrementally set the fields, one-by-one, so we can control when the default lambdas are invoked
* Loop over the in-setDefault-order fields
* If it's a opt, set it.
* If there's a sync (a hintless-sync lambda or a hint+sync lambda), invoke it
* If there's an obvious default, set it.
* If it's required, create it

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.