summaryrefslogtreecommitdiff
path: root/src/api
diff options
context:
space:
mode:
authorotofune <otofune@gmail.com>2017-11-06 16:32:01 +0900
committerotofune <otofune@gmail.com>2017-11-06 16:32:01 +0900
commitd5cc4cc9c28eb6a981ce37859def97cd7c57abc6 (patch)
treebd9716aa1943210968456940f594b831e3556c68 /src/api
parentremove console (diff)
downloadsharkey-d5cc4cc9c28eb6a981ce37859def97cd7c57abc6.tar.gz
sharkey-d5cc4cc9c28eb6a981ce37859def97cd7c57abc6.tar.bz2
sharkey-d5cc4cc9c28eb6a981ce37859def97cd7c57abc6.zip
fix lint (automattic)
Diffstat (limited to 'src/api')
-rw-r--r--src/api/common/add-file-to-drive.ts18
-rw-r--r--src/api/endpoints/drive/files.ts2
-rw-r--r--src/api/endpoints/drive/files/show.ts2
-rw-r--r--src/api/endpoints/drive/files/update.ts3
-rw-r--r--src/api/endpoints/posts/timeline.ts4
-rw-r--r--src/api/models/drive-file.ts10
-rw-r--r--src/api/serializers/drive-file.ts4
7 files changed, 21 insertions, 22 deletions
diff --git a/src/api/common/add-file-to-drive.ts b/src/api/common/add-file-to-drive.ts
index dff2d52356..f9c22ccacd 100644
--- a/src/api/common/add-file-to-drive.ts
+++ b/src/api/common/add-file-to-drive.ts
@@ -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
diff --git a/src/api/endpoints/drive/files.ts b/src/api/endpoints/drive/files.ts
index 035916b309..53b48a8bec 100644
--- a/src/api/endpoints/drive/files.ts
+++ b/src/api/endpoints/drive/files.ts
@@ -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;
};
diff --git a/src/api/endpoints/drive/files/show.ts b/src/api/endpoints/drive/files/show.ts
index 0a19b19939..3c7cf774f9 100644
--- a/src/api/endpoints/drive/files/show.ts
+++ b/src/api/endpoints/drive/files/show.ts
@@ -33,5 +33,5 @@ module.exports = async (params, user) => {
detail: true
});
- return _file
+ return _file;
};
diff --git a/src/api/endpoints/drive/files/update.ts b/src/api/endpoints/drive/files/update.ts
index 7a6d2562fb..4e56b30ace 100644
--- a/src/api/endpoints/drive/files/update.ts
+++ b/src/api/endpoints/drive/files/update.ts
@@ -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).$;
diff --git a/src/api/endpoints/posts/timeline.ts b/src/api/endpoints/posts/timeline.ts
index 978825a109..203413e23a 100644
--- a/src/api/endpoints/posts/timeline.ts
+++ b/src/api/endpoints/posts/timeline.ts
@@ -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;
};
diff --git a/src/api/models/drive-file.ts b/src/api/models/drive-file.ts
index 79a87f6572..8968d065cd 100644
--- a/src/api/models/drive-file.ts
+++ b/src/api/models/drive-file.ts
@@ -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 (
diff --git a/src/api/serializers/drive-file.ts b/src/api/serializers/drive-file.ts
index e749f80387..2af7db5726 100644
--- a/src/api/serializers/drive-file.ts
+++ b/src/api/serializers/drive-file.ts
@@ -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);