mirror of
https://github.com/wassname/talk.git
synced 2026-07-03 06:20:19 +08:00
26 lines
675 B
JavaScript
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;
|