Encrypted messaging app
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
772 B

package Database
import (
"git.tovijaeschke.xyz/tovi/Envelope/Backend/Models"
"gorm.io/gorm"
"gorm.io/gorm/clause"
)
func GetMessageThreadUserById(id string) (Models.MessageThreadUser, error) {
var (
message Models.MessageThreadUser
err error
)
err = DB.Preload(clause.Associations).
First(&message, "id = ?", id).
Error
return message, err
}
func CreateMessageThreadUser(messageThreadUser *Models.MessageThreadUser) error {
var (
err error
)
err = DB.Session(&gorm.Session{FullSaveAssociations: true}).
Create(messageThreadUser).
Error
return err
}
func DeleteMessageThreadUser(messageThreadUser *Models.MessageThreadUser) error {
return DB.Session(&gorm.Session{FullSaveAssociations: true}).
Delete(messageThreadUser).
Error
}