-
Notifications
You must be signed in to change notification settings - Fork 0
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
Implement comment (frontend + backend) #11
Conversation
"parentId" bigint, | ||
"rawContent" text, | ||
"postedAt" timestamp, | ||
"updatedAt" timestamp, |
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.
fix indent
END IF; | ||
RETURN QUERY EXECUTE format( | ||
'SELECT | ||
"Users"."username", |
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.
better to use aliases for table names
type: 'object', | ||
properties: { | ||
id: { type: 'integer' }, | ||
parentId: { type: 'integer', nullable: true }, |
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.
what's the reason to make the field nullable and required at the same time?
const formatComments = comments => | ||
comments.map(comment => { | ||
const { username, imageURL, ...rest } = comment; | ||
rest.author = { username, imageURL }; |
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.
but how you will make a popup window (oh hover) with user information using only the image and username? maybe some additional information is needed?
return this.pg.update({ | ||
changes: { | ||
rawContent, | ||
updatedAt: new Date(), |
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.
maybe better to use CURRENT_TIMESTAMP inside DBMS?
import React from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
import Header from './header'; |
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.
it's more explicit to use names like CommentHeader instead of just Header
import Header from './header'; | ||
import Footer from './footer'; | ||
import SideBlock from './side'; | ||
import MarkDown from '../cells/markdown'; |
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.
use the singular form to name components
`; | ||
|
||
const MainBlock = styled.div` | ||
width: 100%; |
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.
is it required when the parent block has display: flex?
export default CommentThread; | ||
|
||
const CommentList = styled.ul` | ||
list-style: none; |
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.
better to move it to the index.css as it looks like a global reset
export class CommentService { | ||
static async getByParent(postId, parentId) { | ||
const comments = await http.get( | ||
`${API_HOST}/posts/${postId}/comments/${parentId ?? ''}`, |
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.
there is no need to use API_HOST URL prefix as HttpService already do it
No description provided.