feat: half-way bulk upload support.

This commit is contained in:
Mattia Belletti
2025-01-07 17:49:02 +01:00
parent a122f769cd
commit 0a73fc5a95
9 changed files with 154 additions and 56 deletions

View File

@@ -15,6 +15,7 @@ const { GetSessionResponseSchema, GetSessionRequestPathSchema } =
const { GetSessionsRequestQuerySchema, GetSessionsResponseSchema } =
exportGetSessionsSchema(z);
const {
LogEntrySchema,
PostLogRequestBodySchema,
PostLogRequestParamsSchema,
SingleMetadataSchema,
@@ -112,3 +113,4 @@ export const contract = c.router(
export type SingleMetadata = z.infer<typeof SingleMetadataSchema>;
export type GetSessionsResponse = z.infer<typeof GetSessionsResponseSchema>;
export type GetSessionResponse = z.infer<typeof GetSessionResponseSchema>;
export type LogEntry = z.infer<typeof LogEntrySchema>;

View File

@@ -38,7 +38,7 @@ export function exportPostLogSchema(z: Z) {
}),
});
const PostLogRequestBodySchema = z.object({
const LogEntrySchema = z.object({
message: z.string().openapi({
title: "Message",
description: "A human readable message that describes the log line",
@@ -55,7 +55,10 @@ export function exportPostLogSchema(z: Z) {
}),
});
const PostLogRequestBodySchema = LogEntrySchema.or(LogEntrySchema.array());
return {
LogEntrySchema,
SingleMetadataSchema,
PostLogRequestParamsSchema,
PostLogRequestBodySchema,