This commit is contained in:
parent
2cd46585a8
commit
be2cc7ddfa
@ -47,6 +47,9 @@ func (c *Chat) ByIDWithIntegrations(id uint64) (*model.Chat, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Chat) Save(chat *model.Chat) error {
|
func (c *Chat) Save(chat *model.Chat) error {
|
||||||
|
if chat.ID == 0 {
|
||||||
|
return c.db.Create(chat).Error
|
||||||
|
}
|
||||||
return c.db.Model(chat).Save(chat).Error
|
return c.db.Model(chat).Save(chat).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,9 @@ func (r *Integration) LoadForChatAndType(chatID uint64, typ model.IntegrationTyp
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *Integration) Save(integration *model.Integration) error {
|
func (r *Integration) Save(integration *model.Integration) error {
|
||||||
|
if integration.ID == 0 {
|
||||||
|
return r.db.Create(integration).Error
|
||||||
|
}
|
||||||
return r.db.Model(integration).Save(integration).Error
|
return r.db.Model(integration).Save(integration).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,5 +47,8 @@ func (u *User) ByIDWithChats(id uint64) (*model.User, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (u *User) Save(user *model.User) error {
|
func (u *User) Save(user *model.User) error {
|
||||||
|
if user.ID == 0 {
|
||||||
|
return u.db.Create(user).Error
|
||||||
|
}
|
||||||
return u.db.Model(user).Save(user).Error
|
return u.db.Model(user).Save(user).Error
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user