@prom-cms/schema
v0.12.0-main.b449f6f0fb77b9d97dd2b663433549152bed0f6b
Published
Schema package for prom cms packages
Downloads
219
Readme
This is a schema package for prom-cms packages.
Introduction
This package includes all schema, mainly generator config schemas, that PromCMS uses internally. This documentation won't describe every one of them - for this you should look at code, because it's very descriptive by itself since schemas are written with zod
Nonetheless this documentation will describe how you should approach schema and describe field types and their meaning.
Schema
PromCMS schema is split into two basic parts Project and Database.
Project - This part describes project basic settings (such as name, slug, url, etc)
Database - This part describes database layer of your project
- Models - Record of all of your models (posts, products, etc) - extended from "Database Item Base"
- Singletons - Record of all of your singletons (specific pages, contacts, or other non repetitive content) - extended from "Database Item Base"
Database Item Base - Base schema for Models and Singletons. Has defined columns and other config that is specific for both Models and Singletons
- Columns - Union record of multiple column types. Every column type extends "Column Type Base"
Normal - Basic column types that does not require specific options
type
: Enum- date
- password
- dateTime
- longText
JSON - JSON column type. This field has also multiple types of fields in admin.
admin
fieldType
: Enum- repeater
- With this you have to define your
columns
in repeater
- With this you have to define your
- blockEditor - rich editor
- jsonEditor default - basic textarea with support of json
- openingHours - opening hours field
- repeater
String - Basic string field. Can also take multiple rendering types in admin.
admin
fieldType
: Enum- heading
- normal
Enum - Classic enum field type
File - Field for selecting fields from PromCMS file system. This field can also take multiple forms of rendering in admin.
admin
fieldType
: Enum- normal default
- big-image
- small-image
Number - Classic number field
Relationship - Relationship field type. With this you can "link" models between each other. This field renders as a select in admin.
Slug - Field type that automatically updates itself based on value of specified string field that is slugified
Boolean - Classic boolean field. True or False
- Columns - Union record of multiple column types. Every column type extends "Column Type Base"
Column Type Base - Options for every column type. Includes options for admin view, translations and more