fix: allow null comment in server validation, remove debug logging
This commit is contained in:
@@ -85,9 +85,6 @@ export function AdminTestChecklistPage() {
|
|||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
queryClient.invalidateQueries({ queryKey: ['admin', 'test-checklist'] })
|
queryClient.invalidateQueries({ queryKey: ['admin', 'test-checklist'] })
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
|
||||||
console.warn('updateTestChecklistItem error:', error)
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const resetMutation = useMutation({
|
const resetMutation = useMutation({
|
||||||
@@ -115,9 +112,7 @@ export function AdminTestChecklistPage() {
|
|||||||
|
|
||||||
const handleStatusClick = useCallback(
|
const handleStatusClick = useCallback(
|
||||||
(itemKey: string) => {
|
(itemKey: string) => {
|
||||||
console.warn('handleStatusClick:', itemKey, results[itemKey])
|
|
||||||
const current = statusFromResult(results[itemKey])
|
const current = statusFromResult(results[itemKey])
|
||||||
console.warn('current status:', current)
|
|
||||||
if (current === 'failed') {
|
if (current === 'failed') {
|
||||||
updateMutation.mutate({ itemKey, passed: false, comment: null })
|
updateMutation.mutate({ itemKey, passed: false, comment: null })
|
||||||
} else if (current === 'unchecked') {
|
} else if (current === 'unchecked') {
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ export async function registerAdminTestChecklistRoutes(fastify) {
|
|||||||
if (!itemKey || typeof passed !== 'boolean') {
|
if (!itemKey || typeof passed !== 'boolean') {
|
||||||
return reply.code(400).send({ error: 'itemKey и passed (boolean) обязательны' })
|
return reply.code(400).send({ error: 'itemKey и passed (boolean) обязательны' })
|
||||||
}
|
}
|
||||||
if (comment !== undefined && typeof comment !== 'string') {
|
if (comment !== undefined && comment !== null && typeof comment !== 'string') {
|
||||||
return reply.code(400).send({ error: 'comment должен быть строкой' })
|
return reply.code(400).send({ error: 'comment должен быть строкой' })
|
||||||
}
|
}
|
||||||
if (comment !== undefined && comment.length > 2000) {
|
if (comment !== undefined && comment !== null && comment.length > 2000) {
|
||||||
return reply.code(400).send({ error: 'Комментарий слишком длинный (макс. 2000 символов)' })
|
return reply.code(400).send({ error: 'Комментарий слишком длинный (макс. 2000 символов)' })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user