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): validate the chat message kind of list filter
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethTrecy committed Sep 15, 2022
1 parent 6daadc7 commit 993dcbf
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion routes/api/chat_message/list.get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +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 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 @@ -30,7 +33,13 @@ export default class extends QueryController {
"postIDRules": {
"pipes": [ doesBelongToCurrentUser ]
}
})
}),
"chatMessageKind": {
"constraints": {
"nullable": { "defaultValue": "*" }
},
"pipes": [ nullable, skipAsterisk, string ]
}
}, {
"defaultSortColumn": "-createdAt"
})
Expand Down

0 comments on commit 993dcbf

Please sign in to comment.