export default async function catalogPermissions(req, reply) {
    const { pg, params } = req;
    const { uid } = params;
    if (!uid) return reply.status(403).send({ status: 403, message: 'access restricted' });
    const { total, layer_list } = await pg.one(
        `select count(*)::int as total,array_agg(json_build_object('service_id',service_id,'actions',actions)) as layer_list from gis.services_users_rel where user_id=$1`, [uid]);
    return reply.status(200).send({ status: 200, total, layer_list })
}