feat(channel): add error handling for SaveWithoutKey when channel ID is 0

This commit is contained in:
CaIon
2025-12-20 12:21:53 +08:00
parent a343ce84ee
commit d9634ad2d3

View File

@@ -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
}