diff --git a/app/docker/tablas.sql b/app/docker/tablas.sql index 697f94f..a649ed8 100644 --- a/app/docker/tablas.sql +++ b/app/docker/tablas.sql @@ -6,12 +6,13 @@ CREATE TABLE IF NOT EXISTS users_service.users ( email VARCHAR(255) UNIQUE NOT NULL, gender VARCHAR(20), photo VARCHAR(255), + birthdate DATE, location JSONB ); INSERT INTO - users_service.users (name, email, location) -VALUES ('Agus', 'agus@fi.uba.ar', '{"lat": 20, "long": 100}'), - ('Pach', 'pach@fi.uba.ar','{"lat": 10, "long": 200}'), - ('Sofi', 'sofi@fi.uba.ar', '{"lat": 1190, "long": 500}'), - ('Violeta', 'violeta@fi.uba.ar', '{"lat": 330, "long": 2333}'); \ No newline at end of file + users_service.users (name, email, birthdate, location) +VALUES ('Agus', 'agus@fi.uba.ar', TO_DATE('1999-01-29', 'YYYY-MM-DD'), '{"lat": 20, "long": 100}'), + ('Pach', 'pach@fi.uba.ar', TO_DATE('1999-08-06', 'YYYY-MM-DD'), '{"lat": 10, "long": 200}'), + ('Sofi', 'sofi@fi.uba.ar', TO_DATE('1998-04-26', 'YYYY-MM-DD'), '{"lat": 1190, "long": 500}'), + ('Violeta', 'violeta@fi.uba.ar', TO_DATE('1998-05-12', 'YYYY-MM-DD'), '{"lat": 330, "long": 2333}'); \ No newline at end of file diff --git a/app/models/users.py b/app/models/users.py index 443a9da..cc63fbf 100644 --- a/app/models/users.py +++ b/app/models/users.py @@ -1,4 +1,4 @@ -from sqlalchemy import Column, Integer, String, JSON +from sqlalchemy import Column, Integer, String, JSON, Date from models.database import Base from os import environ @@ -13,4 +13,5 @@ class User(Base): email = Column(String, nullable=False) gender = Column(String, nullable=True) photo = Column(String, nullable=True) + birthdate = Column(Date, nullable=True) location = Column(JSON, nullable=True) diff --git a/app/schemas/Schemas.py b/app/schemas/Schemas.py index 31d5f05..852db1b 100644 --- a/app/schemas/Schemas.py +++ b/app/schemas/Schemas.py @@ -1,5 +1,6 @@ from pydantic import BaseModel from typing import Dict +from datetime import date class UserSchema(BaseModel): @@ -8,6 +9,7 @@ class UserSchema(BaseModel): email: str gender: str photo: str + birthdate: date location: Dict diff --git a/app/service/Users.py b/app/service/Users.py index 14d1efe..a6d8164 100644 --- a/app/service/Users.py +++ b/app/service/Users.py @@ -29,7 +29,6 @@ def login(self, auth_code: str): raise AuthenticationError("Authentication code is invalid") user_info = self._get_user_info(access_token) - print(user_info) user = self.user_repository.get_user_by_email(user_info["email"]) if user is None: