Reinitialized commit. Update and actors overview with some filters.
This commit is contained in:
20
src/web/actors.js
Normal file
20
src/web/actors.js
Normal file
@@ -0,0 +1,20 @@
|
||||
import { fetchActors } from '../actors.js';
|
||||
|
||||
export async function fetchActorsApi(req, res) {
|
||||
const { actors, limit, total } = await fetchActors({
|
||||
query: req.query.q,
|
||||
requireAvatar: Object.hasOwn(req.query, 'avatar'),
|
||||
age: req.query.age?.split(',').map((age) => Number(age)),
|
||||
height: req.query.height?.split(',').map((height) => Number(height)),
|
||||
weight: req.query.weight?.split(',').map((weight) => Number(weight)),
|
||||
}, {
|
||||
page: Number(req.query.page) || 1,
|
||||
limit: Number(req.query.limit) || 50,
|
||||
});
|
||||
|
||||
res.send({
|
||||
actors,
|
||||
limit,
|
||||
total,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user