Fix (crud) update
: findOne
→ findById
b/c `findById` uses an index to lookup, and should be fast.
This commit is contained in:
parent
b35bd23c91
commit
32a539c3d9
@ -243,11 +243,7 @@ export const update = ({ server, model, prefix = '/', config }) => {
|
||||
@error
|
||||
async handler(request, reply) {
|
||||
const { id } = request.params;
|
||||
const instance = await model.findOne({
|
||||
where: {
|
||||
id,
|
||||
},
|
||||
});
|
||||
const instance = await model.findById(id);
|
||||
|
||||
if (!instance) return void reply(notFound(`${id} not found.`));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user