mirror of
https://iceshrimp.dev/crimekillz/trashposs
synced 2024-11-22 08:53:48 +01:00
refactor(server): use insert instead of save
This commit is contained in:
parent
934132e08a
commit
6c01a2aec1
@ -107,7 +107,7 @@ async function save(file: DriveFile, path: string, name: string, type: string, h
|
||||
file.size = size;
|
||||
file.storedInternal = false;
|
||||
|
||||
return await DriveFiles.save(file);
|
||||
return await DriveFiles.insert(file).then(x => DriveFiles.findOneOrFail(x.identifiers[0]));
|
||||
} else { // use internal storage
|
||||
const accessKey = uuid();
|
||||
const thumbnailAccessKey = 'thumbnail-' + uuid();
|
||||
@ -140,7 +140,7 @@ async function save(file: DriveFile, path: string, name: string, type: string, h
|
||||
file.md5 = hash;
|
||||
file.size = size;
|
||||
|
||||
return await DriveFiles.save(file);
|
||||
return await DriveFiles.insert(file).then(x => DriveFiles.findOneOrFail(x.identifiers[0]));
|
||||
}
|
||||
}
|
||||
|
||||
@ -436,7 +436,7 @@ export default async function(
|
||||
file.type = info.type.mime;
|
||||
file.storedInternal = false;
|
||||
|
||||
file = await DriveFiles.save(file);
|
||||
file = await DriveFiles.insert(file).then(x => DriveFiles.findOneOrFail(x.identifiers[0]));
|
||||
} catch (e) {
|
||||
// duplicate key error (when already registered)
|
||||
if (isDuplicateKeyValueError(e)) {
|
||||
|
Loading…
Reference in New Issue
Block a user