Package Exports
- @sheetbase/models
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@sheetbase/models) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Sheetbase Models
Commonly used sheet structures for using Google Spreadsheet with Sheetbase backend.
Install & usage
npm install --save @sheetbase/models
import { Post } from '@sheetbase/models';
const posts: Post[] = [];
const post: Post = {};
Models
💙 Category 101 🌏
sheetbase db create categories
💙 Tag 102 🌏
sheetbase db create tags
💙 Page 103 🌏
sheetbase db create pages
💙 Post 104 🌏
sheetbase db create posts
💙 Author 105 🌏
sheetbase db create authors
💙 Thread 106 🌏
sheetbase db create threads
💙 User 107 ❌
sheetbase db create users
💙 Option 108 🌏
sheetbase db create options
💚 Bundle 111 🌏
sheetbase db create bundles
💚 Audio 112 🌏
sheetbase db create audios
💚 Video 113 🌏
sheetbase db create videos
💚 Product 114 🌏
sheetbase db create products
❤️ Order 161 ❌
sheetbase db create orders
❤️ Property 162 ❌
sheetbase db create properties
💜 Notification 181 🌏
sheetbase db create notifications
💜 Promotion 182 🌏
sheetbase db create promotions
Field order
Sheet fields are sorted by groups.
- Ids:
#,title,$key type- Status:
status createdAt,updatedAtauthors- Images:
thumbnail,image - Content:
description|excerpt,content - (Specific properties)
localeoriginparentsrelationships- Taxonomies:
categories,tags, ... - Rating:
rating - Sharing:
sharing - Statistics:
viewCount,likeCount,commentCount keywords- Extras:
meta
Schema
Every model is defined in a .json file. File name is a plural string of a content type (categories, posts, ...) and is used as the model name.
export interface Schema {
gid: string | number; // will be corverted to string
public?: boolean;
dataUrl?: string;
schema: SchemaItem[];
}
export interface SchemaItem {
name: string;
width?: number;
note?: string;
}Gid
A Google Sheets sheet is indentified by its name (categories, posts, ...) or its gid (a string number as can be seen in the url #gid=0). @sheetbase/client uses the gid to request the public data accordingly.
Built-in models
A built-in model names its gid with 3 characters string number, prefix by 1.
- 💙
10x: major sheets - 💚
11x-15x: custom content public sheets - ❤️
16x-17x: private sheets - 💜
18x-19x: miscellaneous sheets
Custom models
You can use any string number (from 1-9 characters) for your custom models, but it should not starts with 1 for 3 characters gid.
Suggested covention:
- 💚
[2-9]1x-[2-9]5x: custom content public sheets - ❤️
[2-9]6x-[2-9]7x: private sheets - 💜
[2-9]8x-[2-9]9x: miscellaneous sheets
Lisence
Sheetbase Models is released under the MIT license.