Add nudge_channels to MessagingConfig schema (gt-3shmx)
- Add NudgeChannels field to MessagingConfig struct in types.go - Initialize NudgeChannels map in NewMessagingConfig() - Add validation in validateMessagingConfig(): channel names must be non-empty and each channel must have at least one recipient - Add tests for valid nudge channels and empty recipient validation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
committed by
Steve Yegge
parent
d28ba6e2c6
commit
d94fb4669b
@@ -629,6 +629,9 @@ func validateMessagingConfig(c *MessagingConfig) error {
|
||||
if c.Announces == nil {
|
||||
c.Announces = make(map[string]AnnounceConfig)
|
||||
}
|
||||
if c.NudgeChannels == nil {
|
||||
c.NudgeChannels = make(map[string][]string)
|
||||
}
|
||||
|
||||
// Validate lists have at least one recipient
|
||||
for name, recipients := range c.Lists {
|
||||
@@ -657,6 +660,16 @@ func validateMessagingConfig(c *MessagingConfig) error {
|
||||
}
|
||||
}
|
||||
|
||||
// Validate nudge channels have non-empty names and at least one recipient
|
||||
for name, recipients := range c.NudgeChannels {
|
||||
if name == "" {
|
||||
return fmt.Errorf("%w: nudge channel name cannot be empty", ErrMissingField)
|
||||
}
|
||||
if len(recipients) == 0 {
|
||||
return fmt.Errorf("%w: nudge channel '%s' has no recipients", ErrMissingField, name)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user