Skip to content

Commit

Permalink
Move validators to tilavarauspalvelu directory
Browse files Browse the repository at this point in the history
  • Loading branch information
matti-lamppu committed Jan 7, 2025
1 parent f9533cd commit 8af7329
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pytest
from django.core.exceptions import ValidationError

from tilavarauspalvelu.utils.validators import is_numeric, validate_accounting_project
from tilavarauspalvelu.validators import is_numeric, validate_accounting_project


def test_is_numeric():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_utils/test_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from graphene_django_extensions.testing.utils import parametrize_helper

from tilavarauspalvelu.typing import TimeSlot
from tilavarauspalvelu.utils.validators import validate_reservable_times_begin_end, validate_reservable_times_overlap
from tilavarauspalvelu.validators import validate_reservable_times_begin_end, validate_reservable_times_overlap

if TYPE_CHECKING:
from collections.abc import Collection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from tilavarauspalvelu.enums import WeekdayChoice
from tilavarauspalvelu.models import ApplicationRoundTimeSlot
from tilavarauspalvelu.utils.validators import validate_string_time
from tilavarauspalvelu.validators import validate_string_time


def remove_empty_timeslots(timeslots: list[dict[str, str]]) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from graphene_django_extensions import NestingModelSerializer

from tilavarauspalvelu.models import ApplicationRoundTimeSlot
from tilavarauspalvelu.utils.validators import (
from tilavarauspalvelu.validators import (
TimeSlotSerializer,
validate_reservable_times_begin_end,
validate_reservable_times_overlap,
Expand Down
18 changes: 10 additions & 8 deletions tilavarauspalvelu/migrations/0005_migrate_merchants.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from __future__ import annotations

import django.db.models.deletion
from django.db import migrations, models

import tilavarauspalvelu.utils.validators
import tilavarauspalvelu.validators


class Migration(migrations.Migration):
Expand All @@ -21,11 +23,11 @@ class Migration(migrations.Migration):
("name", models.CharField(max_length=128)),
(
"company_code",
models.CharField(max_length=4, validators=[tilavarauspalvelu.utils.validators.is_numeric]),
models.CharField(max_length=4, validators=[tilavarauspalvelu.validators.is_numeric]),
),
(
"main_ledger_account",
models.CharField(max_length=6, validators=[tilavarauspalvelu.utils.validators.is_numeric]),
models.CharField(max_length=6, validators=[tilavarauspalvelu.validators.is_numeric]),
),
("vat_code", models.CharField(max_length=2)),
(
Expand All @@ -34,7 +36,7 @@ class Migration(migrations.Migration):
blank=True,
default="",
max_length=10,
validators=[tilavarauspalvelu.utils.validators.is_numeric],
validators=[tilavarauspalvelu.validators.is_numeric],
),
),
(
Expand All @@ -43,7 +45,7 @@ class Migration(migrations.Migration):
blank=True,
default="",
max_length=7,
validators=[tilavarauspalvelu.utils.validators.is_numeric],
validators=[tilavarauspalvelu.validators.is_numeric],
),
),
(
Expand All @@ -53,8 +55,8 @@ class Migration(migrations.Migration):
default="",
max_length=16,
validators=[
tilavarauspalvelu.utils.validators.validate_accounting_project,
tilavarauspalvelu.utils.validators.is_numeric,
tilavarauspalvelu.validators.validate_accounting_project,
tilavarauspalvelu.validators.is_numeric,
],
),
),
Expand All @@ -64,7 +66,7 @@ class Migration(migrations.Migration):
blank=True,
default="",
max_length=6,
validators=[tilavarauspalvelu.utils.validators.is_numeric],
validators=[tilavarauspalvelu.validators.is_numeric],
),
),
("balance_profit_center", models.CharField(max_length=10)),
Expand Down
8 changes: 5 additions & 3 deletions tilavarauspalvelu/migrations/0013_migrate_applications.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import datetime

import django.contrib.postgres.fields
Expand All @@ -9,7 +11,7 @@

import tilavarauspalvelu.enums
import tilavarauspalvelu.models.organisation.model
import tilavarauspalvelu.utils.validators
import tilavarauspalvelu.validators
import utils.fields.model


Expand Down Expand Up @@ -480,7 +482,7 @@ class Migration(migrations.Migration):
blank=True,
default=list,
size=None,
validators=[tilavarauspalvelu.utils.validators.validate_reservable_times],
validators=[tilavarauspalvelu.validators.validate_reservable_times],
),
),
(
Expand Down Expand Up @@ -724,7 +726,7 @@ class Migration(migrations.Migration):
),
name="durations_multiple_of_30_minutes_max_24_hours",
violation_error_message=(
"Reservation min and max durations must be multiples of 30 minutes, " "up to a maximum of 24 hours."
"Reservation min and max durations must be multiples of 30 minutes, up to a maximum of 24 hours."
),
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from django.utils.translation import gettext_lazy as _

from tilavarauspalvelu.enums import WeekdayChoice
from tilavarauspalvelu.utils.validators import validate_reservable_times
from tilavarauspalvelu.validators import validate_reservable_times
from utils.fields.model import IntChoiceField

from .queryset import ApplicationRoundTimeSlotManager
Expand Down
2 changes: 1 addition & 1 deletion tilavarauspalvelu/models/payment_accounting/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from django.db import models
from django.utils.translation import gettext_lazy as _

from tilavarauspalvelu.utils.validators import is_numeric, validate_accounting_project
from tilavarauspalvelu.validators import is_numeric, validate_accounting_project

from .queryset import PaymentAccountingManager

Expand Down
Empty file.
File renamed without changes.

0 comments on commit 8af7329

Please sign in to comment.