mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-11-21 21:09:22 +00:00
Migration is working
This commit is contained in:
parent
48def5010d
commit
37ef2acf3e
@ -15,6 +15,8 @@
|
||||
import { pathUserData } from "../utils/UserDataUtils";
|
||||
import { readdirSync, readFileSync } from "fs";
|
||||
import { AccountImageVisibilityLevel } from "../entities/User";
|
||||
import { DatabaseHelper } from "../helpers/DatabaseHelper";
|
||||
import { USER_TABLE } from "../helpers/AccountHelper";
|
||||
|
||||
const AVATARS_PATH = "avatars/";
|
||||
const AVATARS_ADDRESSES_FILES = "avatars/adresse_avatars/";
|
||||
@ -51,6 +53,16 @@ export async function accountImageMigration() {
|
||||
const newPath = AVATARS_PATH + fileContent;
|
||||
|
||||
console.info("User " + userID + "\tAccount image: " + newPath);
|
||||
|
||||
await DatabaseHelper.UpdateRows({
|
||||
table: USER_TABLE,
|
||||
where: {
|
||||
ID: userID
|
||||
},
|
||||
set: {
|
||||
account_image_path: newPath
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Account image visibility
|
||||
@ -58,6 +70,17 @@ export async function accountImageMigration() {
|
||||
const newVisibililty = VisibilityLevelsMap[Number(fileContent)];
|
||||
|
||||
console.info("User " + userID + "\tVisibility: " + newVisibililty);
|
||||
|
||||
|
||||
await DatabaseHelper.UpdateRows({
|
||||
table: USER_TABLE,
|
||||
where: {
|
||||
ID: userID
|
||||
},
|
||||
set: {
|
||||
account_image_visibility: newVisibililty
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user