oncall-engine/engine/apps/public_api/serializers/teams.py
Joey Orlando 51c72fcea2
feat: add Grafana IDs to users and teams public API endpoints (#5075)
# What this PR does

- add Grafana IDs to users and teams public API endpoints
- update Schedules public API docs to reflect the fact that [we allow
filtering by
`team_id`](https://github.com/grafana/oncall/blob/dev/engine/apps/public_api/views/schedules.py#L42)

## 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-09-24 19:16:22 +00:00

18 lines
468 B
Python

from rest_framework import serializers
from apps.user_management.models import Team
class TeamSerializer(serializers.ModelSerializer):
id = serializers.CharField(read_only=True, source="public_primary_key")
grafana_id = serializers.IntegerField(read_only=True, source="team_id")
class Meta:
model = Team
fields = [
"id",
"grafana_id",
"name",
"email",
"avatar_url",
]