Skip to content

Commit

Permalink
add birthdate to user
Browse files Browse the repository at this point in the history
  • Loading branch information
feijooso committed Apr 2, 2024
1 parent 266fbb1 commit bb86c43
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
11 changes: 6 additions & 5 deletions app/docker/tablas.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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}');
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}');
3 changes: 2 additions & 1 deletion app/models/users.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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)
2 changes: 2 additions & 0 deletions app/schemas/Schemas.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from pydantic import BaseModel
from typing import Dict
from datetime import date


class UserSchema(BaseModel):
Expand All @@ -8,6 +9,7 @@ class UserSchema(BaseModel):
email: str
gender: str
photo: str
birthdate: date
location: Dict


Expand Down
1 change: 0 additions & 1 deletion app/service/Users.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit bb86c43

Please sign in to comment.