refactor: gather
This commit is contained in:
parent
c4329743da
commit
7d7f27fc71
|
@ -22,6 +22,7 @@
|
|||
"test.js.map"
|
||||
],
|
||||
"dependencies": {
|
||||
"@latus/core": "^2.0.0",
|
||||
"debug": "4.3.1",
|
||||
"glob": "^7.1.6",
|
||||
"natsort": "^2.0.2",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export default (User) => class ProjectUser extends User {
|
||||
export default (latus, User) => class ProjectUser extends User {
|
||||
|
||||
async projectsStructure() {
|
||||
return (await this.getProjects())
|
|
@ -6,7 +6,7 @@ import glob from 'glob';
|
|||
|
||||
import {pathsToTree} from '../tree-utils';
|
||||
|
||||
class Project extends Model {
|
||||
export default () => class Project extends Model {
|
||||
|
||||
static get attributes() {
|
||||
return {
|
||||
|
@ -31,6 +31,4 @@ class Project extends Model {
|
|||
return pathsToTree(paths);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default Project;
|
||||
};
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
import Project from '../models/project';
|
||||
import ProjectUser from '../models/project-user';
|
||||
import {decorateWithLatus, gatherWithLatus} from '@latus/core';
|
||||
|
||||
export default {
|
||||
hooks: {
|
||||
'@latus/db/server/models': () => ({
|
||||
Project,
|
||||
}),
|
||||
'@latus/db/server/models.decorate': (Models) => ({
|
||||
...Models,
|
||||
User: ProjectUser(Models.User),
|
||||
}),
|
||||
'@latus/db/server/models': gatherWithLatus(
|
||||
require.context('../models', false, /\.js$/),
|
||||
),
|
||||
'@latus/db/server/models.decorate': decorateWithLatus(
|
||||
require.context('../models/decorators', false, /\.js$/),
|
||||
),
|
||||
},
|
||||
};
|
||||
|
|
|
@ -901,7 +901,7 @@
|
|||
object-assign "^4.1.1"
|
||||
scheduler "^0.20.1"
|
||||
|
||||
"@latus/core@2.0.0":
|
||||
"@latus/core@2.0.0", "@latus/core@^2.0.0":
|
||||
version "2.0.0"
|
||||
resolved "http://npm.cha0sdev/@latus%2fcore/-/core-2.0.0.tgz#2ca04903351edc14f29fcec2ad6ab5e19c72e072"
|
||||
integrity sha512-Sq4nPpQzRektLgsXRFQqhZWpUWY1bFTrVbm5X0vGTyTTlfQPmMbHyddmtdVTB8NbANvleuw4PvfuNVqKU4le6w==
|
||||
|
|
Loading…
Reference in New Issue
Block a user