|
@@ -78,17 +78,13 @@ const createLink = [
|
|
|
.customSanitizer(value => addMilliseconds(new Date(), value).toISOString()),
|
|
.customSanitizer(value => addMilliseconds(new Date(), value).toISOString()),
|
|
|
body("domain")
|
|
body("domain")
|
|
|
.optional({ nullable: true, checkFalsy: true })
|
|
.optional({ nullable: true, checkFalsy: true })
|
|
|
|
|
+ .customSanitizer(value => value === env.DEFAULT_DOMAIN ? null : value)
|
|
|
.custom(checkUser)
|
|
.custom(checkUser)
|
|
|
.withMessage("Only users can use this field.")
|
|
.withMessage("Only users can use this field.")
|
|
|
.isString()
|
|
.isString()
|
|
|
.withMessage("Domain should be string.")
|
|
.withMessage("Domain should be string.")
|
|
|
.customSanitizer(value => value.toLowerCase())
|
|
.customSanitizer(value => value.toLowerCase())
|
|
|
.custom(async (address, { req }) => {
|
|
.custom(async (address, { req }) => {
|
|
|
- if (address === env.DEFAULT_DOMAIN) {
|
|
|
|
|
- req.body.domain = null;
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
const domain = await query.domain.find({
|
|
const domain = await query.domain.find({
|
|
|
address,
|
|
address,
|
|
|
user_id: req.user.id
|
|
user_id: req.user.id
|