This commit is contained in:
2026-04-27 16:35:07 -06:00
parent 3c7be22019
commit cb4a210567
7 changed files with 701 additions and 376 deletions
+22 -5
View File
@@ -6,11 +6,11 @@ import (
)
type Story struct {
ID int
RoomID int
Title string
Points *int
Voted bool
ID int
RoomID int
Title string
Points *int
Voted bool
}
type Vote struct {
@@ -168,3 +168,20 @@ func tshirtToPoints(s string) float64 {
return float64(n)
}
}
func GetStoryByID(id int) (*Story, error) {
row := DB.QueryRow("SELECT id, room_id, title, points, voted FROM stories WHERE id = ?", id)
var s Story
var points sql.NullInt64
var voted int
err := row.Scan(&s.ID, &s.RoomID, &s.Title, &points, &voted)
if err != nil {
return nil, err
}
if points.Valid {
p := int(points.Int64)
s.Points = &p
}
s.Voted = voted == 1
return &s, nil
}