mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-03-30 03:43:39 +00:00
feat(channel): add error handling for SaveWithoutKey when channel ID is 0
This commit is contained in:
@@ -254,6 +254,9 @@ func (channel *Channel) Save() error {
|
||||
}
|
||||
|
||||
func (channel *Channel) SaveWithoutKey() error {
|
||||
if channel.Id == 0 {
|
||||
return errors.New("channel ID is 0")
|
||||
}
|
||||
return DB.Omit("key").Save(channel).Error
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user