New users can now be created.
- Note: Login is buggy with a brand new account
This commit is contained in:
@@ -22,8 +22,11 @@ export async function GetBeatStats(req: LivebeatRequest, res: Response) {
|
||||
export async function GetBeat(req: LivebeatRequest, res: Response) {
|
||||
const from: number = Number(req.query.from);
|
||||
const to: number = Number(req.query.to);
|
||||
const limit: number = Number(req.query.limit || 10000);
|
||||
const sort: number = Number(req.query.sort || 1); // Either -1 or 1
|
||||
const phoneId = req.query.phoneId;
|
||||
|
||||
// Grab default phone if non was provided.
|
||||
const phone = req.query.phone === undefined ? await Phone.findOne({ user: req.user?._id }) : await Phone.findOne({ _id: phoneId, user: req.user?._id });
|
||||
let beats: IBeat[] = []
|
||||
|
||||
@@ -35,7 +38,7 @@ export async function GetBeat(req: LivebeatRequest, res: Response) {
|
||||
$gte: new Date((from | 0) * 1000),
|
||||
$lte: new Date((to | Date.now() /1000) * 1000)
|
||||
}
|
||||
}).sort({ _id: 1 });
|
||||
}).sort({ _id: sort }).limit(limit);
|
||||
res.status(200).send(beats);
|
||||
} else {
|
||||
res.status(404).send({ message: 'Phone not found' });
|
||||
|
||||
Reference in New Issue
Block a user