Skip to content

Commit

Permalink
add rule short link custom
Browse files Browse the repository at this point in the history
  • Loading branch information
ayocodingit committed Feb 2, 2024
1 parent 3947e83 commit e69345c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/cron/short_link.cron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ const run = async () => {
},
})

logger.Info(
'successfully deleted expired data, count data: ' + counter
)
logger.Info('successfully deleted expired data, count data: ' + counter)
} catch (error: any) {
logger.Error(error.message)
}
Expand Down
1 change: 1 addition & 0 deletions src/helpers/regex.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export const RegexWordScript = /\b(?!script\b)\w+\b/i
export const RegexSubdomain = /^[ a-z0-9-]+$/
export const RegexPath = /^[ a-zA-Z0-9-_]+$/
export const RegexSanitize = /^[ a-zA-Z0-9_,.()'"&-/]+$/
export const RegexObjectID = /^[0-9a-fA-F]{24}$/
export const RegexContentTypeImage = /^image\//
3 changes: 2 additions & 1 deletion src/modules/short_links/entity/schema.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import Joi from 'joi'
import { RegexPath } from '../../../helpers/regex'

export const RequestSchema = Joi.object({
short_link: Joi.string().alphanum().optional(),
short_link: Joi.string().regex(RegexPath).optional(),
url: Joi.string().uri().required(),
expired: Joi.date().min(new Date()).optional(),
})

0 comments on commit e69345c

Please sign in to comment.