mirror of
https://github.com/wassname/talk.git
synced 2026-07-01 04:17:35 +08:00
30 lines
751 B
JavaScript
30 lines
751 B
JavaScript
const Asset = {
|
|
recentComments({id}, _, {loaders: {Comments}}) {
|
|
return Comments.genRecentComments.load(id);
|
|
},
|
|
comments({id}, {sort, limit}, {loaders: {Comments}}) {
|
|
return Comments.getByQuery({
|
|
asset_id: id,
|
|
sort,
|
|
limit,
|
|
parent_id: null
|
|
});
|
|
},
|
|
commentCount({id}, _, {loaders: {Comments}}) {
|
|
return Comments.countByAssetID.load(id);
|
|
},
|
|
settings({settings = null}, _, {loaders: {Settings}}) {
|
|
return Settings.load()
|
|
.then((globalSettings) => {
|
|
if (settings) {
|
|
settings = Object.assign({}, globalSettings.toObject(), settings);
|
|
} else {
|
|
settings = globalSettings.toObject();
|
|
}
|
|
return settings;
|
|
});
|
|
}
|
|
};
|
|
|
|
module.exports = Asset;
|