feat: update service queries to use getAllServiziData for improved data handling

This commit is contained in:
Marco Pedone 2026-03-20 13:53:56 +01:00
parent 79354f3833
commit 8c7f0cd9b3
4 changed files with 5 additions and 15 deletions

View file

@ -67,7 +67,7 @@ export const AllegatiComp = ({
await utils.storage.retrieveUserFileData.invalidate({
userId: userId,
});
await utils.servizio.getAllServizioAnnunci.invalidate({ userId });
await utils.servizio.getAllServiziData.invalidate({ userId });
toast.success(t.allegati.allegato_rimosso, {
icon: "🗑️",

View file

@ -59,7 +59,7 @@ export const AdminDashboard = () => {
};
export const UserDashboard = ({ userId }: { userId: UsersId }) => {
const { data, isLoading } = api.servizio.getServizioRinnovi.useQuery({
const { data, isLoading } = api.servizio.getAllServiziData.useQuery({
userId,
});

View file

@ -20,7 +20,7 @@ type RicercaUserProps = {
const RicercaUser: NextPageWithLayout<RicercaUserProps> = ({
userId,
}: RicercaUserProps) => {
const { data, isLoading } = api.servizio.getServizioRinnovi.useQuery({
const { data, isLoading } = api.servizio.getAllServiziData.useQuery({
userId,
});
if (isLoading) return <LoadingPage />;
@ -59,7 +59,7 @@ export const getServerSideProps = (async (context) => {
await helpers.trpc.intrests.getUserInterestsAnnunci.prefetch({
userId: parsed.data,
});
await helpers.trpc.servizio.getAllServizioAnnunci.prefetch({
await helpers.trpc.servizio.getAllServiziData.prefetch({
userId: parsed.data,
});
return {

View file

@ -124,16 +124,6 @@ export const servizioRouter = createTRPCRouter({
.query(async ({ input }) => {
return await getDataPerAcquisto(input.servizioId);
}),
getAllServizioAnnunci: protectedProcedure
.input(
z.object({
userId: zUserId,
}),
)
.query(async ({ input }) => {
return await getAllServizioAnnunci(input.userId);
}),
getRichieste: adminProcedure.query(async () => {
return await getRichieste();
}),
@ -420,7 +410,7 @@ export const servizioRouter = createTRPCRouter({
servizioId: input.servizioId,
});
}),
getServizioRinnovi: protectedProcedure
getAllServiziData: protectedProcedure
.input(
z.object({
userId: zUserId,