Spaces:
Sleeping
Sleeping
Shri
commited on
Commit
·
ce1e080
1
Parent(s):
0c8dccb
database connection
Browse files- src/auth/config.py +6 -0
- src/auth/constants.py +2 -0
- src/auth/dependencies.py +0 -0
- src/auth/exceptions.py +0 -0
- src/auth/models.py +2 -0
- src/auth/router.py +0 -0
- src/auth/schemas.py +0 -0
- src/auth/service.py +2 -0
- src/auth/utils.py +0 -0
- src/chatbot/config.py +6 -0
- src/chatbot/constants.py +2 -0
- src/chatbot/dependencies.py +0 -0
- src/chatbot/exceptions.py +0 -0
- src/chatbot/models.py +2 -0
- src/chatbot/router.py +0 -0
- src/chatbot/schemas.py +0 -0
- src/chatbot/service.py +2 -0
- src/chatbot/utils.py +0 -0
- src/core/database.py +10 -0
- src/core/insert_sample.py +40 -0
- src/core/models.py +25 -0
- src/feed/config.py +6 -0
- src/feed/constants.py +2 -0
- src/feed/dependencies.py +0 -0
- src/feed/exceptions.py +0 -0
- src/feed/models.py +2 -0
- src/feed/router.py +0 -0
- src/feed/schemas.py +0 -0
- src/feed/service.py +2 -0
- src/feed/utils.py +0 -0
- src/profile/config.py +6 -0
- src/profile/constants.py +2 -0
- src/profile/dependencies.py +0 -0
- src/profile/exceptions.py +0 -0
- src/profile/models.py +2 -0
- src/profile/router.py +0 -0
- src/profile/schemas.py +0 -0
- src/profile/service.py +2 -0
- src/profile/utils.py +0 -0
src/auth/config.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pydantic import BaseSettings
|
| 2 |
+
|
| 3 |
+
class HomeSettings(BaseSettings):
|
| 4 |
+
FEATURE_ENABLED: bool = True
|
| 5 |
+
|
| 6 |
+
home_settings = HomeSettings()
|
src/auth/constants.py
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
WELCOME_MESSAGE = "Welcome to Yuvabe's Home Screen"
|
| 2 |
+
EXIT_MESSAGE = "Thank You have a wonderful day"
|
src/auth/dependencies.py
ADDED
|
File without changes
|
src/auth/exceptions.py
ADDED
|
File without changes
|
src/auth/models.py
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import uuid
|
| 2 |
+
import sqlmodel
|
src/auth/router.py
ADDED
|
File without changes
|
src/auth/schemas.py
ADDED
|
File without changes
|
src/auth/service.py
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import List
|
| 2 |
+
from uuid import UUID
|
src/auth/utils.py
ADDED
|
File without changes
|
src/chatbot/config.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pydantic import BaseSettings
|
| 2 |
+
|
| 3 |
+
class HomeSettings(BaseSettings):
|
| 4 |
+
FEATURE_ENABLED: bool = True
|
| 5 |
+
|
| 6 |
+
home_settings = HomeSettings()
|
src/chatbot/constants.py
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
WELCOME_MESSAGE = "Welcome to Yuvabe's Home Screen"
|
| 2 |
+
EXIT_MESSAGE = "Thank You have a wonderful day"
|
src/chatbot/dependencies.py
ADDED
|
File without changes
|
src/chatbot/exceptions.py
ADDED
|
File without changes
|
src/chatbot/models.py
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import uuid
|
| 2 |
+
import sqlmodel
|
src/chatbot/router.py
ADDED
|
File without changes
|
src/chatbot/schemas.py
ADDED
|
File without changes
|
src/chatbot/service.py
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import List
|
| 2 |
+
from uuid import UUID
|
src/chatbot/utils.py
ADDED
|
File without changes
|
src/core/database.py
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from sqlmodel import SQLModel, create_engine
|
| 2 |
+
from dotenv import load_dotenv
|
| 3 |
+
from . import models
|
| 4 |
+
import os
|
| 5 |
+
|
| 6 |
+
load_dotenv()
|
| 7 |
+
|
| 8 |
+
engine = create_engine(os.getenv('DATABASE_URL'),echo=True)
|
| 9 |
+
|
| 10 |
+
SQLModel.metadata.create_all(engine)
|
src/core/insert_sample.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from sqlmodel import Session
|
| 2 |
+
from datetime import date
|
| 3 |
+
import uuid
|
| 4 |
+
|
| 5 |
+
from src.core.database import engine
|
| 6 |
+
from src.core.models import Users, Roles, Teams
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
role = Roles(
|
| 10 |
+
id=uuid.uuid4(),
|
| 11 |
+
name="User"
|
| 12 |
+
)
|
| 13 |
+
|
| 14 |
+
team = Teams(
|
| 15 |
+
id=uuid.uuid4(),
|
| 16 |
+
name="Health Squad"
|
| 17 |
+
)
|
| 18 |
+
|
| 19 |
+
user = Users(
|
| 20 |
+
id=uuid.uuid4(),
|
| 21 |
+
email_id="test@example.com",
|
| 22 |
+
password="hashed_password_here",
|
| 23 |
+
user_name="tilak",
|
| 24 |
+
dob=date(2000, 5, 20),
|
| 25 |
+
address="Bangalore, India",
|
| 26 |
+
role_id=role.id,
|
| 27 |
+
emotion_trend={"happy": 10, "sad": 2},
|
| 28 |
+
habit_trend={"exercise": 5, "sleep": 8},
|
| 29 |
+
profile_picture="https://example.com/image.jpg",
|
| 30 |
+
post_id=uuid.uuid4()
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
with Session(engine) as session:
|
| 35 |
+
session.add(role)
|
| 36 |
+
session.add(team)
|
| 37 |
+
session.add(user)
|
| 38 |
+
session.commit()
|
| 39 |
+
|
| 40 |
+
print("Sample data inserted successfully!")
|
src/core/models.py
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from sqlmodel import SQLModel, Field
|
| 2 |
+
from datetime import date
|
| 3 |
+
from sqlalchemy.dialects.postgresql import JSONB
|
| 4 |
+
import uuid
|
| 5 |
+
|
| 6 |
+
class Users(SQLModel, table=True):
|
| 7 |
+
id: uuid.UUID | None = Field(default=None, primary_key=True)
|
| 8 |
+
email_id : str = Field(unique=True)
|
| 9 |
+
password : str
|
| 10 |
+
user_name : str
|
| 11 |
+
dob : date
|
| 12 |
+
address : str
|
| 13 |
+
role_id : uuid.UUID
|
| 14 |
+
emotion_trend : dict = Field(sa_type=JSONB)
|
| 15 |
+
habit_trend : dict = Field(sa_type=JSONB)
|
| 16 |
+
profile_picture : str
|
| 17 |
+
post_id : uuid.UUID
|
| 18 |
+
|
| 19 |
+
class Teams(SQLModel, table = True):
|
| 20 |
+
id: uuid.UUID | None = Field(default=None, primary_key=True)
|
| 21 |
+
name : str
|
| 22 |
+
|
| 23 |
+
class Roles(SQLModel, table = True):
|
| 24 |
+
id : uuid.UUID | None = Field(default=None , primary_key=True)
|
| 25 |
+
name : str
|
src/feed/config.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pydantic import BaseSettings
|
| 2 |
+
|
| 3 |
+
class HomeSettings(BaseSettings):
|
| 4 |
+
FEATURE_ENABLED: bool = True
|
| 5 |
+
|
| 6 |
+
home_settings = HomeSettings()
|
src/feed/constants.py
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
WELCOME_MESSAGE = "Welcome to Yuvabe's Home Screen"
|
| 2 |
+
EXIT_MESSAGE = "Thank You have a wonderful day"
|
src/feed/dependencies.py
ADDED
|
File without changes
|
src/feed/exceptions.py
ADDED
|
File without changes
|
src/feed/models.py
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import uuid
|
| 2 |
+
import sqlmodel
|
src/feed/router.py
ADDED
|
File without changes
|
src/feed/schemas.py
ADDED
|
File without changes
|
src/feed/service.py
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import List
|
| 2 |
+
from uuid import UUID
|
src/feed/utils.py
ADDED
|
File without changes
|
src/profile/config.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pydantic import BaseSettings
|
| 2 |
+
|
| 3 |
+
class HomeSettings(BaseSettings):
|
| 4 |
+
FEATURE_ENABLED: bool = True
|
| 5 |
+
|
| 6 |
+
home_settings = HomeSettings()
|
src/profile/constants.py
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
WELCOME_MESSAGE = "Welcome to Yuvabe's Home Screen"
|
| 2 |
+
EXIT_MESSAGE = "Thank You have a wonderful day"
|
src/profile/dependencies.py
ADDED
|
File without changes
|
src/profile/exceptions.py
ADDED
|
File without changes
|
src/profile/models.py
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import uuid
|
| 2 |
+
import sqlmodel
|
src/profile/router.py
ADDED
|
File without changes
|
src/profile/schemas.py
ADDED
|
File without changes
|
src/profile/service.py
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import List
|
| 2 |
+
from uuid import UUID
|
src/profile/utils.py
ADDED
|
File without changes
|