Single source of truth for the Journal REST API: - API_VERSION semver constant (1.0.0) - Endpoint path constants (routes, activities, auth, uploads, push) - Zod schemas for all request/response shapes: - Routes: list, detail, create, update, compute - Activities: list, detail, create - Auth: token exchange, refresh, device management - Discovery: instance info + API version - Uploads: presigned URL flow - Errors: structured error response with field-level details - Cursor-based pagination schemas - TypeScript types inferred from Zod (z.infer) Used by Journal server (validation) and mobile client (type safety). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
17 lines
539 B
TypeScript
17 lines
539 B
TypeScript
import { z } from "zod";
|
|
|
|
export const PresignedUploadRequestSchema = z.object({
|
|
filename: z.string(),
|
|
contentType: z.string(),
|
|
resourceType: z.enum(["route", "activity"]),
|
|
resourceId: z.string().uuid(),
|
|
});
|
|
|
|
export const PresignedUploadResponseSchema = z.object({
|
|
uploadUrl: z.string().url(),
|
|
storageKey: z.string(),
|
|
expiresAt: z.string().datetime(),
|
|
});
|
|
|
|
export type PresignedUploadRequest = z.infer<typeof PresignedUploadRequestSchema>;
|
|
export type PresignedUploadResponse = z.infer<typeof PresignedUploadResponseSchema>;
|