-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🔀 Add search API #53
🔀 Add search API #53
Conversation
2056e83
to
47f717d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the functional grouping of codes.
server/api/search.js
Outdated
query, | ||
} = req; | ||
let offset = 0; | ||
let q = decodeURIComponent(query.q || ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest the whole pagination logic to in an separate testable module in stead of putting inline here in the controller.
i.e. in server/utils/index:getPageInfo
and the parseQuery
here belong to server/utils/paginator
and create Paginate
class and PageInfo
class to represent the logic here.
server/api/search.js
Outdated
}; | ||
} | ||
|
||
const { count, rows } = await sequelize.asset.findAndCountAll({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put the SQL building model.asset
?
Connects #2
Due to database schema changes, seed data need to reset.
Command:
npm run sequelize:reseed