Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Commit

Permalink
feat(chat message): update the rule to validate the chat message kinds
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethTrecy committed Sep 15, 2022
1 parent 76b47be commit c2933bc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions routes/api/chat_message/list.get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ import QueryController from "!/controllers/query"

import CommonMiddlewareList from "!/middlewares/common_middleware_list"

import string from "!/validators/base/string"
import required from "!/validators/base/required"
import nullable from "!/validators/base/nullable"
import makeListRules from "!/rule_sets/make_list"
import length from "!/validators/comparison/length"
import stringArray from "!/validators/hybrid/string_array"
import skipAsterisk from "!/validators/comparison/skip_asterisk"
import makeMultiIDBasedFilterRules from "!/rule_sets/make_multi-id-based_filter"
import doesBelongToCurrentUser from "!/validators/manager/does_belong_to_current_user"
Expand All @@ -36,9 +37,14 @@ export default class extends QueryController {
}),
"chatMessageKind": {
"constraints": {
"length": {
// TODO: Find the best length
"maximum": 24,
"minimum": 1
},
"nullable": { "defaultValue": "*" }
},
"pipes": [ nullable, skipAsterisk, string ]
"pipes": [ nullable, skipAsterisk, stringArray, length ]
}
}, {
"defaultSortColumn": "-createdAt"
Expand Down

0 comments on commit c2933bc

Please sign in to comment.