Skip to content

Commit

Permalink
add location field
Browse files Browse the repository at this point in the history
  • Loading branch information
feijooso committed Apr 1, 2024
1 parent 3bc7d6e commit 7933404
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
13 changes: 7 additions & 6 deletions app/docker/tablas.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ CREATE TABLE IF NOT EXISTS users_service.users (
name VARCHAR(255),
email VARCHAR(255) UNIQUE NOT NULL,
gender VARCHAR(20),
photo VARCHAR(255)
photo VARCHAR(255),
location JSONB
);

INSERT INTO
users_service.users (name, email)
VALUES ('Agus', 'agus@fi.uba.ar'),
('Pach', 'pach@fi.uba.ar'),
('Sofi', 'sofi@fi.uba.ar'),
('Violeta', 'violeta@fi.uba.ar');
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}');
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
from sqlalchemy import Column, Integer, String, JSON
from models.database import Base
from os import environ

Expand All @@ -13,3 +13,4 @@ class User(Base):
email = Column(String, nullable=False)
gender = Column(String, nullable=True)
photo = Column(String, nullable=True)
location = Column(JSON, nullable=True)
3 changes: 2 additions & 1 deletion app/schemas/Schemas.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from pydantic import BaseModel

from typing import Dict

class UserSchema(BaseModel):
id: int
name: str
email: str
gender: str
photo: str
location: Dict


class CreateUserSchema(BaseModel):
Expand Down

0 comments on commit 7933404

Please sign in to comment.