fix(server): remove all avatarType references after DB column drop
This commit is contained in:
@@ -11,7 +11,6 @@ export async function registerAdminProfileRoutes(fastify) {
|
||||
email: user.email,
|
||||
displayName: user.displayName,
|
||||
avatar: user.avatar,
|
||||
avatarType: user.avatarType,
|
||||
avatarStyle: user.avatarStyle,
|
||||
}
|
||||
})
|
||||
@@ -25,7 +24,6 @@ export async function registerAdminProfileRoutes(fastify) {
|
||||
|
||||
return {
|
||||
avatar: user.avatar,
|
||||
avatarType: user.avatarType,
|
||||
avatarStyle: user.avatarStyle,
|
||||
}
|
||||
})
|
||||
@@ -37,17 +35,12 @@ export async function registerAdminProfileRoutes(fastify) {
|
||||
nameRaw === undefined ? undefined : nameRaw === null ? null : nameRaw === '' ? null : String(nameRaw).trim()
|
||||
const avatarRaw = request.body?.avatar
|
||||
const avatar = avatarRaw === null || avatarRaw === undefined ? undefined : String(avatarRaw).trim()
|
||||
const avatarTypeRaw = request.body?.avatarType
|
||||
const avatarType = avatarTypeRaw === null || avatarTypeRaw === undefined ? undefined : String(avatarTypeRaw).trim()
|
||||
const avatarStyleRaw = request.body?.avatarStyle
|
||||
const avatarStyle =
|
||||
avatarStyleRaw === null || avatarStyleRaw === undefined ? undefined : String(avatarStyleRaw).trim()
|
||||
|
||||
if (displayName !== undefined && displayName !== null && displayName.length > 40)
|
||||
return reply.code(400).send({ error: 'Имя/ник максимум 40 символов' })
|
||||
if (avatarType !== undefined && avatarType !== 'oauth' && avatarType !== 'generated' && avatarType !== '') {
|
||||
return reply.code(400).send({ error: 'avatarType должен быть oauth | generated | пустая строка' })
|
||||
}
|
||||
if (avatar !== undefined && avatar.length > 200000) return reply.code(400).send({ error: 'Аватар слишком большой' })
|
||||
if (avatarStyle !== undefined && avatarStyle !== '' && avatarStyle.length > 30) {
|
||||
return reply.code(400).send({ error: 'Стиль аватара слишком длинный' })
|
||||
@@ -57,9 +50,6 @@ export async function registerAdminProfileRoutes(fastify) {
|
||||
if (displayName !== undefined) {
|
||||
data.displayName = displayName && displayName.length ? displayName : null
|
||||
}
|
||||
if (avatarType !== undefined) {
|
||||
data.avatarType = avatarType === '' ? null : avatarType
|
||||
}
|
||||
if (avatar !== undefined) {
|
||||
data.avatar = avatar === '' ? null : avatar
|
||||
}
|
||||
@@ -73,7 +63,6 @@ export async function registerAdminProfileRoutes(fastify) {
|
||||
email: updated.email,
|
||||
displayName: updated.displayName,
|
||||
avatar: updated.avatar,
|
||||
avatarType: updated.avatarType,
|
||||
avatarStyle: updated.avatarStyle,
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user