Merge branch 'master' into develop

This commit is contained in:
Julian Lam
2023-03-22 10:50:29 -04:00
12 changed files with 200 additions and 37 deletions

View File

@@ -677,6 +677,10 @@ usersAPI.getExportByType = async (caller, { uid, type }) => {
};
usersAPI.generateExport = async (caller, { uid, type }) => {
const validTypes = ['profile', 'posts', 'uploads'];
if (!validTypes.includes(type)) {
throw new Error('[[error:invalid-data]]');
}
const count = await db.incrObjectField('locks', `export:${uid}${type}`);
if (count > 1) {
throw new Error('[[error:already-exporting]]');