Form usage

Models

const Form_Parent = Fractale.create("Form_Parent", {
    value: String
});

const Form_Child = Fractale.create("Form_Child", {
    parent: Form_Parent,
    value: String
});

Run

const { Form_Parent, Form_Child } = module.exports.get();
const parent = new Form_Parent({ value: 'foo' });
const child = new Form_Child({ parent: parent.uuid, value: 'bar' });

_.test(child.value, 'bar', 'Error on form setter');
_.test(child.parent.value, 'foo', 'Error on form setter');

resolve(child);

Results

{
    "uuid": "250940e8-d1a4-4476-89e9-fcc882f55c64",
    "parent": {
        "uuid": "ab7cde95-30ed-4bdf-8872-0b03a537e3a2",
        "value": "foo"
    },
    "value": "bar"
}

Last updated