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.

41 lines
1013 B

package Database
import (
"git.tovijaeschke.xyz/tovi/Capsule/Backend/Models"
"gorm.io/gorm"
"gorm.io/gorm/clause"
)
func GetConversationDetailUserById(id string) (Models.ConversationDetailUser, error) {
var (
messageThread Models.ConversationDetailUser
err error
)
err = DB.Preload(clause.Associations).
Where("id = ?", id).
First(&messageThread).
Error
return messageThread, err
}
func CreateConversationDetailUser(messageThread *Models.ConversationDetailUser) error {
return DB.Session(&gorm.Session{FullSaveAssociations: true}).
Create(messageThread).
Error
}
func UpdateConversationDetailUser(messageThread *Models.ConversationDetailUser) error {
return DB.Session(&gorm.Session{FullSaveAssociations: true}).
Where("id = ?", messageThread.ID).
Updates(messageThread).
Error
}
func DeleteConversationDetailUser(messageThread *Models.ConversationDetailUser) error {
return DB.Session(&gorm.Session{FullSaveAssociations: true}).
Delete(messageThread).
Error
}