backedn converted to ts

This commit is contained in:
QkoSad
2023-07-27 15:58:35 +03:00
parent 3bf4e9fc56
commit 40051f9d5e
18 changed files with 1394 additions and 29668 deletions
+15
View File
@@ -0,0 +1,15 @@
export const isUserId = function(req: unknown): req is { user: { id: string } } {
let user: unknown = null
let id: unknown = null
if (typeof req === 'object' && req)
if ('user' in req) {
user = req.user
if (typeof user === 'object' && user && 'id' in user) {
id = user.id
if (typeof id === 'string') {
return true
}
}
}
return false
}