A model of compact and ultracompact objects in $$f(\mathcal {R})$$ f ( R ) -Palatini theor