2025-08-07 14:50:40 +02:00
|
|
|
import { z } from "zod/v4";
|
2025-08-28 18:27:07 +02:00
|
|
|
import type { OrdiniUpdate } from "~/schemas/public/Ordini";
|
|
|
|
|
import type { PaymentsUpdate } from "~/schemas/public/Payments";
|
|
|
|
|
import type { NewServizio, ServizioUpdate } from "~/schemas/public/Servizio";
|
|
|
|
|
import type { ServizioAnnunciUpdate } from "~/schemas/public/ServizioAnnunci";
|
|
|
|
|
import type { Users } from "~/schemas/public/Users";
|
|
|
|
|
import type { UsersAnagraficaUpdate } from "~/schemas/public/UsersAnagrafica";
|
2025-08-04 17:45:44 +02:00
|
|
|
import {
|
2025-08-28 18:27:07 +02:00
|
|
|
adminProcedure,
|
|
|
|
|
createTRPCRouter,
|
|
|
|
|
protectedProcedure,
|
|
|
|
|
publicProcedure,
|
2025-08-04 17:45:44 +02:00
|
|
|
} from "~/server/api/trpc";
|
|
|
|
|
import {
|
2025-08-28 18:27:07 +02:00
|
|
|
getOrdineById,
|
|
|
|
|
getOrdini,
|
|
|
|
|
removeOrder,
|
|
|
|
|
updateOrder,
|
|
|
|
|
} from "~/server/controllers/ordini.controller";
|
2025-08-04 17:45:44 +02:00
|
|
|
import {
|
2025-08-28 18:27:07 +02:00
|
|
|
addServizio,
|
|
|
|
|
addServizioAnnunci,
|
|
|
|
|
deleteServizio,
|
|
|
|
|
deleteServizioAnnuncio,
|
|
|
|
|
getAllPagamenti,
|
|
|
|
|
getAllServizioAnnunci,
|
|
|
|
|
getAnnunciAvailableToAdd,
|
|
|
|
|
getCompatibileAnnunci,
|
|
|
|
|
getDataPerAcquisto,
|
|
|
|
|
getOrdineRicevutaData,
|
|
|
|
|
getPreOnboardData,
|
|
|
|
|
getServiziByUserId,
|
|
|
|
|
getServizioAnnuncio,
|
|
|
|
|
getServizioById,
|
|
|
|
|
getServizioPagamentoData,
|
|
|
|
|
getUserPagamenti,
|
|
|
|
|
InteractionLogicTipologia,
|
|
|
|
|
interruzioneServizio,
|
|
|
|
|
isOrdineAwaitingPayment,
|
|
|
|
|
postAcquistoDataHandler,
|
|
|
|
|
removePagamento,
|
|
|
|
|
SbloccaContatti,
|
|
|
|
|
SendContactEmail,
|
|
|
|
|
sendServizioEmail,
|
|
|
|
|
setupSaldoConsulenzaServizio,
|
|
|
|
|
setupSaldoServizio,
|
|
|
|
|
updatePagamento,
|
|
|
|
|
updateServizio,
|
|
|
|
|
updateServizioAnnuncio,
|
|
|
|
|
userConfirmImmobile,
|
2025-08-04 17:45:44 +02:00
|
|
|
} from "~/server/controllers/servizio.controller";
|
|
|
|
|
import {
|
2025-08-28 18:27:07 +02:00
|
|
|
zAnnuncioId,
|
|
|
|
|
zOrdineId,
|
|
|
|
|
zPagamentoId,
|
|
|
|
|
zServizioId,
|
|
|
|
|
zUserId,
|
|
|
|
|
} from "~/server/utils/zod_types";
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
export const servizioRouter = createTRPCRouter({
|
2025-08-29 16:18:32 +02:00
|
|
|
AnnuncioServizioTipologiaMatch: protectedProcedure
|
2025-08-28 18:27:07 +02:00
|
|
|
.input(
|
|
|
|
|
z.object({
|
2025-08-29 16:18:32 +02:00
|
|
|
annuncioId: zAnnuncioId,
|
|
|
|
|
tipologia: z.string(),
|
|
|
|
|
userId: zUserId,
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
.query(async ({ input }) => {
|
2025-08-29 16:18:32 +02:00
|
|
|
return await InteractionLogicTipologia({
|
|
|
|
|
annuncioId: input.annuncioId,
|
|
|
|
|
tipologia: input.tipologia,
|
|
|
|
|
userId: input.userId,
|
|
|
|
|
});
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
|
|
|
|
addServizio: adminProcedure
|
|
|
|
|
.input(
|
|
|
|
|
z.object({
|
|
|
|
|
data: z.custom<NewServizio>(),
|
|
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
.mutation(async ({ input }) => {
|
|
|
|
|
return await addServizio(input.data);
|
|
|
|
|
}),
|
2025-08-29 16:18:32 +02:00
|
|
|
addServizioAnnunci: adminProcedure
|
2025-08-28 18:27:07 +02:00
|
|
|
.input(
|
|
|
|
|
z.object({
|
2025-08-29 16:18:32 +02:00
|
|
|
annunci: z.array(zAnnuncioId),
|
2025-08-28 18:27:07 +02:00
|
|
|
servizioId: zServizioId,
|
|
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
.mutation(async ({ input }) => {
|
2025-08-29 16:18:32 +02:00
|
|
|
return await addServizioAnnunci({
|
|
|
|
|
annunci: input.annunci,
|
2025-08-28 18:27:07 +02:00
|
|
|
servizioId: input.servizioId,
|
|
|
|
|
});
|
|
|
|
|
}),
|
|
|
|
|
deleteServizio: adminProcedure
|
|
|
|
|
.input(
|
|
|
|
|
z.object({
|
|
|
|
|
servizioId: zServizioId,
|
|
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
.mutation(async ({ input }) => {
|
|
|
|
|
return await deleteServizio(input.servizioId);
|
|
|
|
|
}),
|
2025-08-04 17:45:44 +02:00
|
|
|
|
2025-08-29 16:18:32 +02:00
|
|
|
getAcquistoData: protectedProcedure
|
2025-08-28 18:27:07 +02:00
|
|
|
.input(
|
|
|
|
|
z.object({
|
2025-08-29 16:18:32 +02:00
|
|
|
servizioId: zServizioId,
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
.query(async ({ input }) => {
|
2025-08-29 16:18:32 +02:00
|
|
|
return await getDataPerAcquisto(input.servizioId);
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
2025-08-29 16:18:32 +02:00
|
|
|
getAllPagamenti: adminProcedure.query(async () => {
|
|
|
|
|
return await getAllPagamenti();
|
|
|
|
|
}),
|
|
|
|
|
getAllServizioAnnunci: protectedProcedure
|
2025-08-28 18:27:07 +02:00
|
|
|
.input(
|
|
|
|
|
z.object({
|
2025-08-29 16:18:32 +02:00
|
|
|
userId: zUserId,
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
.query(async ({ input }) => {
|
2025-08-29 16:18:32 +02:00
|
|
|
return await getAllServizioAnnunci(input.userId);
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
2025-08-29 16:18:32 +02:00
|
|
|
getAnnunciAvailableToAdd: adminProcedure
|
2025-08-28 18:27:07 +02:00
|
|
|
.input(
|
|
|
|
|
z.object({
|
|
|
|
|
servizioId: zServizioId,
|
|
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
.query(async ({ input }) => {
|
2025-08-29 16:18:32 +02:00
|
|
|
return await getAnnunciAvailableToAdd(input.servizioId);
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
2025-08-04 17:45:44 +02:00
|
|
|
|
2025-08-29 16:18:32 +02:00
|
|
|
getCompatibileAnnunci: protectedProcedure
|
2025-08-28 18:27:07 +02:00
|
|
|
.input(
|
|
|
|
|
z.object({
|
|
|
|
|
servizioId: zServizioId,
|
|
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
.query(async ({ input }) => {
|
2025-08-29 16:18:32 +02:00
|
|
|
return await getCompatibileAnnunci(input.servizioId);
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
2025-08-29 16:18:32 +02:00
|
|
|
getOrdineById: protectedProcedure
|
2025-08-28 18:27:07 +02:00
|
|
|
.input(
|
|
|
|
|
z.object({
|
2025-08-29 16:18:32 +02:00
|
|
|
ordineId: zOrdineId,
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
.query(async ({ input }) => {
|
2025-08-29 16:18:32 +02:00
|
|
|
return await getOrdineById(input.ordineId);
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
2025-08-29 16:18:32 +02:00
|
|
|
getOrdineRicevutaData: protectedProcedure
|
2025-08-28 18:27:07 +02:00
|
|
|
.input(
|
|
|
|
|
z.object({
|
2025-08-29 16:18:32 +02:00
|
|
|
ordineId: zOrdineId,
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
|
|
|
|
)
|
2025-08-29 16:18:32 +02:00
|
|
|
.query(async ({ input, ctx }) => {
|
|
|
|
|
return await getOrdineRicevutaData({ ctx, ordineId: input.ordineId });
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
2025-08-29 16:18:32 +02:00
|
|
|
getOrdini: protectedProcedure
|
2025-08-28 18:27:07 +02:00
|
|
|
.input(
|
|
|
|
|
z.object({
|
2025-08-29 16:18:32 +02:00
|
|
|
userId: zUserId.optional(),
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
|
|
|
|
)
|
2025-08-29 16:18:32 +02:00
|
|
|
.query(async ({ input }) => {
|
|
|
|
|
return await getOrdini(input.userId);
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
2025-08-29 16:18:32 +02:00
|
|
|
getPreOnboardData: publicProcedure
|
2025-08-28 18:27:07 +02:00
|
|
|
.input(
|
|
|
|
|
z.object({
|
|
|
|
|
servizioId: zServizioId,
|
|
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
.query(async ({ input }) => {
|
2025-08-29 16:18:32 +02:00
|
|
|
return await getPreOnboardData(input.servizioId);
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
2025-08-29 16:18:32 +02:00
|
|
|
getServizio: protectedProcedure
|
2025-08-28 18:27:07 +02:00
|
|
|
.input(
|
|
|
|
|
z.object({
|
|
|
|
|
servizioId: zServizioId,
|
|
|
|
|
}),
|
|
|
|
|
)
|
2025-08-29 16:18:32 +02:00
|
|
|
.query(async ({ input }) => {
|
|
|
|
|
return await getServizioById(input.servizioId);
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
2025-08-29 16:18:32 +02:00
|
|
|
getServizioAnnuncio: protectedProcedure
|
2025-08-28 18:27:07 +02:00
|
|
|
.input(
|
|
|
|
|
z.object({
|
|
|
|
|
annuncioId: zAnnuncioId,
|
2025-08-29 16:18:32 +02:00
|
|
|
servizioId: zServizioId,
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
|
|
|
|
)
|
2025-08-29 16:18:32 +02:00
|
|
|
.query(async ({ input }) => {
|
|
|
|
|
return await getServizioAnnuncio({
|
2025-08-28 18:27:07 +02:00
|
|
|
annuncioId: input.annuncioId,
|
2025-08-29 16:18:32 +02:00
|
|
|
servizioId: input.servizioId,
|
2025-08-28 18:27:07 +02:00
|
|
|
});
|
|
|
|
|
}),
|
2025-08-29 16:18:32 +02:00
|
|
|
getServizioPaymentData: protectedProcedure
|
2025-08-28 18:27:07 +02:00
|
|
|
.input(
|
|
|
|
|
z.object({
|
2025-08-29 16:18:32 +02:00
|
|
|
ordineId: zOrdineId,
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
|
|
|
|
)
|
2025-08-29 16:18:32 +02:00
|
|
|
.query(async ({ input }) => {
|
|
|
|
|
return await getServizioPagamentoData(input.ordineId);
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
2025-08-29 16:18:32 +02:00
|
|
|
getUserPagamenti: protectedProcedure
|
2025-08-28 18:27:07 +02:00
|
|
|
.input(
|
|
|
|
|
z.object({
|
|
|
|
|
userId: zUserId,
|
|
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
.query(async ({ input }) => {
|
2025-08-29 16:18:32 +02:00
|
|
|
return await getUserPagamenti(input.userId);
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
2025-08-29 16:18:32 +02:00
|
|
|
|
|
|
|
|
getUserServizi: adminProcedure
|
2025-08-28 18:27:07 +02:00
|
|
|
.input(
|
|
|
|
|
z.object({
|
|
|
|
|
userId: zUserId,
|
|
|
|
|
}),
|
|
|
|
|
)
|
2025-08-29 16:18:32 +02:00
|
|
|
.query(async ({ input }) => {
|
|
|
|
|
return await getServiziByUserId(input.userId);
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
2025-08-29 16:18:32 +02:00
|
|
|
interruzioneServizio: protectedProcedure
|
2025-08-28 18:27:07 +02:00
|
|
|
.input(
|
|
|
|
|
z.object({
|
|
|
|
|
servizioId: zServizioId,
|
|
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
.mutation(async ({ input }) => {
|
2025-08-29 16:18:32 +02:00
|
|
|
return await interruzioneServizio(input.servizioId);
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
|
|
|
|
isOrdineAwaitingPayment: protectedProcedure
|
|
|
|
|
.input(
|
|
|
|
|
z.object({
|
|
|
|
|
ordineId: zOrdineId,
|
|
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
.query(async ({ input }) => {
|
|
|
|
|
return await isOrdineAwaitingPayment(input.ordineId);
|
|
|
|
|
}),
|
2025-08-29 16:18:32 +02:00
|
|
|
|
|
|
|
|
postAcquistoData: protectedProcedure
|
2025-08-28 18:27:07 +02:00
|
|
|
.input(
|
|
|
|
|
z.object({
|
2025-08-29 16:18:32 +02:00
|
|
|
anagrafica: z.custom<UsersAnagraficaUpdate>(),
|
|
|
|
|
servizio: z.custom<ServizioUpdate>(),
|
|
|
|
|
servizioId: zServizioId,
|
|
|
|
|
skipOrdine: z.boolean().optional(),
|
|
|
|
|
user: z.custom<
|
|
|
|
|
Pick<Users, "nome" | "cognome" | "email" | "telefono" | "username">
|
|
|
|
|
>(),
|
|
|
|
|
userId: zUserId,
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
|
|
|
|
)
|
2025-08-29 16:18:32 +02:00
|
|
|
.mutation(async ({ input }) => {
|
|
|
|
|
return await postAcquistoDataHandler({
|
|
|
|
|
...input,
|
|
|
|
|
});
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
2025-08-29 16:18:32 +02:00
|
|
|
removeAnnuncioServizio: protectedProcedure
|
2025-08-28 18:27:07 +02:00
|
|
|
.input(
|
|
|
|
|
z.object({
|
2025-08-29 16:18:32 +02:00
|
|
|
annuncioId: zAnnuncioId,
|
|
|
|
|
servizioId: zServizioId,
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
.mutation(async ({ input }) => {
|
2025-08-29 16:18:32 +02:00
|
|
|
return await deleteServizioAnnuncio(input.servizioId, input.annuncioId);
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
2025-08-29 16:18:32 +02:00
|
|
|
removeOrder: adminProcedure
|
2025-08-28 18:27:07 +02:00
|
|
|
.input(
|
|
|
|
|
z.object({
|
2025-08-29 16:18:32 +02:00
|
|
|
ordineId: zOrdineId,
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
.mutation(async ({ input }) => {
|
2025-08-29 16:18:32 +02:00
|
|
|
return await removeOrder(input.ordineId);
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
2025-08-29 16:18:32 +02:00
|
|
|
removePagamento: adminProcedure
|
2025-08-28 18:27:07 +02:00
|
|
|
.input(
|
|
|
|
|
z.object({
|
2025-08-29 16:18:32 +02:00
|
|
|
pagamentoId: zPagamentoId,
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
|
|
|
|
)
|
2025-08-29 16:18:32 +02:00
|
|
|
.mutation(async ({ input }) => {
|
|
|
|
|
return await removePagamento(input.pagamentoId);
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
2025-08-04 17:45:44 +02:00
|
|
|
|
2025-08-28 18:27:07 +02:00
|
|
|
sendContattoEmail: publicProcedure
|
|
|
|
|
.input(
|
|
|
|
|
z.object({
|
2025-08-29 16:18:32 +02:00
|
|
|
codice: z.string(),
|
2025-08-28 18:27:07 +02:00
|
|
|
email: z.string(),
|
|
|
|
|
messaggio: z.string(),
|
2025-08-29 16:18:32 +02:00
|
|
|
nome: z.string(),
|
|
|
|
|
telefono: z.string(),
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
.mutation(async ({ input }) => {
|
|
|
|
|
return await SendContactEmail({
|
|
|
|
|
...input,
|
|
|
|
|
});
|
|
|
|
|
}),
|
2025-08-29 16:18:32 +02:00
|
|
|
sendServizioEmail: protectedProcedure
|
2025-08-28 18:27:07 +02:00
|
|
|
.input(
|
|
|
|
|
z.object({
|
|
|
|
|
servizioId: zServizioId,
|
2025-08-29 16:18:32 +02:00
|
|
|
userId: zUserId,
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
.mutation(async ({ input }) => {
|
2025-08-29 16:18:32 +02:00
|
|
|
return await sendServizioEmail({
|
2025-08-28 18:27:07 +02:00
|
|
|
servizioId: input.servizioId,
|
2025-08-29 16:18:32 +02:00
|
|
|
userId: input.userId,
|
2025-08-28 18:27:07 +02:00
|
|
|
});
|
|
|
|
|
}),
|
|
|
|
|
setupSaldoConsulenzaServizio: protectedProcedure
|
|
|
|
|
.input(
|
|
|
|
|
z.object({
|
|
|
|
|
annuncioId: zAnnuncioId,
|
2025-08-29 16:18:32 +02:00
|
|
|
servizioId: zServizioId,
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
.mutation(async ({ input }) => {
|
|
|
|
|
return await setupSaldoConsulenzaServizio({
|
2025-08-29 16:18:32 +02:00
|
|
|
annuncioId: input.annuncioId,
|
2025-08-28 18:27:07 +02:00
|
|
|
servizioId: input.servizioId,
|
2025-08-29 16:18:32 +02:00
|
|
|
});
|
|
|
|
|
}),
|
|
|
|
|
setupSaldoServizio: protectedProcedure
|
|
|
|
|
.input(
|
|
|
|
|
z.object({
|
|
|
|
|
annuncioId: zAnnuncioId,
|
|
|
|
|
servizioId: zServizioId,
|
|
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
.mutation(async ({ input }) => {
|
|
|
|
|
return await setupSaldoServizio({
|
2025-08-28 18:27:07 +02:00
|
|
|
annuncioId: input.annuncioId,
|
2025-08-29 16:18:32 +02:00
|
|
|
servizioId: input.servizioId,
|
2025-08-28 18:27:07 +02:00
|
|
|
});
|
|
|
|
|
}),
|
2025-08-04 17:45:44 +02:00
|
|
|
|
2025-08-29 16:18:32 +02:00
|
|
|
unlockServizioContatti: protectedProcedure
|
2025-08-28 18:27:07 +02:00
|
|
|
.input(
|
|
|
|
|
z.object({
|
2025-08-29 16:18:32 +02:00
|
|
|
annuncioId: zAnnuncioId,
|
2025-08-28 18:27:07 +02:00
|
|
|
servizioId: zServizioId,
|
|
|
|
|
}),
|
|
|
|
|
)
|
2025-08-29 16:18:32 +02:00
|
|
|
.mutation(async ({ input }) => {
|
|
|
|
|
return await SbloccaContatti({
|
|
|
|
|
annuncioId: input.annuncioId,
|
|
|
|
|
servizioId: input.servizioId,
|
|
|
|
|
});
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
2025-08-29 16:18:32 +02:00
|
|
|
|
|
|
|
|
updateOrder: adminProcedure
|
2025-08-28 18:27:07 +02:00
|
|
|
.input(
|
|
|
|
|
z.object({
|
2025-08-29 16:18:32 +02:00
|
|
|
data: z.custom<OrdiniUpdate>(),
|
|
|
|
|
ordineId: zOrdineId,
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
|
|
|
|
)
|
2025-08-29 16:18:32 +02:00
|
|
|
.mutation(async ({ input }) => {
|
|
|
|
|
return await updateOrder({
|
|
|
|
|
data: input.data,
|
|
|
|
|
ordineId: input.ordineId,
|
|
|
|
|
});
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
2025-08-29 16:18:32 +02:00
|
|
|
updatePagamento: adminProcedure
|
2025-08-28 18:27:07 +02:00
|
|
|
.input(
|
|
|
|
|
z.object({
|
2025-08-29 16:18:32 +02:00
|
|
|
data: z.custom<PaymentsUpdate>(),
|
|
|
|
|
pagamentoId: zPagamentoId,
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
|
|
|
|
)
|
2025-08-29 16:18:32 +02:00
|
|
|
.mutation(async ({ input }) => {
|
|
|
|
|
return await updatePagamento({
|
|
|
|
|
data: input.data,
|
|
|
|
|
paymentId: input.pagamentoId,
|
|
|
|
|
});
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
2025-08-29 16:18:32 +02:00
|
|
|
updateServizio: protectedProcedure
|
2025-08-28 18:27:07 +02:00
|
|
|
.input(
|
|
|
|
|
z.object({
|
2025-08-29 16:18:32 +02:00
|
|
|
data: z.custom<ServizioUpdate>(),
|
|
|
|
|
servizioId: zServizioId,
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
.mutation(async ({ input }) => {
|
2025-08-29 16:18:32 +02:00
|
|
|
return await updateServizio({
|
|
|
|
|
data: input.data,
|
|
|
|
|
servizioId: input.servizioId,
|
|
|
|
|
});
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
2025-08-29 16:18:32 +02:00
|
|
|
updateServizioAnnunci: protectedProcedure
|
2025-08-28 18:27:07 +02:00
|
|
|
.input(
|
|
|
|
|
z.object({
|
2025-08-29 16:18:32 +02:00
|
|
|
annuncioId: zAnnuncioId,
|
|
|
|
|
data: z.custom<ServizioAnnunciUpdate>(),
|
|
|
|
|
servizioId: zServizioId,
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
|
|
|
|
)
|
|
|
|
|
.mutation(async ({ input }) => {
|
2025-08-29 16:18:32 +02:00
|
|
|
return await updateServizioAnnuncio({
|
|
|
|
|
annuncioId: input.annuncioId,
|
2025-08-28 18:27:07 +02:00
|
|
|
data: input.data,
|
2025-08-29 16:18:32 +02:00
|
|
|
servizioId: input.servizioId,
|
2025-08-28 18:27:07 +02:00
|
|
|
});
|
|
|
|
|
}),
|
2025-08-29 16:18:32 +02:00
|
|
|
userConfirmImmobile: protectedProcedure
|
2025-08-28 18:27:07 +02:00
|
|
|
.input(
|
|
|
|
|
z.object({
|
2025-08-29 16:18:32 +02:00
|
|
|
annuncioId: zAnnuncioId,
|
|
|
|
|
servizioId: zServizioId,
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
|
|
|
|
)
|
2025-08-29 16:18:32 +02:00
|
|
|
.mutation(async ({ input }) => {
|
|
|
|
|
return await userConfirmImmobile({
|
|
|
|
|
annuncioId: input.annuncioId,
|
|
|
|
|
servizioId: input.servizioId,
|
|
|
|
|
});
|
2025-08-28 18:27:07 +02:00
|
|
|
}),
|
2025-08-04 17:45:44 +02:00
|
|
|
});
|