0
0
This commit is contained in:
syuilo 2018-08-22 09:33:59 +09:00
parent f91d2e8c8d
commit fe1e60a28c

View File

@ -34,9 +34,12 @@ export default (params: any, user: ILocalUser) => new Promise(async (res, rej) =
const sort = { const sort = {
_id: -1 _id: -1
}; };
const query = { const query = {
'metadata.userId': user._id 'metadata.userId': user._id,
'metadata.deletedAt': { $exists: false }
} as any; } as any;
if (sinceId) { if (sinceId) {
sort._id = 1; sort._id = 1;
query._id = { query._id = {
@ -47,6 +50,7 @@ export default (params: any, user: ILocalUser) => new Promise(async (res, rej) =
$lt: untilId $lt: untilId
}; };
} }
if (type) { if (type) {
query.contentType = new RegExp(`^${type.replace(/\*/g, '.+?')}$`); query.contentType = new RegExp(`^${type.replace(/\*/g, '.+?')}$`);
} }
@ -59,6 +63,5 @@ export default (params: any, user: ILocalUser) => new Promise(async (res, rej) =
}); });
// Serialize // Serialize
res(await Promise.all(files.map(async file => res(await Promise.all(files.map(file => pack(file))));
await pack(file))));
}); });