Skip to content

Commit

Permalink
feat: chat content regex sync with client
Browse files Browse the repository at this point in the history
  • Loading branch information
hwmin414 committed Mar 26, 2024
1 parent f2c87db commit 5f58f32
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/modules/patterns.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = {
chat: {
chatImgType: RegExp("^(image/png|image/jpg|image/jpeg)$"),
chatSendType: RegExp("^(text|account)$"),
chatContent: RegExp("\\S+"), //공백 제외 1글자 이상
chatContent: RegExp("^\\s{0,}\\S{1}[\\s\\S]{0,}$"), // 왼쪽 공백 제외 최소 1개 문자
chatContentLength: RegExp("^[\\s\\S]{1,140}$"), // 공백 포함 최대 140문자
},
};
2 changes: 1 addition & 1 deletion src/routes/docs/schemas/chatsSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const chatsZod = {
sendChatHandler: z.object({
roomId: z.string().regex(objectId),
type: z.string().regex(chat.chatSendType),
content: z.string().regex(chat.chatContent),
content: z.string().regex(chat.chatContent).regex(chat.chatContentLength),
}),
};

Expand Down

0 comments on commit 5f58f32

Please sign in to comment.