Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

PluckySquirrel
Copy link
Contributor

Checklist tự review pull trước khi ready để trainer review

  • Kiểm tra mỗi pull request chỉ 1 commit, nếu nhiều hơn 1 commit thì hãy gộp commit thành 1 rồi đẩy lại lên git
  • Chạy eslint ở local để check và fix các lỗi liên quan đến syntax, coding convention. Khi gửi thì chụp ảnh PASS eslint đính kèm trong pull
  • Sử dụng thụt lề 2 spaces/4 spaces đồng nhất ở tất cả các files (setting lại vscode /sublime text nếu chưa cài đặt)
  • Cuối mỗi file kiểm tra có end line (khi đẩy lên git xem file change không bị lỗi tròn đỏ ở cuối file)
  • Mỗi dòng nếu quá dài, cần xuống dòng (maximum: 80 kí tự mỗi dòng, setting trong IDE hoặc dùng Prettier để config format code)
  • Tham khảo Typescript coding convention https://google.github.io/styleguide/tsguide.html

Related Tickets

- ticket redmine

WHAT (optional)

  • Change number items completed/total in admin page.

HOW

  • I edit js file, inject not_vary_normal items in calculate function.

WHY (optional)

  • Because in previous version - number just depends on normal items. But in new version, we have state and confirm_state depends on both normal + not_normal items.

Evidence (Screenshot or Video)

Notes (Kiến thức tìm hiểu thêm)

@PluckySquirrel
Copy link
Contributor Author

ready

Copy link
Contributor

@huongnt-2545 huongnt-2545 left a 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

Comment on lines +11 to +28
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);
});

Copy link
Contributor

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?

Comment on lines +30 to +39
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);
});
Copy link
Contributor

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è

Comment on lines +41 to +69
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);
});
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants