Skip to content

Commit

Permalink
feat: improve code
Browse files Browse the repository at this point in the history
  • Loading branch information
chenos committed Sep 11, 2021
1 parent f300fd6 commit c6b68f2
Show file tree
Hide file tree
Showing 139 changed files with 418 additions and 13,962 deletions.
3 changes: 2 additions & 1 deletion .umirc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ export default defineConfig({
define: {
'process.env.API_URL': process.env.API_URL,
},
includes: ['docs'],
// mfsu: {},
// ssr: {},
// exportStatic: {},
mode: 'site',
mode: 'doc',
logo: 'https://www.nocobase.com/dist/images/logo.png',
navs: {
'en-US': [
Expand Down
9 changes: 0 additions & 9 deletions packages/plugin-china-region/src/collections/china_regions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,29 @@ export default {
// 如使用代码作为 id 可能更节省,但由于代码数字最长为 12 字节,除非使用 bigint(64) 才够放置
{
name: 'code',
title: '代码',
interface: 'string',
type: 'string',
unique: true,
},
{
name: 'name',
title: '名称',
interface: 'string',
type: 'string',
},
{
name: 'parent',
title: '从属',
interface: 'linkTo',
type: 'belongsTo',
target: 'china_regions',
targetKey: 'code',
foreignKey: 'parent_code',
},
{
name: 'children',
title: '下辖',
interface: 'linkTo',
type: 'hasMany',
target: 'china_regions',
sourceKey: 'code',
foreignKey: 'parent_code'
},
{
name: 'level',
title: '层级',
type: 'integer'
}
]
Expand Down
14 changes: 11 additions & 3 deletions packages/plugin-china-region/src/server.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import path from 'path';
import { registerModels } from '@nocobase/database';
import Database, { registerModels } from '@nocobase/database';
import { ChinaRegion } from './models/china-region';
import Application from '@nocobase/server';

export default async function (options = {}) {
registerModels({ ChinaRegion });

export default async function (this: Application, options = {}) {
const { database } = this;
registerModels({ ChinaRegion });

database.import({
directory: path.resolve(__dirname, 'collections'),
});

this.on('china-region.init', async () => {
const M = database.getModel('china_regions');
await M.importData();
});
}
16 changes: 0 additions & 16 deletions packages/plugin-collections-v04/package.json

This file was deleted.

This file was deleted.

144 changes: 0 additions & 144 deletions packages/plugin-collections-v04/src/__tests__/index.ts

This file was deleted.

Loading

0 comments on commit c6b68f2

Please sign in to comment.