Files
talk/graph/resolvers/root_query.js
T
2017-01-19 18:26:33 -07:00

26 lines
675 B
JavaScript

const RootQuery = {
assets(_, args, {loaders}) {
return loaders.Assets.getAll.load();
},
asset(_, {id = null, url}, {loaders}) {
if (id) {
// TODO: we may not always have a comment stream here, therefore, when we
// load it, we may also need to create with the url. This may also have to
// move the logic over to the mutators function as an upsert operation
// possibly.
return loaders.Assets.getByID.load(id);
} else {
return loaders.Assets.getByURL(url);
}
},
settings(_, args, {loaders}) {
return loaders.Settings.load();
},
me(_, args, {user}) {
return user;
}
};
module.exports = RootQuery;