33 lines
1.2 KiB
TypeScript
33 lines
1.2 KiB
TypeScript
|
import * as z from "zod"
|
||
|
import { CompleteWebsiteEventData, RelatedWebsiteEventDataModelSchema, CompleteWebsiteSession, RelatedWebsiteSessionModelSchema } from "./index"
|
||
|
|
||
|
export const WebsiteEventModelSchema = z.object({
|
||
|
id: z.string(),
|
||
|
websiteId: z.string(),
|
||
|
sessionId: z.string(),
|
||
|
urlPath: z.string(),
|
||
|
urlQuery: z.string().nullish(),
|
||
|
referrerPath: z.string().nullish(),
|
||
|
referrerQuery: z.string().nullish(),
|
||
|
referrerDomain: z.string().nullish(),
|
||
|
pageTitle: z.string().nullish(),
|
||
|
eventType: z.number().int(),
|
||
|
eventName: z.string().nullish(),
|
||
|
createdAt: z.date(),
|
||
|
})
|
||
|
|
||
|
export interface CompleteWebsiteEvent extends z.infer<typeof WebsiteEventModelSchema> {
|
||
|
eventData: CompleteWebsiteEventData[]
|
||
|
session: CompleteWebsiteSession
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* RelatedWebsiteEventModelSchema contains all relations on your model in addition to the scalars
|
||
|
*
|
||
|
* NOTE: Lazy required in case of potential circular dependencies within schema
|
||
|
*/
|
||
|
export const RelatedWebsiteEventModelSchema: z.ZodSchema<CompleteWebsiteEvent> = z.lazy(() => WebsiteEventModelSchema.extend({
|
||
|
eventData: RelatedWebsiteEventDataModelSchema.array(),
|
||
|
session: RelatedWebsiteSessionModelSchema,
|
||
|
}))
|