fix #508 searching bug

pull/513/head 0.0.1
huoyong.msb 6 years ago
parent 97de46e539
commit 2502acbf45

@ -4,7 +4,7 @@ import router from './router'
import { Model } from 'sequelize-typescript' import { Model } from 'sequelize-typescript'
import Pagination from './utils/pagination' import Pagination from './utils/pagination'
import { QueryInclude } from '../models' import { QueryInclude } from '../models'
import { Op } from 'sequelize' import { Op } from 'sequelize'
import MailService from '../service/mail' import MailService from '../service/mail'
import * as md5 from 'md5' import * as md5 from 'md5'
@ -41,9 +41,11 @@ router.get('/account/list', async (ctx) => {
let { name } = ctx.query let { name } = ctx.query
if (name) { if (name) {
Object.assign(where, { Object.assign(where, {
[Op.or]: [ [Op.or]: [{
{ fullname: { $like: `%${name}%` } }, fullname: {
], [Op.like]: `%${name}%`
},
}],
}) })
} }
let options = { where } let options = { where }

@ -6,6 +6,7 @@ require('./organization')
require('./repository') require('./repository')
require('./mock') require('./mock')
require('./analytics') require('./analytics')
// require('./foreign')
require('./postman') require('./postman')
export default router export default router

@ -582,7 +582,7 @@ router.post('/interface/move', async (ctx) => {
}) })
await itf.save() await itf.save()
} else if (op === OP_COPY) { } else if (op === OP_COPY) {
const { id, name, ...otherProps } = itf const { id, name, ...otherProps } = itf.toJSON() as Interface
const newItf = await Interface.create({ const newItf = await Interface.create({
name: name + '副本', name: name + '副本',
...otherProps, ...otherProps,
@ -598,7 +598,7 @@ router.post('/interface/move', async (ctx) => {
// 解决parentId丢失的问题 // 解决parentId丢失的问题
let idMap = {} let idMap = {}
for (const property of properties) { for (const property of properties) {
const { id, parentId, ...props } = property const { id, parentId, ...props } = property.toJSON() as Property
// @ts-ignore // @ts-ignore
const newParentId = idMap[parentId + ''] ? idMap[parentId + ''] : -1 const newParentId = idMap[parentId + ''] ? idMap[parentId + ''] : -1
const newProperty = await Property.create({ const newProperty = await Property.create({

Loading…
Cancel
Save