now no two users can have the same uuid
This commit is contained in:
parent
0a150ad343
commit
4cbe252852
1 changed files with 7 additions and 1 deletions
|
@ -37,6 +37,12 @@ export function run(app) {
|
||||||
let userUuid = '';
|
let userUuid = '';
|
||||||
|
|
||||||
if (users.length === 0) {
|
if (users.length === 0) {
|
||||||
|
let newUuid = uuid.v4();
|
||||||
|
|
||||||
|
while (User.find({uuid: newUuid})[0]) {
|
||||||
|
newUuid = uuid.v4();
|
||||||
|
}
|
||||||
|
|
||||||
const newUser = new User({
|
const newUser = new User({
|
||||||
id: String(userInfo.data.id),
|
id: String(userInfo.data.id),
|
||||||
createdAt: new Date(),
|
createdAt: new Date(),
|
||||||
|
@ -45,7 +51,7 @@ export function run(app) {
|
||||||
discriminator: userInfo.data.discriminator,
|
discriminator: userInfo.data.discriminator,
|
||||||
avatar: userInfo.data.avatar,
|
avatar: userInfo.data.avatar,
|
||||||
|
|
||||||
uuid: uuid.v4(),
|
uuid: newUuid,
|
||||||
});
|
});
|
||||||
|
|
||||||
userUuid = newUser.get('uuid');
|
userUuid = newUser.get('uuid');
|
||||||
|
|
Loading…
Reference in a new issue