fix lint (automattic)

This commit is contained in:
otofune
2017-11-06 16:32:01 +09:00
parent 04648db1c2
commit d5cc4cc9c2
9 changed files with 48 additions and 49 deletions

View File

@ -14,16 +14,16 @@ import { Duplex } from 'stream';
const log = debug('misskey:register-drive-file');
const addToGridFS = (name, binary, metadata): Promise<any> => new Promise(async (resolve, reject) => {
const dataStream = new Duplex()
dataStream.push(binary)
dataStream.push(null)
const dataStream = new Duplex();
dataStream.push(binary);
dataStream.push(null);
const bucket = await getGridFSBucket()
const writeStream = bucket.openUploadStream(name, { metadata })
writeStream.once('finish', (doc) => { resolve(doc) })
writeStream.on('error', reject)
dataStream.pipe(writeStream)
})
const bucket = await getGridFSBucket();
const writeStream = bucket.openUploadStream(name, { metadata });
writeStream.once('finish', (doc) => { resolve(doc); });
writeStream.on('error', reject);
dataStream.pipe(writeStream);
});
/**
* Add file to drive

View File

@ -63,5 +63,5 @@ module.exports = async (params, user, app) => {
// Serialize
const _files = await Promise.all(files.map(file => serialize(file)));
return _files
return _files;
};

View File

@ -33,5 +33,5 @@ module.exports = async (params, user) => {
detail: true
});
return _file
return _file;
};

View File

@ -20,7 +20,6 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
const [fileId, fileIdErr] = $(params.file_id).id().$;
if (fileIdErr) return rej('invalid file_id param');
// Fetch file
const file = await DriveFile
.findOne({
@ -32,7 +31,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
return rej('file-not-found');
}
const updateQuery: any = {}
const updateQuery: any = {};
// Get 'name' parameter
const [name, nameErr] = $(params.name).optional.string().pipe(validateFileName).$;

View File

@ -92,6 +92,6 @@ module.exports = async (params, user, app) => {
});
// Serialize
const _timeline = await Promise.all(timeline.map(post => serialize(post, user)))
return _timeline
const _timeline = await Promise.all(timeline.map(post => serialize(post, user)));
return _timeline;
};

View File

@ -8,14 +8,14 @@ const collection = monkDb.get('drive_files.files');
export default collection as any; // fuck type definition
const getGridFSBucket = async (): Promise<mongodb.GridFSBucket> => {
const db = await nativeDbConn()
const db = await nativeDbConn();
const bucket = new mongodb.GridFSBucket(db, {
bucketName: 'drive_files'
})
return bucket
}
});
return bucket;
};
export { getGridFSBucket }
export { getGridFSBucket };
export function validateFileName(name: string): boolean {
return (

View File

@ -40,13 +40,13 @@ export default (
_file = deepcopy(file);
}
if (!_file) return reject('invalid file arg.')
if (!_file) return reject('invalid file arg.');
// rendered target
let _target: any = {};
_target.id = _file._id;
_target.created_at = _file.uploadDate
_target.created_at = _file.uploadDate;
_target = Object.assign(_target, _file.metadata);