dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

tableChatReactions.go (576B)


      1 package database
      2 
      3 import (
      4 	"time"
      5 )
      6 
      7 type ChatReaction struct {
      8 	ID        int64
      9 	UserID    UserID
     10 	MessageID int64
     11 	Reaction  int64
     12 	CreatedAt time.Time
     13 }
     14 
     15 func (d *DkfDB) CreateChatReaction(userID UserID, messageID, reaction int64) error {
     16 	out := ChatReaction{
     17 		UserID:    userID,
     18 		MessageID: messageID,
     19 		Reaction:  reaction,
     20 	}
     21 	return d.db.Create(&out).Error
     22 }
     23 
     24 func (d *DkfDB) DeleteReaction(userID UserID, messageID, reaction int64) error {
     25 	return d.db.Delete(ChatReaction{}, "user_id = ? AND message_id = ? AND reaction = ?", userID, messageID, reaction).Error
     26 }