@coursebuilder/core
Version:
Core package for Course Builder
79 lines (77 loc) • 1.98 kB
JavaScript
import {
priceSchema
} from "./chunk-CJLUA3NF.js";
import {
ContentResourceProductSchema
} from "./chunk-IILWNHNS.js";
import {
z
} from "./chunk-JLNB6NRA.js";
// src/schemas/product-schema.ts
var productSchema = z.object({
id: z.string().max(191),
organizationId: z.string().max(191).optional().nullable(),
name: z.string().max(191),
key: z.string().max(191).optional().nullable(),
type: z.enum([
"live",
"self-paced",
"membership",
"cohort"
]).default("self-paced"),
fields: z.object({
body: z.string().nullable().optional(),
description: z.string().nullish(),
slug: z.string(),
image: z.object({
url: z.string(),
alt: z.string().optional().nullable(),
width: z.number().optional().nullable(),
height: z.number().optional().nullable()
}).optional().nullable(),
action: z.string().optional().nullable().default("Buy Now"),
state: z.enum([
"draft",
"published",
"archived",
"deleted"
]).default("draft"),
visibility: z.enum([
"public",
"private",
"unlisted"
]).default("unlisted")
}),
createdAt: z.coerce.date().nullable(),
status: z.number().int().default(0),
quantityAvailable: z.number().int().default(-1),
price: priceSchema.nullable().optional(),
resources: z.array(ContentResourceProductSchema).default([]).nullable()
});
var NewProductSchema = z.object({
name: z.string().min(2).max(90),
quantityAvailable: z.coerce.number().default(-1),
price: z.coerce.number().gte(0).default(0),
type: z.enum([
"live",
"self-paced",
"membership",
"cohort"
]).default("self-paced").optional(),
state: z.enum([
"draft",
"published",
"archived",
"deleted"
]).default("draft").optional(),
visibility: z.enum([
"public",
"private",
"unlisted"
]).default("unlisted").optional()
});
export {
productSchema,
NewProductSchema
};
//# sourceMappingURL=chunk-6HESVS2V.js.map