Skip to content

Commit

Permalink
fixup! [web] Use webargs instead of flask_restful.reqparse
Browse files Browse the repository at this point in the history
  • Loading branch information
FestplattenSchnitzel committed Sep 29, 2023
1 parent de88197 commit 41461f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion pycroft/lib/swdd.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import hmac
import os
import unicodedata
from datetime import date

from sqlalchemy import func

Expand All @@ -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
Expand Down
9 changes: 5 additions & 4 deletions web/api/v0/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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),
},
Expand All @@ -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:
Expand Down Expand Up @@ -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),
Expand All @@ -621,7 +622,7 @@ def get(
def post(
self,
first_name: str,
birthdate: str,
birthdate: date,
email: str,
password: str,
login: str,
Expand Down

0 comments on commit 41461f3

Please sign in to comment.