mirror of
https://github.com/wassname/talk.git
synced 2026-07-04 15:58:38 +08:00
Updates
This commit is contained in:
@@ -26,8 +26,8 @@ const genAssetsByID = (context, ids) => AssetModel.find({
|
||||
* @param {Number} limit limit the number of results
|
||||
* @return {Promise} resolves the assets
|
||||
*/
|
||||
const getAssetsByQuery = (context, value, limit) => {
|
||||
return AssetsService.search(value, null, limit);
|
||||
const getAssetsByQuery = (context, query) => {
|
||||
return AssetsService.search(query);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,9 +11,7 @@ const RootQuery = {
|
||||
return null;
|
||||
}
|
||||
|
||||
const {value = '', limit} = query;
|
||||
|
||||
return Assets.search(value, limit);
|
||||
return Assets.search(query);
|
||||
},
|
||||
asset(_, query, {loaders: {Assets}}) {
|
||||
if (query.id) {
|
||||
|
||||
@@ -634,7 +634,7 @@ type RootQuery {
|
||||
comment(id: ID!): Comment
|
||||
|
||||
# All assets. Requires the `ADMIN` role.
|
||||
assets(query: AssetsQuery!): [Asset]
|
||||
assets(query: AssetsQuery): [Asset]
|
||||
|
||||
# Find or create an asset by url, or just find with the ID.
|
||||
asset(id: ID, url: String): Asset
|
||||
|
||||
+1
-1
@@ -109,7 +109,7 @@ module.exports = class AssetsService {
|
||||
* @param {String} value string to search by.
|
||||
* @return {Promise}
|
||||
*/
|
||||
static search(value = '', skip = null, limit = null) {
|
||||
static search({value = '', skip = null, limit = null}) {
|
||||
if (value.length === 0) {
|
||||
return AssetsService.all(skip, limit);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user