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