diff --git a/pycroft/lib/swdd.py b/pycroft/lib/swdd.py index c8e3b90d8..dcfd6fb97 100644 --- a/pycroft/lib/swdd.py +++ b/pycroft/lib/swdd.py @@ -5,6 +5,7 @@ import hmac import os import unicodedata +from datetime import date from sqlalchemy import func @@ -13,7 +14,7 @@ swdd_hmac_key = os.environ.get('SWDD_HASH_KEY') -def get_swdd_person_id(first_name: str, last_name: str, birthdate: str) -> int | None: +def get_swdd_person_id(first_name: str, last_name: str, birthdate: date) -> int | None: """ Builds a hmac hash from the given parameters and searches for a match in the Tenancy view diff --git a/web/api/v0/__init__.py b/web/api/v0/__init__.py index 8b7e1ee7f..c8f1e0f81 100644 --- a/web/api/v0/__init__.py +++ b/web/api/v0/__init__.py @@ -2,6 +2,7 @@ from decimal import Decimal from datetime import timedelta, datetime, date from functools import wraps +from ipaddress import IPv4Address, IPv6Address from flask import jsonify, current_app, Response from flask.typing import ResponseReturnValue @@ -529,7 +530,7 @@ class RegistrationResource(Resource): { "first_name": fields.Str(required=True), "last_name": fields.Str(required=True), - "birthdate": fields.Str(required=True), + "birthdate": fields.Date(required=True), "person_id": fields.Int(required=True), "previous_dorm": fields.Str(required=False), }, @@ -539,7 +540,7 @@ def get( self, first_name: str, last_name: str, - birthdate: str, + birthdate: date, person_id: int, previous_dorm: str | None = None, ) -> ResponseReturnValue: @@ -607,7 +608,7 @@ def get( { "first_name": fields.Str(required=True), "last_name": fields.Str(required=False), - "birthdate": fields.Str(required=True), + "birthdate": fields.Date(required=True), "email": fields.Str(required=True), "password": fields.Str(required=True), "login": fields.Str(required=True), @@ -621,7 +622,7 @@ def get( def post( self, first_name: str, - birthdate: str, + birthdate: date, email: str, password: str, login: str,