Fix UserSettings relation being in select rather than relations

This commit is contained in:
Madeline 2023-03-16 11:31:24 +11:00
parent bd5f750024
commit 4d06b86d7b
No known key found for this signature in database
GPG Key ID: 1958E017C36F2E47
4 changed files with 7 additions and 6 deletions

View File

@ -72,14 +72,13 @@ router.post(
"id", "id",
"disabled", "disabled",
"deleted", "deleted",
"settings",
"totp_secret", "totp_secret",
"mfa_enabled", "mfa_enabled",
"webauthn_enabled", "webauthn_enabled",
"security_keys", "security_keys",
"verified", "verified",
], ],
relations: ["security_keys"], relations: ["security_keys", "settings"],
}).catch(() => { }).catch(() => {
throw FieldErrors({ throw FieldErrors({
login: { login: {
@ -187,7 +186,7 @@ router.post(
// Discord header is just the user id as string, which is not possible with npm-jsonwebtoken package // Discord header is just the user id as string, which is not possible with npm-jsonwebtoken package
// https://user-images.githubusercontent.com/6506416/81051916-dd8c9900-8ec2-11ea-8794-daf12d6f31f0.png // https://user-images.githubusercontent.com/6506416/81051916-dd8c9900-8ec2-11ea-8794-daf12d6f31f0.png
res.json({ token, settings: user.settings }); res.json({ token, settings: { ...user.settings, index: undefined } });
}, },
); );

View File

@ -34,7 +34,8 @@ router.post(
where: { where: {
totp_last_ticket: ticket, totp_last_ticket: ticket,
}, },
select: ["id", "totp_secret", "settings"], select: ["id", "totp_secret"],
relations: ["settings"],
}); });
const backup = await BackupCode.findOne({ const backup = await BackupCode.findOne({

View File

@ -54,7 +54,8 @@ router.post(
where: { where: {
totp_last_ticket: ticket, totp_last_ticket: ticket,
}, },
select: ["id", "settings"], select: ["id"],
relations: ["settings"],
}); });
const ret = await verifyWebAuthnToken(ticket); const ret = await verifyWebAuthnToken(ticket);

View File

@ -89,11 +89,11 @@ router.post(
"id", "id",
"disabled", "disabled",
"deleted", "deleted",
"settings",
"totp_secret", "totp_secret",
"mfa_enabled", "mfa_enabled",
"username", "username",
], ],
relations: ["settings"],
}); });
if (isGenerateSchema(req.body)) { if (isGenerateSchema(req.body)) {