testCondizioni endpoint
This commit is contained in:
parent
3457ce10ca
commit
9d03d845d2
1 changed files with 36 additions and 3 deletions
|
|
@ -1,9 +1,12 @@
|
||||||
|
import type { TestiEStringheStingaId } from "~/schemas/public/TestiEStringhe";
|
||||||
import {
|
import {
|
||||||
|
adminProcedure,
|
||||||
createTRPCRouter,
|
createTRPCRouter,
|
||||||
protectedApiProcedure,
|
protectedApiProcedure,
|
||||||
publicProcedure,
|
publicProcedure,
|
||||||
} from "~/server/api/trpc";
|
} from "~/server/api/trpc";
|
||||||
import { pgRateLimit } from "~/server/services/ratelimiter";
|
import { addEventToQueue } from "~/server/controllers/event_queue.controller";
|
||||||
|
import { CONDIZIONI_DEFAULT } from "~/server/services/prezziario.service";
|
||||||
|
|
||||||
export const testRouter = createTRPCRouter({
|
export const testRouter = createTRPCRouter({
|
||||||
testApi: protectedApiProcedure.query(async () => {
|
testApi: protectedApiProcedure.query(async () => {
|
||||||
|
|
@ -19,8 +22,38 @@ export const testRouter = createTRPCRouter({
|
||||||
// return await genTesti();
|
// return await genTesti();
|
||||||
// }),
|
// }),
|
||||||
|
|
||||||
testRate: publicProcedure.query(async () => {
|
testCondizioni: adminProcedure.query(async () => {
|
||||||
return await pgRateLimit("test", 5, 5);
|
await addEventToQueue({
|
||||||
|
data: {
|
||||||
|
tipo: "email",
|
||||||
|
data: {
|
||||||
|
template: {
|
||||||
|
mailType: "generic",
|
||||||
|
props: {
|
||||||
|
title: "Test Condizioni",
|
||||||
|
testo: `È stato ricevuto un nuovo pagamento.`,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mail: {
|
||||||
|
subject: "Ric pagamento",
|
||||||
|
to: "web@infoalloggi.it",
|
||||||
|
attachments: [
|
||||||
|
{
|
||||||
|
filename: "test_condizioni.pdf",
|
||||||
|
generate: {
|
||||||
|
type: "condizioni",
|
||||||
|
stringId: CONDIZIONI_DEFAULT as TestiEStringheStingaId,
|
||||||
|
},
|
||||||
|
encoding: "base64",
|
||||||
|
contentType: "application/pdf",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
lock_expires: new Date(),
|
||||||
|
});
|
||||||
|
return { success: true };
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue