aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/account.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/validators/account.ts')
-rw-r--r--server/middlewares/validators/account.ts35
1 files changed, 0 insertions, 35 deletions
diff --git a/server/middlewares/validators/account.ts b/server/middlewares/validators/account.ts
deleted file mode 100644
index 551f67d61..000000000
--- a/server/middlewares/validators/account.ts
+++ /dev/null
@@ -1,35 +0,0 @@
1import express from 'express'
2import { param } from 'express-validator'
3import { isAccountNameValid } from '../../helpers/custom-validators/accounts'
4import { areValidationErrors, doesAccountNameWithHostExist, doesLocalAccountNameExist } from './shared'
5
6const localAccountValidator = [
7 param('name')
8 .custom(isAccountNameValid),
9
10 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
11 if (areValidationErrors(req, res)) return
12 if (!await doesLocalAccountNameExist(req.params.name, res)) return
13
14 return next()
15 }
16]
17
18const accountNameWithHostGetValidator = [
19 param('accountName')
20 .exists(),
21
22 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
23 if (areValidationErrors(req, res)) return
24 if (!await doesAccountNameWithHostExist(req.params.accountName, res)) return
25
26 return next()
27 }
28]
29
30// ---------------------------------------------------------------------------
31
32export {
33 localAccountValidator,
34 accountNameWithHostGetValidator
35}