mirror of
https://github.com/sqlchat/sqlchat.git
synced 2025-08-02 05:59:33 +08:00
chore: add debug log
This commit is contained in:
@ -8,6 +8,7 @@ const prisma = new PrismaClient();
|
|||||||
|
|
||||||
// Returns the login user email or the client IP address
|
// Returns the login user email or the client IP address
|
||||||
export const getEndUser = async (req: NextApiRequest, res: NextApiResponse): Promise<string> => {
|
export const getEndUser = async (req: NextApiRequest, res: NextApiResponse): Promise<string> => {
|
||||||
|
console.log("getEndUser");
|
||||||
// Get from server session if available
|
// Get from server session if available
|
||||||
const serverSession = await getServerSession(req, res, authOptions);
|
const serverSession = await getServerSession(req, res, authOptions);
|
||||||
if (serverSession?.user?.email) {
|
if (serverSession?.user?.email) {
|
||||||
|
@ -18,6 +18,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
|||||||
id: conversation.id,
|
id: conversation.id,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
console.log("collect");
|
||||||
const endUser = await getEndUser(req, res);
|
const endUser = await getEndUser(req, res);
|
||||||
if (chat) {
|
if (chat) {
|
||||||
await prisma.message.createMany({
|
await prisma.message.createMany({
|
||||||
|
@ -7,6 +7,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
|||||||
return res.status(405).json([]);
|
return res.status(405).json([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("payment");
|
||||||
const endUser = await getEndUser(req, res);
|
const endUser = await getEndUser(req, res);
|
||||||
const paymentList = await getPaymentListByEmail(endUser);
|
const paymentList = await getPaymentListByEmail(endUser);
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
|||||||
return res.status(405).json([]);
|
return res.status(405).json([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("usage");
|
||||||
const endUser = await getEndUser(req, res);
|
const endUser = await getEndUser(req, res);
|
||||||
|
|
||||||
// Get from server session if available
|
// Get from server session if available
|
||||||
|
Reference in New Issue
Block a user