fix: attributes after compose
This commit is contained in:
parent
7434d1bc5d
commit
44cd1c26e2
|
@ -39,8 +39,9 @@ export async function createDatabaseConnection(latus) {
|
|||
// eslint-disable-next-line no-console
|
||||
const Models = latus.invokeReduce('@latus/db/models');
|
||||
debug('models: %O', Object.keys(Models));
|
||||
/* eslint-disable no-param-reassign */
|
||||
Object.entries(Models)
|
||||
const map = latus.invokeComposed('@latus/db/models.decorate', Models);
|
||||
debug('composed: %O', Object.keys(map));
|
||||
Object.entries(map)
|
||||
.filter(([, Model]) => Model.attributes)
|
||||
.forEach(([, Model]) => {
|
||||
Model.init(Model.attributes, {
|
||||
|
@ -48,10 +49,9 @@ export async function createDatabaseConnection(latus) {
|
|||
underscored: true,
|
||||
});
|
||||
});
|
||||
const map = latus.invokeComposed('@latus/db/models.decorate', Models);
|
||||
debug('composed: %O', Object.keys(map));
|
||||
Object.entries(map).forEach(([, Model]) => Model.associate(map));
|
||||
Object.entries(map).forEach(([, Model]) => Model.sync());
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
latus.config['%models'] = map;
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user