mirror of
https://gitee.com/nocobase/nocobase.git
synced 2024-12-03 04:38:15 +08:00
Merge branch 'main' into next
This commit is contained in:
commit
5e8a735136
BIN
packages/core/app/client/public/nocobase.png
Normal file
BIN
packages/core/app/client/public/nocobase.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
@ -313,7 +313,7 @@ function areTimeZonesEqual(timeZone1, timeZone2) {
|
||||
}
|
||||
timeZone1 = getTimezonesByOffset(timeZone1);
|
||||
timeZone2 = getTimezonesByOffset(timeZone2);
|
||||
return moment.tz(timeZone1).format() === moment.tz(timeZone2).format();
|
||||
return moment.tz(timeZone1).format('Z') === moment.tz(timeZone2).format('Z');
|
||||
}
|
||||
|
||||
exports.initEnv = function initEnv() {
|
||||
@ -406,6 +406,10 @@ exports.initEnv = function initEnv() {
|
||||
process.env.DB_TIMEZONE = process.env.TZ;
|
||||
}
|
||||
|
||||
if (!/^[+-]\d{1,2}:\d{2}$/.test(process.env.DB_TIMEZONE)) {
|
||||
process.env.DB_TIMEZONE = moment.tz(process.env.DB_TIMEZONE).format('Z');
|
||||
}
|
||||
|
||||
if (!areTimeZonesEqual(process.env.DB_TIMEZONE, process.env.TZ)) {
|
||||
throw new Error(
|
||||
`process.env.DB_TIMEZONE="${process.env.DB_TIMEZONE}" and process.env.TZ="${process.env.TZ}" are different`,
|
||||
|
@ -7,9 +7,9 @@
|
||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||
*/
|
||||
|
||||
import { Repository } from '@nocobase/database';
|
||||
import { MockDatabase, MockServer, createMockServer } from '@nocobase/test';
|
||||
import Migration from '../migrations/20240802141435-collection-tree';
|
||||
import { Repository } from '@nocobase/database';
|
||||
|
||||
describe('tree collection sync', async () => {
|
||||
let app: MockServer;
|
||||
@ -77,38 +77,25 @@ describe('collection tree migrate test', () => {
|
||||
{
|
||||
type: 'belongsTo',
|
||||
name: 'parent',
|
||||
foreignKey: 'parentId',
|
||||
target: 'test_tree',
|
||||
treeParent: true,
|
||||
},
|
||||
{
|
||||
type: 'hasMany',
|
||||
name: 'children',
|
||||
foreignKey: 'parentId',
|
||||
target: 'test_tree',
|
||||
treeChildren: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
context: {},
|
||||
});
|
||||
const collection = db.collection({
|
||||
name: 'test_tree',
|
||||
tree: 'adjacency-list',
|
||||
fields: [
|
||||
{
|
||||
type: 'string',
|
||||
name: 'name',
|
||||
},
|
||||
{
|
||||
type: 'belongsTo',
|
||||
name: 'parent',
|
||||
treeParent: true,
|
||||
},
|
||||
{
|
||||
type: 'hasMany',
|
||||
name: 'children',
|
||||
treeChildren: true,
|
||||
},
|
||||
],
|
||||
});
|
||||
await collection.sync();
|
||||
await collection.repository.create({
|
||||
await app.db.getCollection('test_tree').model.truncate();
|
||||
await app.db.getCollection('main_test_tree_path').model.truncate();
|
||||
const repository = app.db.getRepository('test_tree');
|
||||
await repository.create({
|
||||
values: [
|
||||
{
|
||||
name: 'c1',
|
||||
@ -131,7 +118,6 @@ describe('collection tree migrate test', () => {
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await app.db.clean({ drop: true });
|
||||
await app.destroy();
|
||||
});
|
||||
|
||||
@ -164,26 +150,7 @@ describe('collection tree migrate test', () => {
|
||||
},
|
||||
});
|
||||
expect(p.name).toBe('collection-tree');
|
||||
const collection1 = db.collection({
|
||||
name: 'test_tree',
|
||||
tree: 'adjacency-list',
|
||||
fields: [
|
||||
{
|
||||
type: 'string',
|
||||
name: 'name',
|
||||
},
|
||||
{
|
||||
type: 'belongsTo',
|
||||
name: 'parent',
|
||||
treeParent: true,
|
||||
},
|
||||
{
|
||||
type: 'hasMany',
|
||||
name: 'children',
|
||||
treeChildren: true,
|
||||
},
|
||||
],
|
||||
});
|
||||
const collection1 = db.getCollection('test_tree');
|
||||
const pathCollection1 = db.getCollection(name);
|
||||
expect(pathCollection1).toBeTruthy();
|
||||
expect(await pathCollection1.existsInDb()).toBeTruthy();
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
@ -7,6 +7,7 @@
|
||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||
*/
|
||||
|
||||
import PluginFileManagerServer from '@nocobase/plugin-file-manager';
|
||||
import { InstallOptions, Plugin } from '@nocobase/server';
|
||||
import { resolve } from 'path';
|
||||
|
||||
@ -16,18 +17,30 @@ export class PluginSystemSettingsServer extends Plugin {
|
||||
}
|
||||
|
||||
async install(options?: InstallOptions) {
|
||||
const plugin = this.pm.get('file-manager') as PluginFileManagerServer;
|
||||
const logo = plugin
|
||||
? await plugin.createFileRecord({
|
||||
filePath: resolve(__dirname, './logo.png'),
|
||||
collectionName: 'attachments',
|
||||
values: {
|
||||
title: 'nocobase-logo',
|
||||
extname: '.png',
|
||||
mimetype: 'image/png',
|
||||
},
|
||||
})
|
||||
: {
|
||||
title: 'nocobase-logo',
|
||||
filename: '682e5ad037dd02a0fe4800a3e91c283b.png',
|
||||
extname: '.png',
|
||||
mimetype: 'image/png',
|
||||
url: '/nocobase.png',
|
||||
};
|
||||
await this.db.getRepository('systemSettings').create({
|
||||
values: {
|
||||
title: 'NocoBase',
|
||||
appLang: this.getInitAppLang(options),
|
||||
enabledLanguages: [this.getInitAppLang(options)],
|
||||
logo: {
|
||||
title: 'nocobase-logo',
|
||||
filename: '682e5ad037dd02a0fe4800a3e91c283b.png',
|
||||
extname: '.png',
|
||||
mimetype: 'image/png',
|
||||
url: 'https://nocobase.oss-cn-beijing.aliyuncs.com/682e5ad037dd02a0fe4800a3e91c283b.png',
|
||||
},
|
||||
logo,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user