package models import "database/sql" type Reaction struct { ID int PostID int UserID int Emoji string } func GetReactionsByPostID(db *sql.DB, postID int) ([]Reaction, error) { query := "SELECT id, post_id, user_id, emoji FROM reactions WHERE post_id = ?" rows, err := db.Query(query, postID) if err != nil { return nil, err } defer rows.Close() var reactions []Reaction for rows.Next() { reaction := Reaction{} err := rows.Scan(&reaction.ID, &reaction.PostID, &reaction.UserID, &reaction.Emoji) if err != nil { return nil, err } reactions = append(reactions, reaction) } return reactions, nil } // Stubbed for future implementation func CreateReaction(db *sql.DB, reaction Reaction) error { query := "INSERT INTO reactions (post_id, user_id, emoji) VALUES (?, ?, ?)" _, err := db.Exec(query, reaction.PostID, reaction.UserID, reaction.Emoji) return err } // Stubbed for future implementation func DeleteReaction(db *sql.DB, postID, userID int, emoji string) error { query := "DELETE FROM reactions WHERE post_id = ? AND user_id = ? AND emoji = ?" _, err := db.Exec(query, postID, userID, emoji) return err }