Chore: rename Id to ID in alert notification models (#62868)
This commit is contained in:
@@ -80,7 +80,7 @@ func (dc *NotificationProvisioner) deleteNotifications(ctx context.Context, noti
|
||||
notification.OrgID = 1
|
||||
}
|
||||
|
||||
getNotification := &models.GetAlertNotificationsWithUidQuery{Uid: notification.UID, OrgId: notification.OrgID}
|
||||
getNotification := &models.GetAlertNotificationsWithUidQuery{UID: notification.UID, OrgID: notification.OrgID}
|
||||
|
||||
res, err := dc.alertingManager.GetAlertNotificationsWithUid(ctx, getNotification)
|
||||
if err != nil {
|
||||
@@ -88,7 +88,7 @@ func (dc *NotificationProvisioner) deleteNotifications(ctx context.Context, noti
|
||||
}
|
||||
|
||||
if res != nil {
|
||||
cmd := &models.DeleteAlertNotificationWithUidCommand{Uid: res.Uid, OrgId: getNotification.OrgId}
|
||||
cmd := &models.DeleteAlertNotificationWithUidCommand{UID: res.UID, OrgID: getNotification.OrgID}
|
||||
if err := dc.alertingManager.DeleteAlertNotificationWithUid(ctx, cmd); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -111,7 +111,7 @@ func (dc *NotificationProvisioner) mergeNotifications(ctx context.Context, notif
|
||||
notification.OrgID = 1
|
||||
}
|
||||
|
||||
cmd := &models.GetAlertNotificationsWithUidQuery{OrgId: notification.OrgID, Uid: notification.UID}
|
||||
cmd := &models.GetAlertNotificationsWithUidQuery{OrgID: notification.OrgID, UID: notification.UID}
|
||||
res, err := dc.alertingManager.GetAlertNotificationsWithUid(ctx, cmd)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -120,13 +120,13 @@ func (dc *NotificationProvisioner) mergeNotifications(ctx context.Context, notif
|
||||
if res == nil {
|
||||
dc.log.Debug("inserting alert notification from configuration", "name", notification.Name, "uid", notification.UID)
|
||||
insertCmd := &models.CreateAlertNotificationCommand{
|
||||
Uid: notification.UID,
|
||||
UID: notification.UID,
|
||||
Name: notification.Name,
|
||||
Type: notification.Type,
|
||||
IsDefault: notification.IsDefault,
|
||||
Settings: notification.SettingsToJSON(),
|
||||
SecureSettings: notification.SecureSettings,
|
||||
OrgId: notification.OrgID,
|
||||
OrgID: notification.OrgID,
|
||||
DisableResolveMessage: notification.DisableResolveMessage,
|
||||
Frequency: notification.Frequency,
|
||||
SendReminder: notification.SendReminder,
|
||||
@@ -139,13 +139,13 @@ func (dc *NotificationProvisioner) mergeNotifications(ctx context.Context, notif
|
||||
} else {
|
||||
dc.log.Debug("updating alert notification from configuration", "name", notification.Name)
|
||||
updateCmd := &models.UpdateAlertNotificationWithUidCommand{
|
||||
Uid: notification.UID,
|
||||
UID: notification.UID,
|
||||
Name: notification.Name,
|
||||
Type: notification.Type,
|
||||
IsDefault: notification.IsDefault,
|
||||
Settings: notification.SettingsToJSON(),
|
||||
SecureSettings: notification.SecureSettings,
|
||||
OrgId: notification.OrgID,
|
||||
OrgID: notification.OrgID,
|
||||
DisableResolveMessage: notification.DisableResolveMessage,
|
||||
Frequency: notification.Frequency,
|
||||
SendReminder: notification.SendReminder,
|
||||
|
||||
@@ -151,7 +151,7 @@ func TestNotificationAsConfig(t *testing.T) {
|
||||
t.Run("no notification in database", func(t *testing.T) {
|
||||
setup()
|
||||
fakeAlertNotification := &fakeAlertNotification{}
|
||||
fakeAlertNotification.ExpectedAlertNotification = &models.AlertNotification{OrgId: 1}
|
||||
fakeAlertNotification.ExpectedAlertNotification = &models.AlertNotification{OrgID: 1}
|
||||
dc := newNotificationProvisioner(orgService, fakeAlertNotification, encryptionService, nil, logger)
|
||||
|
||||
err := dc.applyChanges(context.Background(), twoNotificationsConfig)
|
||||
@@ -164,14 +164,14 @@ func TestNotificationAsConfig(t *testing.T) {
|
||||
setup()
|
||||
existingNotificationCmd := models.CreateAlertNotificationCommand{
|
||||
Name: "channel1",
|
||||
OrgId: 1,
|
||||
Uid: "notifier1",
|
||||
OrgID: 1,
|
||||
UID: "notifier1",
|
||||
Type: "slack",
|
||||
}
|
||||
res, err := ns.SQLStore.CreateAlertNotificationCommand(context.Background(), &existingNotificationCmd)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, res)
|
||||
notificationsQuery := models.GetAllAlertNotificationsQuery{OrgId: 1}
|
||||
notificationsQuery := models.GetAllAlertNotificationsQuery{OrgID: 1}
|
||||
results, err := ns.SQLStore.GetAllAlertNotifications(context.Background(), ¬ificationsQuery)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, results)
|
||||
@@ -201,22 +201,22 @@ func TestNotificationAsConfig(t *testing.T) {
|
||||
setup()
|
||||
existingNotificationCmd := models.CreateAlertNotificationCommand{
|
||||
Name: "channel0",
|
||||
OrgId: 1,
|
||||
Uid: "notifier0",
|
||||
OrgID: 1,
|
||||
UID: "notifier0",
|
||||
Type: "slack",
|
||||
}
|
||||
_, err := ns.SQLStore.CreateAlertNotificationCommand(context.Background(), &existingNotificationCmd)
|
||||
require.NoError(t, err)
|
||||
existingNotificationCmd = models.CreateAlertNotificationCommand{
|
||||
Name: "channel3",
|
||||
OrgId: 1,
|
||||
Uid: "notifier3",
|
||||
OrgID: 1,
|
||||
UID: "notifier3",
|
||||
Type: "slack",
|
||||
}
|
||||
_, err = ns.SQLStore.CreateAlertNotificationCommand(context.Background(), &existingNotificationCmd)
|
||||
require.NoError(t, err)
|
||||
|
||||
notificationsQuery := models.GetAllAlertNotificationsQuery{OrgId: 1}
|
||||
notificationsQuery := models.GetAllAlertNotificationsQuery{OrgID: 1}
|
||||
res, err := ns.GetAllAlertNotifications(context.Background(), ¬ificationsQuery)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, res)
|
||||
@@ -237,8 +237,8 @@ func TestNotificationAsConfig(t *testing.T) {
|
||||
|
||||
existingNotificationCmd := models.CreateAlertNotificationCommand{
|
||||
Name: "default-notification-delete",
|
||||
OrgId: 1,
|
||||
Uid: "notifier2",
|
||||
OrgID: 1,
|
||||
UID: "notifier2",
|
||||
Type: "slack",
|
||||
}
|
||||
_, err := ns.SQLStore.CreateAlertNotificationCommand(context.Background(), &existingNotificationCmd)
|
||||
@@ -272,7 +272,7 @@ func TestNotificationAsConfig(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("applyChanges return an error %v", err)
|
||||
}
|
||||
notificationsQuery := models.GetAllAlertNotificationsQuery{OrgId: 1}
|
||||
notificationsQuery := models.GetAllAlertNotificationsQuery{OrgID: 1}
|
||||
res, err := ns.GetAllAlertNotifications(context.Background(), ¬ificationsQuery)
|
||||
require.NoError(t, err)
|
||||
require.Empty(t, res)
|
||||
|
||||
Reference in New Issue
Block a user