Skip to content

Commit

Permalink
fix #508 searching bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Bosn committed Jun 17, 2019
1 parent 97de46e commit 2502acb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/routes/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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 }
Expand Down
1 change: 1 addition & 0 deletions src/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require('./organization')
require('./repository')
require('./mock')
require('./analytics')
// require('./foreign')
require('./postman')

export default router
4 changes: 2 additions & 2 deletions src/routes/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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({
Expand Down

0 comments on commit 2502acb

Please sign in to comment.