@ -106,7 +106,6 @@
"typescript": "^3.8.3"
},
"pre-commit": [
"check",
"test"
"check"
]
}
@ -29,6 +29,7 @@ let config: IConfigOptions = {
redis: {
host: process.env.REDIS_URL || 'localhost',
port: (process.env.REDIS_PORT && parseInt(process.env.REDIS_PORT)) || 6379,
password: process.env.REDIS_PWD || undefined,
mail: {
host: process.env.MAIL_HOST ?? 'smtp.aliyun.com',
@ -54,7 +54,8 @@ export default class Tree {
if (
item.value &&
item.value.indexOf('[') === 0 &&
item.value.substring(item.value.length - 1) === ']'
item.value.substring(item.value.length - 1) === ']' &&
!!rule
) {
try {
result[item.name + rule] = vm.run(`(${item.value})`)
@ -38,7 +38,7 @@ app.use(cors({
}))
app.use(async (ctx, next) => {
await next()
if (typeof ctx.body === 'object' && ctx.body.data !== undefined) {
if (typeof ctx.body === 'object' && ctx.body?.data !== undefined) {
ctx.type = 'json'
ctx.body = JSON.stringify(ctx.body, undefined, 2)
@ -7,7 +7,7 @@ const arrayToTree = (list: any[]): any => {
const getValue = (parent: any) => {
const children = list.filter((item: any) => item.parentId === parent.id)
if (!children.length) {
return `${parent.type} ${parent.description ? `(${parent.description})` : ''}`
return `${parent.type} ${parent.required ? '(必选)' : ''} ${parent.description ? `(${parent.description})` : ''}`
const obj: { [k: string]: any } = {}
children.forEach((e: any) => {
@ -1178,8 +1178,8 @@ export default class MigrateService {
public static async importInterfaceFromJSON(data: any, curUserId: number, repositoryId: number, modId: number) {
let itfData = data.itf
let properties = data.properties
let itfData = data.itf ? data.itf : data
let properties = data.itf ? data.properties : itfData?.properties
const itf = await Interface.create({
moduleId: modId,