From 2502acbf4551be9e7f1aa716a43ffaa38369697f Mon Sep 17 00:00:00 2001 From: "huoyong.msb" Date: Mon, 17 Jun 2019 14:38:13 +0800 Subject: [PATCH] fix #508 searching bug --- src/routes/account.ts | 10 ++++++---- src/routes/index.ts | 1 + src/routes/repository.ts | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/routes/account.ts b/src/routes/account.ts index dde69f5..a321df4 100644 --- a/src/routes/account.ts +++ b/src/routes/account.ts @@ -4,7 +4,7 @@ import router from './router' import { Model } from 'sequelize-typescript' import Pagination from './utils/pagination' import { QueryInclude } from '../models' -import { Op } from 'sequelize' +import { Op } from 'sequelize' import MailService from '../service/mail' import * as md5 from 'md5' @@ -41,9 +41,11 @@ router.get('/account/list', async (ctx) => { let { name } = ctx.query if (name) { Object.assign(where, { - [Op.or]: [ - { fullname: { $like: `%${name}%` } }, - ], + [Op.or]: [{ + fullname: { + [Op.like]: `%${name}%` + }, + }], }) } let options = { where } diff --git a/src/routes/index.ts b/src/routes/index.ts index 0a38c03..7b4c4c6 100644 --- a/src/routes/index.ts +++ b/src/routes/index.ts @@ -6,6 +6,7 @@ require('./organization') require('./repository') require('./mock') require('./analytics') +// require('./foreign') require('./postman') export default router diff --git a/src/routes/repository.ts b/src/routes/repository.ts index 694055c..dbbfe07 100644 --- a/src/routes/repository.ts +++ b/src/routes/repository.ts @@ -582,7 +582,7 @@ router.post('/interface/move', async (ctx) => { }) await itf.save() } else if (op === OP_COPY) { - const { id, name, ...otherProps } = itf + const { id, name, ...otherProps } = itf.toJSON() as Interface const newItf = await Interface.create({ name: name + '副本', ...otherProps, @@ -598,7 +598,7 @@ router.post('/interface/move', async (ctx) => { // 解决parentId丢失的问题 let idMap = {} for (const property of properties) { - const { id, parentId, ...props } = property + const { id, parentId, ...props } = property.toJSON() as Property // @ts-ignore const newParentId = idMap[parentId + ''] ? idMap[parentId + ''] : -1 const newProperty = await Property.create({