Update landing page

This commit is contained in:
KMKoushik
2024-04-26 10:04:59 +10:00
parent 3b6d2dec25
commit 163aca189b
11 changed files with 354 additions and 74 deletions

View File

@@ -0,0 +1,32 @@
import { createRoute, z } from "@hono/zod-openapi";
import { DomainSchema } from "~/lib/zod/domain-schema";
import { PublicAPIApp } from "~/server/public-api/hono";
import { db } from "~/server/db";
import { getTeamFromToken } from "~/server/public-api/auth";
const route = createRoute({
method: "get",
path: "/v1/domains",
responses: {
200: {
content: {
"application/json": {
schema: z.array(DomainSchema),
},
},
description: "Retrieve the user",
},
},
});
function getDomains(app: PublicAPIApp) {
app.openapi(route, async (c) => {
const team = await getTeamFromToken(c);
const domains = await db.domain.findMany({ where: { teamId: team.id } });
return c.json(domains);
});
}
export default getDomains;