Resolve conflicts

This commit is contained in:
syuilo
2018-03-29 14:48:47 +09:00
parent 281b388e39
commit bfc193d8cd
308 changed files with 3045 additions and 3200 deletions

View File

@@ -100,7 +100,7 @@ const addFile = async (
// Check if there is a file with the same hash
const much = await DriveFile.findOne({
md5: hash,
'metadata.user_id': user._id
'metadata.userId': user._id
});
if (much !== null) {
@@ -172,7 +172,7 @@ const addFile = async (
}
const driveFolder = await DriveFolder.findOne({
_id: folderId,
user_id: user._id
userId: user._id
});
if (!driveFolder) {
throw 'folder-not-found';
@@ -184,7 +184,7 @@ const addFile = async (
// Calculate drive usage
const usage = await DriveFile
.aggregate([{
$match: { 'metadata.user_id': user._id }
$match: { 'metadata.userId': user._id }
}, {
$project: {
length: true
@@ -205,7 +205,7 @@ const addFile = async (
log(`drive usage is ${usage}`);
// If usage limit exceeded
if (usage + size > user.drive_capacity) {
if (usage + size > user.driveCapacity) {
throw 'no-free-space';
}
})()
@@ -221,12 +221,12 @@ const addFile = async (
}
if (averageColor) {
properties['average_color'] = averageColor;
properties['avgColor'] = averageColor;
}
return addToGridFS(detectedName, readable, mime, {
user_id: user._id,
folder_id: folder !== null ? folder._id : null,
userId: user._id,
folderId: folder !== null ? folder._id : null,
comment: comment,
properties: properties
});
@@ -297,7 +297,7 @@ export default (user: any, file: string | stream.Readable, ...args) => new Promi
id: file._id.toString(),
body: {
name: file.name,
user_id: user._id.toString()
userId: user._id.toString()
}
});
}