oncall-engine/engine/apps/api/serializers/slack_channel.py
Joey Orlando 686ebbfb37
chore: fix some minor issues with recent slack_channel changes (#5228)
# What this PR does

Follow up PR to https://github.com/grafana/oncall/pull/5199 and
https://github.com/grafana/oncall/pull/5224, addresses a few issues I
noticed on dev while testing the feature

## 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-05 04:51:04 -05:00

21 lines
550 B
Python

import typing
from rest_framework import serializers
from apps.slack.models import SlackChannel
class SlackChannelDetails(typing.TypedDict):
display_name: str
slack_id: str
id: str
class SlackChannelSerializer(serializers.ModelSerializer):
id = serializers.CharField(read_only=True, source="public_primary_key")
display_name = serializers.CharField(source="name")
class Meta:
model = SlackChannel
fields = ["id", "display_name", "slack_id"]
read_only_fields = ["id", "display_name", "slack_id"]