feat: add procedure to relay
This commit is contained in:
22
api/procedures/event.ts
Normal file
22
api/procedures/event.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { procedure } from "@spec/relay/mod.ts";
|
||||
import z from "zod";
|
||||
|
||||
const EventSchema = z.object({
|
||||
id: z.uuid(),
|
||||
stream: z.uuid(),
|
||||
type: z.string(),
|
||||
data: z.any(),
|
||||
meta: z.any(),
|
||||
recorded: z.string(),
|
||||
created: z.string(),
|
||||
});
|
||||
|
||||
export default procedure
|
||||
.method("event")
|
||||
.access("public")
|
||||
.params(EventSchema)
|
||||
.response(z.uuid())
|
||||
.handle(async (event) => {
|
||||
console.log(event);
|
||||
return crypto.randomUUID();
|
||||
});
|
||||
Reference in New Issue
Block a user