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