traxxx-web/src/web/actors.js

36 lines
760 B
JavaScript
Raw Normal View History

import { fetchActors } from '../actors.js';
export function curateActorsQuery(query) {
console.log('input query', query);
return {
query: query.q,
gender: query.gender,
age: query.age?.split(',').map((age) => Number(age)),
cup: query.cup?.split(','),
naturalBoobs: query.nb,
height: query.height?.split(',').map((height) => Number(height)),
weight: query.weight?.split(',').map((weight) => Number(weight)),
requireAvatar: query.avatar,
};
}
export async function fetchActorsApi(req, res) {
const {
actors,
countries,
limit,
total,
} = await fetchActors(curateActorsQuery(req.query), {
page: Number(req.query.page) || 1,
limit: Number(req.query.limit) || 50,
});
res.send({
actors,
countries,
limit,
total,
});
}