From 3cb52c4fbebb822a7ec3e95a7fb05dc02982aff9 Mon Sep 17 00:00:00 2001 From: tehtbl <3999809+tehtbl@users.noreply.github.com> Date: Fri, 6 Dec 2019 13:17:28 +0100 Subject: [PATCH] fixing multiple issues in the backend when being used as a template in cookiecutter --- .../backend/app/app/api/api_v1/endpoints/users.py | 2 +- .../backend/app/app/api/api_v1/endpoints/utils.py | 2 +- {{cookiecutter.project_slug}}/backend/app/app/crud/utils.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/{{cookiecutter.project_slug}}/backend/app/app/api/api_v1/endpoints/users.py b/{{cookiecutter.project_slug}}/backend/app/app/api/api_v1/endpoints/users.py index 3526bdd..649714b 100644 --- a/{{cookiecutter.project_slug}}/backend/app/app/api/api_v1/endpoints/users.py +++ b/{{cookiecutter.project_slug}}/backend/app/app/api/api_v1/endpoints/users.py @@ -1,7 +1,7 @@ from typing import List from fastapi import APIRouter, Body, Depends, HTTPException -from pydantic.types import EmailStr +from pydantic.networks import EmailStr from app import crud from app.api.utils.security import get_current_active_superuser, get_current_active_user diff --git a/{{cookiecutter.project_slug}}/backend/app/app/api/api_v1/endpoints/utils.py b/{{cookiecutter.project_slug}}/backend/app/app/api/api_v1/endpoints/utils.py index cc43abe..308a527 100644 --- a/{{cookiecutter.project_slug}}/backend/app/app/api/api_v1/endpoints/utils.py +++ b/{{cookiecutter.project_slug}}/backend/app/app/api/api_v1/endpoints/utils.py @@ -1,5 +1,5 @@ from fastapi import APIRouter, Depends -from pydantic.types import EmailStr +from pydantic.networks import EmailStr from app.api.utils.security import get_current_active_superuser from app.core.celery_app import celery_app diff --git a/{{cookiecutter.project_slug}}/backend/app/app/crud/utils.py b/{{cookiecutter.project_slug}}/backend/app/app/crud/utils.py index dd22f93..4295a99 100644 --- a/{{cookiecutter.project_slug}}/backend/app/app/crud/utils.py +++ b/{{cookiecutter.project_slug}}/backend/app/app/crud/utils.py @@ -7,7 +7,7 @@ from couchbase.n1ql import CONSISTENCY_REQUEST, N1QLQuery from fastapi.encoders import jsonable_encoder from pydantic import BaseModel -from pydantic.fields import Field, Shape +from pydantic.fields import Field, SHAPE_LIST, SHAPE_SET, SHAPE_TUPLE from app.core import config @@ -85,7 +85,7 @@ def search_results_to_model( field: Field = doc_model.__fields__[key] if not value: value = None - elif field.shape in {Shape.LIST, Shape.SET, Shape.TUPLE} and not isinstance( + elif field.shape in {SHAPE_LIST, SHAPE_SET, SHAPE_TUPLE} and not isinstance( value, list ): value = [value]