Add routes to save/get project notification preferences (#30114)

* Add routes to save/get project notification preferences

* update route url

* improve zod schema

* remove unused json response

* update schema and fix tests

* add jsdoc types to pass type-check

* remove using zod strict()

GitOrigin-RevId: f3ab5c88b58bd5af71e0504d0efbe03bdf9b243c
This commit is contained in:
Domagoj Kriskovic
2025-12-15 11:33:13 +01:00
committed by Copybot
parent 3b32b0a61e
commit 7b00e5d9f5
4 changed files with 127 additions and 8 deletions

View File

@@ -12,6 +12,8 @@ const { isZodErrorLike } = require('zod-validation-error')
/**
* A helper function to safely get a nested value from an object
* using a path array (e.g., ["query", "resource_type"])
* @param {any} data
* @param {Array<PropertyKey>} path
*/
function getPathValue(data, path) {
let current = data
@@ -24,6 +26,10 @@ function getPathValue(data, path) {
return current
}
/**
* @param {any} issue
* @param {any} value
*/
const isRequiredError = (issue, value) =>
value === undefined &&
(issue.code === 'invalid_type' || issue.code === 'invalid_union')