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:
Krikorios
2026-08-23 16:38:41 +03:00
parent fbe92c9d16
commit a0b297285a
75 changed files with 5158 additions and 2837 deletions
+6 -10
View File
@@ -1,11 +1,11 @@
import { useUser } from "@clerk/clerk-expo";
import { Image, ScrollView, Text, View } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
import { InputField } from "@/components/input-field";
import { useSession } from "@/lib/session";
const Profile = () => {
const { user } = useUser();
const { user } = useSession();
return (
<SafeAreaView className="flex-1">
@@ -17,9 +17,7 @@ const Profile = () => {
<View className="flex items-center justify-center my-5">
<Image
source={{
uri: user?.externalAccounts[0]?.imageUrl ?? user?.imageUrl,
}}
source={{ uri: user?.avatarUrl ?? undefined }}
alt="Your Avatar"
style={{ width: 110, height: 110, borderRadius: 110 / 2 }}
className=" rounded-full h-[110px] w-[110px] border-[3px] border-white shadow-sm shadow-neutral-300"
@@ -30,7 +28,7 @@ const Profile = () => {
<View className="flex flex-col items-start justify-start w-full">
<InputField
label="First name"
placeholder={user?.firstName ?? "Your First name"}
placeholder={user?.name.split(" ")[0] ?? "Your First name"}
containerStyles="w-full mb-4"
inputStyles="p-3.5"
editable={false}
@@ -38,7 +36,7 @@ const Profile = () => {
<InputField
label="Last name"
placeholder={user?.lastName ?? "Your Last name"}
placeholder={user?.name.split(" ").slice(1).join(" ") ?? "Your Last name"}
containerStyles="w-full mb-4"
inputStyles="p-3.5"
editable={false}
@@ -46,9 +44,7 @@ const Profile = () => {
<InputField
label="Email"
placeholder={
user?.primaryEmailAddress?.emailAddress ?? "Your Email address"
}
placeholder={user?.email ?? "Your Email address"}
containerStyles="w-full mb-4"
inputStyles="p-3.5"
editable={false}