♻️ Update api endpoint authorization

This commit is contained in:
Meier Lukas
2023-08-06 15:40:19 +02:00
parent d281a2ee98
commit 3ef12cfe12
10 changed files with 124 additions and 109 deletions

View File

@@ -16,13 +16,6 @@ import { adminProcedure, createTRPCRouter, publicProcedure } from '../trpc';
const configNameSchema = z.string().regex(/^[a-zA-Z0-9-_]+$/);
export const configRouter = createTRPCRouter({
all: publicProcedure.query(async () => {
// Get all the configs in the /data/configs folder
// All the files that end in ".json"
const files = fs.readdirSync('./data/configs').filter((file) => file.endsWith('.json'));
// Strip the .json extension from the file name
return files.map((file) => file.replace('.json', ''));
}),
delete: adminProcedure
.input(
z.object({