This commit is contained in:
Morten Olsen
2024-01-11 09:03:14 +01:00
commit 74a3d0f925
92 changed files with 7488 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
import { z } from 'zod';
import { publicProcedure, router } from './router.utils.js';
import { findSecretsSchema, setSecretSchema } from '../repos/secrets/secrets.schemas.js';
const find = publicProcedure.input(findSecretsSchema).query(async ({ input, ctx }) => {
const { runtime } = ctx;
const { repos } = runtime;
const { secrets } = repos;
const result = await secrets.find(input);
return result;
});
const set = publicProcedure.input(setSecretSchema).mutation(async ({ input, ctx }) => {
const { runtime } = ctx;
const { repos } = runtime;
const { secrets } = repos;
await secrets.set(input);
});
const remove = publicProcedure
.input(
z.object({
id: z.string(),
}),
)
.mutation(async ({ input, ctx }) => {
const { runtime } = ctx;
const { repos } = runtime;
const { secrets } = repos;
await secrets.remove(input.id);
});
const secretsRouter = router({
find,
set,
remove,
});
export { secretsRouter };