pm server - shared

This commit is contained in:
babayaga 2026-01-29 18:12:21 +01:00
parent e94b35194b
commit 68c6e328a3
26 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,48 @@
import { z } from '@hono/zod-openapi'
export const ProductSchema = z.object({
id: z.number().openapi({ example: 1 }),
name: z.string().openapi({ example: 'Product A' }),
slug: z.string().openapi({ example: 'product-a' }),
description: z.string().optional().openapi({ example: 'Great product' }),
price: z.number().openapi({ example: 100 }),
variants: z.any().optional().openapi({ example: [] }),
})
export const SubscriptionSchema = z.object({
id: z.number().openapi({ example: 1 }),
name: z.string().openapi({ example: 'Basic' }),
price: z.number().openapi({ example: 10 }),
})
export const StatsSchema = z.object({
users: z.number().openapi({ example: 100 }),
revenue: z.number().openapi({ example: 5000 }),
})
export const ErrorSchema = z.object({
error: z.string(),
})
export type Product = z.infer<typeof ProductSchema>
export type Subscription = z.infer<typeof SubscriptionSchema>
export type Stats = z.infer<typeof StatsSchema>
export const ImageSchema = z.object({
idx: z.number().openapi({ example: 0 }),
id: z.number().openapi({ example: 6 }),
name: z.string().openapi({ example: 'images' }),
slug: z.string().openapi({ example: 'images' }),
description: z.string().openapi({ example: 'fcghdfgh' }),
price: z.string().openapi({ example: '10.00' }),
variants: z.string().openapi({ example: '[]' }),
created_at: z.string().openapi({ example: '2025-11-22 10:46:09.77718+00' }),
updated_at: z.string().openapi({ example: '2025-11-22 10:46:09.77718+00' }),
})
export const ImageResponseSchema = z.object({
message: z.string().openapi({ example: 'Success' }),
data: z.array(ImageSchema).optional(),
})