Add self-hosted auth, admin API, and owner web dashboard
- Replace Clerk with self-hosted JWT auth (register/login/verify, bcrypt passwords, Gmail OTP with console fallback) - Add lib/db.ts pg pool + transaction helpers; seed script migrates legacy Clerk-era schema (drop clerk_id, enforce UUID ids and unique email) - Add owner-gated admin API: stats, users, drivers CRUD, rides - Add dashboard/ Vite React owner dashboard (login, overview, users, fleet, rides) with dev-server proxy to avoid Expo CORS middleware - Add scripts/set-owner.mjs for role management
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { useAuth, useUser } from "@clerk/clerk-expo";
|
||||
import * as Location from "expo-location";
|
||||
import { Link, router } from "expo-router";
|
||||
import { router } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import {
|
||||
ActivityIndicator,
|
||||
@@ -15,16 +14,15 @@ import { SafeAreaView } from "react-native-safe-area-context";
|
||||
import { GoogleTextInput } from "@/components/google-text-input";
|
||||
import { Map } from "@/components/map";
|
||||
import { RideCard } from "@/components/ride-card";
|
||||
import { LINKS } from "@/config";
|
||||
import { icons, images } from "@/constants";
|
||||
import { useSession } from "@/lib/session";
|
||||
import { useLocationStore } from "@/store";
|
||||
import { useFetch } from "@/lib/fetch";
|
||||
import type { Ride } from "@/types/type";
|
||||
|
||||
const Home = () => {
|
||||
const { setUserLocation, setDestinationLocation } = useLocationStore();
|
||||
const { signOut } = useAuth();
|
||||
const { user } = useUser();
|
||||
const { signOut, user } = useSession();
|
||||
const { data: recentRides, loading } = useFetch<Ride[]>(
|
||||
`/(api)/ride/${user?.id}`,
|
||||
);
|
||||
@@ -119,23 +117,10 @@ const Home = () => {
|
||||
numberOfLines={1}
|
||||
>
|
||||
Welcome{" "}
|
||||
{user?.firstName || user?.emailAddresses[0].emailAddress} 👋
|
||||
{user?.name || user?.email} 👋
|
||||
</Text>
|
||||
|
||||
<View className="flex flex-row items-center gap-x-1">
|
||||
<Link
|
||||
href={LINKS.sourceCode}
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
className="justify-center items-center w-10 h-10"
|
||||
>
|
||||
<Image
|
||||
source={icons.github}
|
||||
className="w-6 h-6"
|
||||
alt="GitHub"
|
||||
/>
|
||||
</Link>
|
||||
|
||||
<TouchableOpacity
|
||||
onPress={handleSignOut}
|
||||
className="justify-center items-center w-10 h-10 rounded-full bg-white"
|
||||
|
||||
Reference in New Issue
Block a user