fix: loyalty route — use request.user.sub instead of userId

This commit is contained in:
2026-03-26 10:19:01 +03:00
parent 113971f854
commit 7f906cb0a3

View File

@@ -207,7 +207,7 @@ const loyaltyRoutes: FastifyPluginAsync = async (fastify) => {
await db.query( await db.query(
`INSERT INTO loyalty_transactions (hotel_id, guest_id, amount, reason, notes, staff_id) `INSERT INTO loyalty_transactions (hotel_id, guest_id, amount, reason, notes, staff_id)
VALUES ($1, $2, $3, $4, $5, $6)`, VALUES ($1, $2, $3, $4, $5, $6)`,
[hotelId, guestId, amount, reason, notes ?? null, request.user.userId ?? null], [hotelId, guestId, amount, reason, notes ?? null, request.user.sub ?? null],
) )
return { return {