fix(participants): show Me contextually per logged-in user

Participant id=1 was named "Me" in the DB, causing Sonu and other users
to see "Me" referring to Siddharth when viewing splits and shared expenses.

- Rename participant id=1 from "Me" to "Siddharth" in the DB
- /api/participants now substitutes "Me" for whichever participant matches
  the current user, so the label is always relative to the viewer
- split-modal: default split uses currentUser.id instead of name === "Me"
- transactions/page: filter and display logic uses participant ID not name
- shared/page: split chips show "Me" when participant_id === current user

Also includes add-transaction-modal tags support (pre-existing staged change).
This commit is contained in:
2026-04-01 18:36:29 +11:00
parent 0a1f6b48a2
commit 7491e70a15
5 changed files with 90 additions and 15 deletions
+8 -2
View File
@@ -1,11 +1,17 @@
import { NextRequest, NextResponse } from "next/server";
import { prisma } from "@/lib/db";
import { queryRaw } from "@/lib/db";
import { getCurrentUser } from "@/lib/auth";
export async function GET() {
export async function GET(req: NextRequest) {
const user = await getCurrentUser(req);
const participants = await prisma.participants.findMany({
orderBy: { name: "asc" },
});
if (user) {
return NextResponse.json(
participants.map((p) => (p.id === user.id ? { ...p, name: "Me" } : p))
);
}
return NextResponse.json(participants);
}