package Database import ( "git.tovijaeschke.xyz/tovi/Envelope/Backend/Models" "gorm.io/gorm" ) func GetUserConversationById(id string) (Models.UserConversation, error) { var ( message Models.UserConversation err error ) err = DB.First(&message, "id = ?", id). Error return message, err } func GetUserConversationsByUserId(id string) ([]Models.UserConversation, error) { var ( conversations []Models.UserConversation err error ) err = DB.Find(&conversations, "user_id = ?", id). Error return conversations, err } func CreateUserConversation(messageThreadUser *Models.UserConversation) error { var ( err error ) err = DB.Session(&gorm.Session{FullSaveAssociations: true}). Create(messageThreadUser). Error return err } func DeleteUserConversation(messageThreadUser *Models.UserConversation) error { return DB.Session(&gorm.Session{FullSaveAssociations: true}). Delete(messageThreadUser). Error }