feat: expose domain dns records via api (#259)
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
createDomain,
|
||||
deleteDomain,
|
||||
getDomain,
|
||||
getDomains,
|
||||
updateDomain,
|
||||
} from "~/server/service/domain-service";
|
||||
import { sendEmail } from "~/server/service/email-service";
|
||||
@@ -29,7 +30,7 @@ export const domainRouter = createTRPCRouter({
|
||||
ctx.team.id,
|
||||
input.name,
|
||||
input.region,
|
||||
ctx.team.sesTenantId ?? undefined,
|
||||
ctx.team.sesTenantId ?? undefined
|
||||
);
|
||||
}),
|
||||
|
||||
@@ -41,20 +42,11 @@ export const domainRouter = createTRPCRouter({
|
||||
}),
|
||||
|
||||
domains: teamProcedure.query(async ({ ctx }) => {
|
||||
const domains = await db.domain.findMany({
|
||||
where: {
|
||||
teamId: ctx.team.id,
|
||||
},
|
||||
orderBy: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
});
|
||||
|
||||
return domains;
|
||||
return getDomains(ctx.team.id);
|
||||
}),
|
||||
|
||||
getDomain: domainProcedure.query(async ({ input }) => {
|
||||
return getDomain(input.id);
|
||||
getDomain: domainProcedure.query(async ({ input, ctx }) => {
|
||||
return getDomain(input.id, ctx.team.id);
|
||||
}),
|
||||
|
||||
updateDomain: domainProcedure
|
||||
@@ -62,7 +54,7 @@ export const domainRouter = createTRPCRouter({
|
||||
z.object({
|
||||
clickTracking: z.boolean().optional(),
|
||||
openTracking: z.boolean().optional(),
|
||||
}),
|
||||
})
|
||||
)
|
||||
.mutation(async ({ input }) => {
|
||||
return updateDomain(input.id, {
|
||||
@@ -104,6 +96,6 @@ export const domainRouter = createTRPCRouter({
|
||||
text: "hello,\n\nuseSend is the best open source sending platform\n\ncheck out https://usesend.com",
|
||||
html: "<p>hello,</p><p>useSend is the best open source sending platform<p><p>check out <a href='https://usesend.com'>usesend.com</a>",
|
||||
});
|
||||
},
|
||||
}
|
||||
),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user