api: rename VoteDirection to Direction

This commit is contained in:
Adhityaa 2018-06-07 13:09:53 +05:30
parent fcf21fd9db
commit 0f2a6a8ccc
3 changed files with 7 additions and 7 deletions

View File

@ -15,5 +15,5 @@ type comment struct {
Score int `json:"score"` Score int `json:"score"`
State string `json:"state"` State string `json:"state"`
CreationDate time.Time `json:"creationDate"` CreationDate time.Time `json:"creationDate"`
VoteDirection int `json:"voteDirection"` Direction int `json:"direction"`
} }

View File

@ -65,9 +65,9 @@ func commentList(commenterHex string, domain string, path string, includeUnappro
` `
row := db.QueryRow(statement, c.CommentHex, commenterHex) row := db.QueryRow(statement, c.CommentHex, commenterHex)
if err = row.Scan(&c.VoteDirection); err != nil { if err = row.Scan(&c.Direction); err != nil {
// TODO: is the only error here that there is no such entry? // TODO: is the only error here that there is no such entry?
c.VoteDirection = 0 c.Direction = 0
} }
} }

View File

@ -25,8 +25,8 @@ func TestCommentListBasics(t *testing.T) {
return return
} }
if c[0].VoteDirection != 0 { if c[0].Direction != 0 {
t.Errorf("expected c.VoteDirection = 0 got c.VoteDirection = %d", c[0].VoteDirection) t.Errorf("expected c.Direction = 0 got c.Direction = %d", c[0].Direction)
return return
} }
@ -47,8 +47,8 @@ func TestCommentListBasics(t *testing.T) {
return return
} }
if c[0].VoteDirection != 1 { if c[0].Direction != 1 {
t.Errorf("expected c.VoteDirection = 1 got c.VoteDirection = %d", c[0].VoteDirection) t.Errorf("expected c.Direction = 1 got c.Direction = %d", c[0].Direction)
return return
} }
} }