Files
supabase/apps/docs/resources/guide/guideModel.ts
Charis f611fa11d9 feat (content api): add schemas and models for search results and guides (#35284)
Add models and GraphQL interface definitions for search results and guides (representing Markdown documents such as tutorials, etc.).

These aren't connected to anything yet, but putting them in a separate
PR to keep the review short and relatively simple.

Towards DOCS-214
2025-05-02 12:03:41 -04:00

38 lines
923 B
TypeScript

import { SearchResultInterface } from '../globalSearch/globalSearchInterface'
export class GuideModel implements SearchResultInterface {
public title?: string
public href?: string
public content?: string
public subsections: Array<SubsectionModel>
constructor({
title,
href,
content,
subsections,
}: {
title?: string
href?: string
content?: string
subsections?: Array<{ title?: string; href?: string; content?: string }>
}) {
this.title = title
this.href = href
this.content = content
this.subsections = subsections?.map((subsection) => new SubsectionModel(subsection)) ?? []
}
}
export class SubsectionModel {
public title?: string
public href?: string
public content?: string
constructor({ title, href, content }: { title?: string; href?: string; content?: string }) {
this.title = title
this.href = href
this.content = content
}
}