Migrate frontend from MongoDB/Firebase to Odoo 19 backend

- Remove all MongoDB and Firebase dependencies
- Add Odoo proxy layer (src/lib/odoo.ts) for JWT-authenticated API forwarding
- Rewrite auth routes (login, logout, register, reset) to use Odoo endpoints
- Add catch-all API route ([...path].ts) to proxy remaining endpoints to Odoo
- Rewrite special-case routes for file uploads and binary responses
- Delete ~85 legacy API routes now handled by catch-all proxy
- Replace *.be.ts MongoDB utilities with stub implementations for SSR compat
- Update Dockerfile: remove MONGODB_URI, switch from yarn to npm
- Update session.ts to store Odoo JWT token

Made-with: Cursor
This commit is contained in:
Talal Sharabi
2026-03-14 16:46:15 +04:00
parent 2bfb94d01b
commit 5fb82abafd
137 changed files with 12112 additions and 12269 deletions

View File

@@ -1,29 +1,3 @@
import {NextApiRequest, NextApiResponse} from "next";
import {getAuth} from "firebase-admin/auth";
import {adminApp} from "@/firebase";
import client from "@/lib/mongodb";
import {sessionOptions} from "@/lib/session";
import {withIronSessionApiRoute} from "iron-session/next";
import {proxyToOdoo} from "@/lib/odoo";
const db = client.db(process.env.MONGODB_DB);
const auth = getAuth(adminApp);
export default withIronSessionApiRoute(verify, sessionOptions);
async function verify(req: NextApiRequest, res: NextApiResponse) {
const {email} = req.body as {email: string};
const user = await auth.getUserByEmail(email);
if (!user) {
res.status(404).json({ok: false});
return;
}
await db.collection("users").updateOne(
{ id: user.uid},
{ $set: {isVerified: true} }
);
res.status(200).json({ok: true});
}
export default proxyToOdoo("/api/reset");