-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Admin panel #17
base: master
Are you sure you want to change the base?
Admin panel #17
Conversation
ready |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Phần admin panel này vẫn còn nhiều nghiệp vụ chưa đúng với hệ thống
pull này c sẽ trao đổi lại với em trong buổi demo nha
export const commentCreateGet = asyncHandler(async (req: Request, res: Response): Promise<void> => { | ||
// You can return an HTML form here if you're rendering views | ||
res.json({ message: 'Ready to create a new comment' }); | ||
}); | ||
|
||
// Create a new comment | ||
export const commentCreatePost = asyncHandler(async (req: Request, res: Response): Promise<void> => { | ||
const { review_id, parent_id, comment_text } = req.body; | ||
|
||
const comment = await createComment({ | ||
review_id, | ||
parent_id, | ||
comment_text, | ||
}); | ||
|
||
res.status(201).json(comment); | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Admin có nghiệp vụ tạo comment à e?
export const commentDetails = asyncHandler(async (req: Request, res: Response): Promise<void> => { | ||
const comment = await findCommentById(parseInt(req.params.id)) | ||
|
||
if (!comment) { | ||
res.status(404).json({ message: 'Comment not found' }); | ||
return; | ||
} | ||
|
||
res.json(comment); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
action view detail comment c nghĩ ko cần nè
export const commentUpdateGet = asyncHandler(async (req: Request, res: Response): Promise<void> => { | ||
const comment = await findCommentById(parseInt(req.params.id)); | ||
|
||
if (!comment) { | ||
res.status(404).json({ message: 'Comment not found' }); | ||
return; | ||
} | ||
|
||
// You can return an HTML form here if you're rendering views | ||
// For now, let's return the comment data as JSON | ||
res.json(comment); | ||
}); | ||
|
||
// Update an existing comment | ||
export const commentUpdatePost = asyncHandler(async (req: Request, res: Response): Promise<void> => { | ||
const comment = await findCommentById(parseInt(req.params.id)) | ||
|
||
if (!comment) { | ||
res.status(404).json({ message: 'Comment not found' }); | ||
return; | ||
} | ||
|
||
const { comment_text } = req.body; | ||
|
||
comment.comment_text = comment_text; | ||
|
||
await saveComment(comment) | ||
res.json(comment); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tương tự, admin có nghiệp vụ update comment ko e?
Checklist tự review pull trước khi ready để trainer review
Related Tickets
- ticket redmine
WHAT (optional)
completed/total
in admin page.HOW
WHY (optional)
normal
items. But in new version, we havestate
andconfirm_state
depends on bothnormal
+not_normal
items.Evidence (Screenshot or Video)
Notes (Kiến thức tìm hiểu thêm)