refactor(templates): add tag input selector

This commit is contained in:
Mauricio Siu
2024-07-20 15:10:00 -06:00
parent 60d6d781be
commit fc011a5661
2 changed files with 249 additions and 136 deletions

View File

@@ -30,6 +30,7 @@ import {
} from "@/templates/utils";
import { TRPCError } from "@trpc/server";
import { eq } from "drizzle-orm";
import _ from "lodash";
import { nanoid } from "nanoid";
import { findAdmin } from "../services/admin";
import {
@@ -283,4 +284,10 @@ export const composeRouter = createTRPCRouter({
return templatesData;
}),
getTags: protectedProcedure.query(async ({ input }) => {
const allTags = templates.flatMap((template) => template.tags);
const uniqueTags = _.uniq(allTags);
return uniqueTags;
}),
});