oncall-engine/engine/apps/alerts/tasks
Joey Orlando 4a5c4263e0
feat: convert schedule.channel (char field) to schedule.slack_channel (foreign key) (#5199)
# What this PR does

`OnCallSchedule` equivalent of
https://github.com/grafana/oncall/pull/5191.

**NOTE**: merge after https://github.com/grafana/oncall/pull/5224 (so
that I can use some of the new serializer fields defined in there)

### Migration
```bash
Running migrations:                                                                                                                                                                                                │
│ source=engine:app google_trace_id=none logger=apps.schedules.migrations.0019_auto_20241021_1735 Starting migration to populate slack_channel field.                                                                │
│ source=engine:app google_trace_id=none logger=apps.schedules.migrations.0019_auto_20241021_1735 Total schedules to process: 1                                                                                      │
│ source=engine:app google_trace_id=none logger=apps.schedules.migrations.0019_auto_20241021_1735 Schedule 26 updated with SlackChannel 2 (slack_id: C043LL6RTS7).                                                   │
│ source=engine:app google_trace_id=none logger=apps.schedules.migrations.0019_auto_20241021_1735 Bulk updated 1 OnCallSchedules with their Slack channel.                                                           │
│ source=engine:app google_trace_id=none logger=apps.schedules.migrations.0019_auto_20241021_1735 Finished migration. Total schedules processed: 1. Schedules updated: 1. Missing SlackChannels: 0.                  │
│   Applying schedules.0019_auto_20241021_1735... OK
```

### Tested Public API
```txt
POST {{oncall_host}}/api/v1/schedules/
Authorization: {{oncall_api_key}}
Content-Type: application/json

{
    "name": "Demo testy testy2",
    "type": "web",
    "time_zone": "America/Los_Angeles",
    "slack": {
        "channel_id": "C05PPLYN1U1"
    }
}

HTTP/1.1 201 Created
Content-Type: application/json
Vary: Accept, Origin
Allow: GET, POST, HEAD, OPTIONS
X-Frame-Options: DENY
Content-Length: 198
X-Content-Type-Options: nosniff
Referrer-Policy: same-origin
Cross-Origin-Opener-Policy: same-origin

{
  "id": "SBBN73UTUTVCE",
  "team_id": null,
  "name": "Demo testy testy2",
  "time_zone": "America/Los_Angeles",
  "on_call_now": [],
  "shifts": [],
  "slack": {
    "channel_id": "C05PPLYN1U1",
    "user_group_id": null
  },
  "type": "web"
}
```

### Tested via UI (eg; internal API)

https://www.loom.com/share/e66bf3468b144dd782da5eb6e0bfd0af

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
2024-11-04 14:27:21 -05:00
..
__init__.py Reworked declare incident escalation step (#5130) 2024-10-07 19:26:10 +00:00
acknowledge_reminder.py Fix acknowledge reminder task (#5179) 2024-10-16 12:13:28 +00:00
alert_group_web_title_cache.py remove references to AlertGroup.is_archived and AlertGroup.unarchived_objects (#2524) 2023-07-18 11:48:34 +00:00
call_ack_url.py apps.get_model -> import (#2619) 2023-07-25 09:43:23 +00:00
check_escalation_finished.py Update escalation auditor logs to expose succeeding count (#4431) 2024-05-31 18:29:31 +00:00
compare_escalations.py World, meet OnCall! 2022-06-03 08:09:47 -06:00
custom_webhook_result.py Add escalation chain support for new webhooks (#1654) 2023-04-05 12:03:55 +00:00
declare_incident.py chore: convert two slack channel ID char fields to foreign keys (#5224) 2024-11-04 13:34:06 -05:00
delete_alert_group.py Add transaction on_commit before signals for alert group actions (#3731) 2024-01-31 15:54:50 -07:00
distribute_alert.py Handle alert group deleted when task is already queued (#4230) 2024-04-16 14:39:00 +00:00
escalate_alert_group.py Update transaction.on_commit to use partial instead of lambda (#3448) 2023-11-29 12:01:30 +00:00
invite_user_to_join_incident.py apps.get_model -> import (#2619) 2023-07-25 09:43:23 +00:00
maintenance.py Update transaction.on_commit to use partial instead of lambda (#3448) 2023-11-29 12:01:30 +00:00
notify_all.py Fix order filtering when executing notify all/group steps from snapshot (#4381) 2024-05-23 12:36:28 +00:00
notify_group.py chore: convert two slack channel ID char fields to foreign keys (#5224) 2024-11-04 13:34:06 -05:00
notify_ical_schedule_shift.py feat: convert schedule.channel (char field) to schedule.slack_channel (foreign key) (#5199) 2024-11-04 14:27:21 -05:00
notify_user.py Reschedule rate limited telegram task instead of retry (#5178) 2024-10-15 13:35:54 +00:00
resolve_alert_group_by_source_if_needed.py Minor formatting changes (#2641) 2023-07-26 14:45:44 +01:00
resolve_by_last_step.py apps.get_model -> import (#2619) 2023-07-25 09:43:23 +00:00
send_alert_group_signal.py Add transaction on_commit before signals for alert group actions (#3731) 2024-01-31 15:54:50 -07:00
send_update_log_report_signal.py Fix task retries for deleted alert groups (#3553) 2023-12-12 12:01:47 +00:00
send_update_resolution_note_signal.py apps.get_model -> import (#2619) 2023-07-25 09:43:23 +00:00
sync_grafana_alerting_contact_points.py Remove deprecated alerting integration tasks (#2944) 2023-09-01 13:11:02 +00:00
task_logger.py World, meet OnCall! 2022-06-03 08:09:47 -06:00
unsilence.py Update transaction.on_commit to use partial instead of lambda (#3448) 2023-11-29 12:01:30 +00:00
wipe.py Improve alert group deletion API (#3124) 2023-10-05 14:32:40 +01:00