mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 13:39:24 +08:00
43 lines
669 B
TypeScript
43 lines
669 B
TypeScript
import { TableOptions } from "@nocobase/database";
|
|
|
|
export default {
|
|
name: 'posts',
|
|
tableName: 'actions__posts',
|
|
fields: [
|
|
{
|
|
type: 'string',
|
|
name: 'title',
|
|
},
|
|
{
|
|
type: 'string',
|
|
name: 'status',
|
|
defaultValue: 'publish',
|
|
},
|
|
{
|
|
type: 'belongsTo',
|
|
name: 'user',
|
|
},
|
|
{
|
|
type: 'hasmany',
|
|
name: 'comments',
|
|
},
|
|
{
|
|
type: 'belongsToMany',
|
|
name: 'tags',
|
|
},
|
|
],
|
|
hooks: {
|
|
beforeCreate(model, options) {
|
|
},
|
|
},
|
|
scopes: {
|
|
customTitle: (title, ctx) => {
|
|
return {
|
|
where: {
|
|
title: title,
|
|
},
|
|
}
|
|
},
|
|
},
|
|
} as TableOptions;
|