chore: build
This commit is contained in:
@@ -23,13 +23,12 @@ func (s *Service) Get(ctx context.Context) (*Settings, error) {
|
||||
// Update persists the settings. botToken == "" means "leave the currently
|
||||
// stored token untouched" -- the admin never has to re-type the secret just
|
||||
// to flip a checkbox, and the API never has to echo it back.
|
||||
func (s *Service) Update(ctx context.Context, enabled bool, botToken, chatID string, notifyNewOrder, notifyStatusChange bool) (*Settings, error) {
|
||||
func (s *Service) Update(ctx context.Context, enabled bool, botToken, chatID string, notifyNewOrder bool) (*Settings, error) {
|
||||
settings := &Settings{
|
||||
Enabled: enabled,
|
||||
BotToken: botToken,
|
||||
ChatID: chatID,
|
||||
NotifyNewOrder: notifyNewOrder,
|
||||
NotifyStatusChange: notifyStatusChange,
|
||||
Enabled: enabled,
|
||||
BotToken: botToken,
|
||||
ChatID: chatID,
|
||||
NotifyNewOrder: notifyNewOrder,
|
||||
}
|
||||
if err := s.repo.Update(ctx, settings); err != nil {
|
||||
return nil, err
|
||||
@@ -56,10 +55,6 @@ func (s *Service) NotifyNewOrder(ctx context.Context, summary string) {
|
||||
s.notify(ctx, func(st *Settings) bool { return st.NotifyNewOrder }, summary)
|
||||
}
|
||||
|
||||
func (s *Service) NotifyOrderStatusChange(ctx context.Context, summary string) {
|
||||
s.notify(ctx, func(st *Settings) bool { return st.NotifyStatusChange }, summary)
|
||||
}
|
||||
|
||||
func (s *Service) notify(ctx context.Context, shouldSend func(*Settings) bool, text string) {
|
||||
settings, err := s.repo.Get(ctx)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user