Add click and open tracking
This commit is contained in:
@@ -7,7 +7,11 @@ import {
|
||||
teamProcedure,
|
||||
} from "~/server/api/trpc";
|
||||
import { db } from "~/server/db";
|
||||
import { createDomain, getDomain } from "~/server/service/domain-service";
|
||||
import {
|
||||
createDomain,
|
||||
getDomain,
|
||||
updateDomain,
|
||||
} from "~/server/service/domain-service";
|
||||
|
||||
export const domainRouter = createTRPCRouter({
|
||||
createDomain: teamProcedure
|
||||
@@ -21,6 +25,9 @@ export const domainRouter = createTRPCRouter({
|
||||
where: {
|
||||
teamId: ctx.team.id,
|
||||
},
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
});
|
||||
|
||||
return domains;
|
||||
@@ -31,4 +38,19 @@ export const domainRouter = createTRPCRouter({
|
||||
.query(async ({ ctx, input }) => {
|
||||
return getDomain(input.id);
|
||||
}),
|
||||
|
||||
updateDomain: teamProcedure
|
||||
.input(
|
||||
z.object({
|
||||
id: z.number(),
|
||||
clickTracking: z.boolean().optional(),
|
||||
openTracking: z.boolean().optional(),
|
||||
})
|
||||
)
|
||||
.mutation(async ({ ctx, input }) => {
|
||||
return updateDomain(input.id, {
|
||||
clickTracking: input.clickTracking,
|
||||
openTracking: input.openTracking,
|
||||
});
|
||||
}),
|
||||
});
|
||||
|
Reference in New Issue
Block a user