diff --git a/backend/src/routes/role-permissions.ts b/backend/src/routes/role-permissions.ts index 5a4045d..e41f612 100644 --- a/backend/src/routes/role-permissions.ts +++ b/backend/src/routes/role-permissions.ts @@ -29,13 +29,22 @@ const rolePermissionsRoute: FastifyPluginAsync = async (fastify) => { if (!hotelId) return reply.code(404).send({ error: 'Hotel not found' }) const { rows } = await db.query( - `SELECT id, hotel_id, role_key, name, color, is_system, permissions, created_at, updated_at + `SELECT id, hotel_id, role_key, name, color, is_system, permissions, home_page, created_at, updated_at FROM role_permissions WHERE hotel_id = $1 ORDER BY is_system DESC, name`, [hotelId], ) - return rows + return rows.map(r => ({ + id: r.id, + hotelId: r.hotel_id, + roleKey: r.role_key, + name: r.name, + color: r.color, + isSystem: r.is_system, + permissions: r.permissions, + homePage: r.home_page, + })) }, ) @@ -70,7 +79,17 @@ const rolePermissionsRoute: FastifyPluginAsync = async (fastify) => { RETURNING *`, [hotelId, roleKey, name, color, isSystem, JSON.stringify(permissions), homePage], ) - return rows[0] + const r = rows[0] + return { + id: r.id, + hotelId: r.hotel_id, + roleKey: r.role_key, + name: r.name, + color: r.color, + isSystem: r.is_system, + permissions: r.permissions, + homePage: r.home_page, + } }, )