Skip to content
Snippets Groups Projects
Commit e5257db2 authored by Konrad Mohrfeldt's avatar Konrad Mohrfeldt :koala:
Browse files

refactor: move ProgramEntry into models

parent 261e297c
No related branches found
No related tags found
1 merge request!52new program endpoint
......@@ -17,6 +17,9 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import dataclasses
import datetime
import jsonschema
from rest_framework.exceptions import ValidationError
from versatileimagefield.fields import PPOIField, VersatileImageField
......@@ -687,3 +690,12 @@ class RadioSettings(models.Model):
def __str__(self):
return self.station_name
@dataclasses.dataclass()
class ProgramEntry:
id: str
start: datetime.datetime
end: datetime.datetime
show: Show
timeslot: TimeSlot | None
......@@ -20,7 +20,6 @@
import copy
from collections.abc import Iterator
from datetime import datetime, time, timedelta
from typing import TypedDict
from dateutil.relativedelta import relativedelta
from dateutil.rrule import rrule
......@@ -33,6 +32,7 @@ from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from program.models import (
Note,
ProgramEntry,
RadioSettings,
RRule,
Schedule,
......@@ -699,14 +699,6 @@ def generate_conflicts(timeslots: list[TimeSlot]) -> Conflicts:
return conflicts
class ProgramEntry(TypedDict):
id: str
start: datetime
end: datetime
show: Show
timeslot: TimeSlot | None
def generate_program_entries(
queryset: QuerySet[TimeSlot],
*,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment