security hardening, team invites, granular locking, view counts, board subscriptions, scheduled changelog, mentions, recovery codes, accessibility and hover states
This commit is contained in:
21
packages/api/src/routes/templates.ts
Normal file
21
packages/api/src/routes/templates.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { FastifyInstance } from "fastify";
|
||||
import { prisma } from "../lib/prisma.js";
|
||||
|
||||
export default async function templateRoutes(app: FastifyInstance) {
|
||||
app.get<{ Params: { boardSlug: string } }>(
|
||||
"/boards/:boardSlug/templates",
|
||||
{ config: { rateLimit: { max: 30, timeWindow: "1 minute" } } },
|
||||
async (req, reply) => {
|
||||
const board = await prisma.board.findUnique({ where: { slug: req.params.boardSlug } });
|
||||
if (!board) return reply.status(404).send({ error: "Board not found" });
|
||||
|
||||
const templates = await prisma.boardTemplate.findMany({
|
||||
where: { boardId: board.id },
|
||||
orderBy: { position: "asc" },
|
||||
select: { id: true, name: true, fields: true, isDefault: true, position: true },
|
||||
});
|
||||
|
||||
reply.send({ templates });
|
||||
}
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user