Additional check if channel number is in use before creating.

This commit is contained in:
SergeantPanda 2025-09-14 13:34:03 -05:00
parent 6c1dbff91c
commit a1d35a8dad
2 changed files with 2 additions and 7 deletions

View file

@ -623,12 +623,7 @@ class ChannelViewSet(viewsets.ModelViewSet):
)
# If the provided number is already used, return an error.
if Channel.objects.filter(channel_number=channel_number).exists():
return Response(
{
"error": f"Channel number {channel_number} is already in use. Please choose a different number."
},
status=status.HTTP_400_BAD_REQUEST,
)
channel_number = Channel.get_next_available_channel_number(channel_number)
# Get the tvc_guide_stationid from custom properties if it exists
tvc_guide_stationid = None
if "tvc-guide-stationid" in stream_custom_props:

View file

@ -553,7 +553,7 @@ export const WebsocketProvider = ({ children }) => {
// General notification for channel creation
notifications.show({
title: 'Channels Created',
message: `Successfully created ${parsedEvent.data.count || 'multiple'} channels`,
message: `Successfully created ${parsedEvent.data.count || 'multiple'} channel(s)`,
color: 'green',
autoClose: 4000,
});