2023-12-20 17:23:31 -05:00
|
|
|
import { User } from "@models/user";
|
|
|
|
import isIdNan from "@server/middlewareButNotReally/isIdNan";
|
2023-10-03 01:18:12 -04:00
|
|
|
|
|
|
|
export default eventHandler(async (ev) => {
|
2023-12-20 17:23:31 -05:00
|
|
|
const id = isIdNan(ev);
|
2023-10-03 01:18:12 -04:00
|
|
|
let dat = await User.find({
|
|
|
|
"favs.stories": {
|
|
|
|
$in: [id],
|
|
|
|
},
|
|
|
|
})
|
|
|
|
.select("-auth -email -ipLog -password")
|
|
|
|
.exec();
|
|
|
|
return dat.map((a) => a.toObject());
|
|
|
|
});
|