Skip to content

Commit

Permalink
resolved conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Stiffpixels committed Jun 3, 2024
2 parents 7ce255e + 5d62637 commit 77aa57d
Show file tree
Hide file tree
Showing 13 changed files with 208 additions and 79 deletions.
8 changes: 4 additions & 4 deletions backend/routes/auth_routes.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from uuid import uuid4
from jose import jwt,JWTError
from fastapi import Form
from fastapi.security import OAuth2PasswordBearer
from fastapi.security import OAuth2PasswordBearer,OAuth2PasswordRequestForm
from passlib.context import CryptContext
from models import Patient
from database import SessionLocal
Expand Down Expand Up @@ -37,7 +37,7 @@ def __init__(self,email:str=Form(...),password:str=Form(...)):


bcrypt_context = CryptContext(schemes=['bcrypt'], deprecated='auto')
oauth2_bearer = OAuth2PasswordBearer(tokenUrl='auth/token')
oauth2_bearer = OAuth2PasswordBearer(tokenUrl='auth/login')


# Models for validation
Expand Down Expand Up @@ -126,9 +126,9 @@ async def create_user(db: db_dependency,

# Route to create access token for a patient
@auth_router.post("/login", response_model=Token)
async def login_for_access_token(form_data: Annotated[OAuth2EmailRequestForm, Depends()],
async def login_for_access_token(form_data: Annotated[OAuth2PasswordRequestForm, Depends()],
db: db_dependency):
user = authenticate_patient(form_data.email, form_data.password, db)
user = authenticate_patient(form_data.username, form_data.password, db)
if not user:
raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED,
detail='Could not validate user.')
Expand Down
58 changes: 54 additions & 4 deletions backend/routes/patient_routes.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,59 @@
from fastapi import APIRouter
from typing import Annotated
from pydantic import BaseModel, Field
from sqlalchemy.orm import Session
from fastapi import APIRouter, Depends, HTTPException, Path
from starlette import status
from models import Patient
from .auth_routes import get_current_patient
from passlib.context import CryptContext
from database import SessionLocal, engine

patient_router = APIRouter(prefix="/patient", tags=["Patient"])

session = SessionLocal(bind=engine)

@patient_router.get("/")
def get_patient():
return {"message": "Get all patients details"}
#User Verification Model
class UserVerification(BaseModel):
password: str
new_password: str = Field(min_length=6)

#Database dependency
def get_db():
db = SessionLocal()
try:
yield db
finally:
db.close()


db_dependency = Annotated[Session, Depends(get_db)]
user_dependency = Annotated[dict, Depends(get_current_patient)]
bcrypt_context = CryptContext(schemes=['bcrypt'], deprecated='auto')


@patient_router.get("/get_patient", status_code=status.HTTP_200_OK)
async def get_patient(user: user_dependency, db: db_dependency):
if user is None:
raise HTTPException(status_code=401, detail='Authentication Failed')
return db.query(Patient).filter(Patient.patient_id == user.get('patient_id')).first()


@patient_router.put("/change_password", status_code=status.HTTP_204_NO_CONTENT)
async def change_password(user: user_dependency, db: db_dependency, user_verification: UserVerification):
if user is None:
raise HTTPException(status_code=401, detail='Authentication Failed')
user_model = db.query(Patient).filter(
Patient.patient_id == user.get('patient_id')).first()

if not bcrypt_context.verify(user_verification.password, user_model.patient_password):
raise HTTPException(status_code=401, detail='Error on password change')
user_model.patient_password = bcrypt_context.hash(
user_verification.new_password)
db.add(user_model)
db.commit()

@patient_router.get('/get_all_patients',status_code=status.HTTP_200_OK)
async def get_all_patients(user:user_dependency,db:db_dependency):
if user is None:
raise HTTPException(status_code=401, detail='Authentication Failed')
return db.query(Patient).all()
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"react-router-dom": "^6.22.3",
"react-scroll": "^1.9.0",
"react-switch": "^7.0.0",
"styled-components": "^6.1.11"
"styled-components": "^6.1.11",
"vanilla-tilt": "^1.8.1"
},
"devDependencies": {
"@types/react": "^18.2.66",
Expand Down
2 changes: 1 addition & 1 deletion src/Pages/BlogPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const BlogPage = () => {
<div class="container mx-auto px-4 py-8 w-full">
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-10 w-[80%] mx-auto">
{blogs.map((blog) => {
return <Link to={`/blog/${blog.id}/`}>
return <Link className='blog-card' to={`/blog/${blog.id}/`}>
<div class="bg-white shadow-md rounded-lg overflow-hidden">
<img className="w-full h-52 object-cover" src="https://imgs.search.brave.com/q3MJLK_ILOJjNNpDQfAoodURIpLLbhskPAuceu6vI6c/rs:fit:860:0:0/g:ce/aHR0cHM6Ly9tZWRp/YS5nZXR0eWltYWdl/cy5jb20vaWQvMTM0/OTE4MzAxMy9waG90/by9hZnJpY2FuLW1h/bGUtam91cm5hbGlz/dC1wcmVwYXJpbmct/cXVlc3Rpb25zLWZv/ci1wcmVzcy1jb25m/ZXJlbmNlLmpwZz9z/PTYxMng2MTImdz0w/Jms9MjAmYz1xaWRi/U3pfNmhwa2tyNmpS/QjUtMWhTTUsxSjZL/RUM2YXZJVkJsYXht/WmdvPQ" alt="Blog Image" />
<div class="p-4 flex flex-col gap-1 blog-text">
Expand Down
2 changes: 1 addition & 1 deletion src/Pages/ContactPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function ContactPage() {
</div>
<button
type="submit"
className="py-3 px-5 text-sm font-medium text-center text-white rounded-lg sm:w-fit bg-green-600 focus:ring-4 focus:outline-none focus:ring-primary-300"
className="py-3 px-5 hover:scale-105 hover:shadow-lg hover:shadow-green-300 transition-all text-sm font-medium text-center text-white rounded-lg sm:w-fit bg-green-600 focus:ring-4 focus:outline-none focus:ring-primary-300"
>
Send message
</button>
Expand Down
77 changes: 48 additions & 29 deletions src/Pages/LandingPage.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
import React from "react";
import React, { useEffect } from "react";
import Form from "../components/Form/Form";
import { Link } from "react-router-dom";
import { Link as ScrollLink } from "react-scroll";
import VanillaTilt from "vanilla-tilt";

function LandingPage() {
useEffect(() => {
VanillaTilt.init(document.querySelectorAll("[data-tilt]"), {
max: 25,
speed: 400,
glare: true,
"max-glare": 0.5,
});
}, []);

return (
<>
<div className="relative">
{/* Block 1 */}
<div
className="h-[45rem] py-28 text-center lxg:text-left lxg:w-[70rem] m-auto justify-center gap-8 relative bg-gradient-to-b flex "
className="h-[45rem] py-28 text-center lxg:text-left lxg:w-[70rem] m-auto justify-center gap-8 relative bg-gradient-to-b flex"
id="block1"
>
<div className="py-10 px-7">
Expand All @@ -25,7 +35,7 @@ function LandingPage() {
Cure, personalized care plans, flexible scheduling, health
insurance and much more.
</p>
<div className="mt-12 sm:mt-9 flex items-center flex-col sm:flex-row sm:justify-center lxg:justify-start sm:gap-4">
<div className="mt-12 sm:mt-9 flex items-center flex-col sm:flex-row sm:justify-center lxg:justify-start sm:gap-4">
<Link to="book-nurse">
<button className="bg-green-600 w-48 mb-4 sm:mb-0 sm:min-w-[10rem] transition-all shadow-lg shadow-black hover:shadow-lg hover:scale-105 hover:shadow-green-400 text-white px-12 py-3 rounded-sm">
Book Nurse
Expand All @@ -38,14 +48,14 @@ function LandingPage() {
</ScrollLink>
</div>
</div>
<div className="py-10 items-end hidden lxg:flex px-7">
<div className="py-10 items-end hidden lxg:flex px-7" data-tilt>
<img
width={400}
height={400}
src="/assets/Nurse.webp"
style={{ filter: "drop-shadow(0 0 0.25rem rgba(0, 0, 0, 0.3))" }}
alt="nurse"
className="w-[22rem]"
className="w-[22rem] float"
/>
</div>
</div>
Expand All @@ -54,7 +64,7 @@ function LandingPage() {
</div>

{/* Block 2 */}
<div className="px-8 lg:px-16 mt-24 sm:mt-28 md:my-28" id="block2">
<div className="px-8 lg:px-16 mt-24 sm:mt-28 md:my-28" id="block2">
<div className="text-center mb-14 flex flex-col gap-4">
<h3 className="text-xl sm:text-3xl font-medium">
Book a health checkup now
Expand All @@ -63,7 +73,7 @@ function LandingPage() {
Quick & easy care for elderly and your loved ones
</h2>
</div>
<div className="flex flex-col m-auto max-w-[75rem] lg:flex-row justify-evenly mt-14 lg:mt-28">
<div className="flex flex-col m-auto max-w-[75rem] lg:flex-row justify-evenly mt-14 lg:mt-28">
<div className="flex flex-col items-center">
<img
src="/assets/nurseFlaticon.webp"
Expand Down Expand Up @@ -94,11 +104,11 @@ function LandingPage() {
<h2 className="text-2xl font-bold">Contact Support</h2>
<p className="max-w-[40ch] mt-3 text-gray-500 font-medium">
Our knowledgeable and friendly operators are always ready to
help with any questions or concerns
help with any questions or concerns.
</p>
</div>
</div>
{/* Let's Ride */}
{/* We Care for You */}
<div className="flex flex-col items-center mt-14 lg:mt-0">
<img
src="/assets/health-insurance.webp"
Expand All @@ -108,7 +118,7 @@ function LandingPage() {
alt=""
/>
<div className="text-center mt-8">
<h2 className="text-2xl font-bold">We Care for you</h2>
<h2 className="text-2xl font-bold">We Care for You</h2>
<p className="max-w-[40ch] mt-3 text-gray-500 font-medium">
Personalized care tailored to you, with comprehensive health
insurance coverage.
Expand All @@ -129,44 +139,45 @@ function LandingPage() {

{/* Block 5 */}
<div className="m-auto flex flex-col items-center">
<div className="block text-center smd:text-left smd:flex justify-between m-auto px-11 py-6 gap-11 mt-8 mb-8 ">
<div className="block text-center smd:text-left smd:flex justify-between m-auto px-11 py-6 gap-11 mt-8 mb-8">
<div>
<div>
<h4 className="font-bold text-2xl">Why Choose Us</h4>
<h2 className="font-bold text-center ml-auto mr-auto smd:ml-0 text-5xl my-4 smd:text-left max-w-[20ch]">
We value for health, healthcare workers and the nation
We value health, healthcare workers, and the nation
</h2>
<p className="w-full text-center smd:text-left max-w-[65ch] my-2 text-zinc-600 privacy">
We believe in valuing every aspect of health, from individual
wellness to the tireless dedication of those who nurture it.
Nurses in India are migrating to different nation to find
better opportunities but we are on a mission to provide them
Nurses in India are migrating to different nations to find
better opportunities, but we are on a mission to provide them
work opportunities by fulfilling the needs of home nursing as
a freelancing solution and connect the patients with certified
nurses.
a freelancing solution and connecting the patients with
certified nurses.
</p>
<p className="w-full text-center smd:text-left max-w-[65ch] my-2 text-zinc-600 privacy">
For the care seekers, We provide them personalized healthcare
care plans and health insurances which will protect them in
case of emergency. Covering both the aspects of care seekers
and care givers we are aiming to solve the health care for
world's largest democratic nation.
For the care seekers, we provide personalized healthcare care
plans and health insurance which will protect them in case of
emergency. Covering both the aspects of care seekers and care
givers, we aim to solve the health care needs of the world's
largest democratic nation.
</p>
</div>
</div>
<div className="my-16 text-center m-auto smd:text-left">
<div className="flex flex-col gap-3 items-center smd:gap-5 smd:flex smd:flex-row max-w-[70ch] mb-4">
<div className="flex flex-col gap-3 items-center smd:gap-5 smd:flex smd:flex-row max-w-[70ch] mb-4">
<div>
<img
src="\assets\health-professional.webp"

src="/assets/health-professional.png"
height={100}
width={100}
alt=""
/>
</div>
<div className="max-w-[70ch] mb-3">
<h2 className="text-zinc-700 font-bold text-xl contact-para">
Certified Professional Healthcare workers
Certified Professional Healthcare Workers
</h2>
<p className="max-w-[38ch] text-zinc-500 font-medium text-xm privacy">
We ensure quality care by connecting you with certified
Expand All @@ -175,32 +186,40 @@ function LandingPage() {
</p>
</div>
</div>
<div className="flex flex-col gap-3 items-center smd:gap-5 smd:flex smd:flex-row max-w-[70ch] mb-4">
<div className="flex flex-col gap-3 items-center smd:gap-5 smd:flex smd:flex-row max-w-[70ch] mb-4">
<div>

<img src="/assets/debt.png" height={100} width={100} alt="" />

<img src="\assets\debt.webp" height={100} width={100} alt="" />

</div>
<div className="max-w-[70ch] mb-3">
<h2 className="text-zinc-700 font-bold text-xl contact-para">
No Hidden Charges
</h2>
<p className="max-w-[38ch] text-zinc-500 font-medium text-xm privacy">
Enjoy peace of mind with our no hidden charges policy. We
believe in transparent and honest pricing and what you see
will be the last amount that you'd ever pay.
believe in transparent and honest pricing. What you see is
what you pay.
</p>
</div>
</div>
<div className=" flex flex-col gap-3 items-center smd:gap-5 smd:flex smd:flex-row max-w-[70ch] mb-4">
<div className="flex flex-col gap-3 items-center smd:gap-5 smd:flex smd:flex-row max-w-[70ch] mb-4">
<div>

<img src="/assets/india.png" height={100} width={100} alt="" />

<img src="\assets\india.webp" height={100} width={100} />

</div>
<div className="max-w-[70ch] mb-3">
<h2 className="text-zinc-700 font-bold text-xl contact-para">
Get Care, Anywhere
</h2>
<p className="max-w-[38ch] text-zinc-500 font-medium text-xm privacy">
We are constantly expanding our service across cities in
India
India.
</p>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/Pages/LoginPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function LoginPage() {
</div>
<a
href="#"
class="text-sm font-medium text-primary-600 hover:underline dark:text-primary-500"
class="text-sm font-medium text-primary-600 hover:underline dark:text-blue-950"
>
Forgot password?
</a>
Expand Down
4 changes: 2 additions & 2 deletions src/Pages/SignupPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ function SignupPage() {
>
Create an account
</button>
<p class="text-sm font-light text-gray-500">
<p class="text-sm font-light text-gray-500 dark:text-gray-500">
Already have an account?{" "}
<Link
to="/login"
class="font-medium text-primary-600 hover:underline"
class="font-medium text-primary-600 hover:underline dark:text-primary-500"
>
Login here
</Link>
Expand Down
6 changes: 3 additions & 3 deletions src/components/Footer/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ function Footer() {
</h2>
<ul className="text-gray-500 font-medium">
<li className="mb-4">
<a href="https://www.linkedin.com/company/nactore-organization/about/" className="hover:underline">
<a href="https://www.linkedin.com/company/nactore-organization/about/" className="hover:underline" target="_blank">
Linkedin
</a>
</li>
<li className="mb-4">
<a href="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/Nactore-Org/Nacto-Care" className="hover:underline">
<a href="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/Nactore-Org/Nacto-Care" className="hover:underline" target="_blank">
GitHub
</a>
</li>
Expand Down Expand Up @@ -91,7 +91,7 @@ function Footer() {
</div>
</div>
<div className="px-4 py-4 flex items-center justify-center">
© 2024 Nactore Organization, Building for democracy with care
© {new Date().getFullYear().toString()} Nactore Organization, Building for democracy with care
</div>
</div>
</footer>
Expand Down
Loading

0 comments on commit 77aa57d

Please sign in to comment.