New login screen
- Basic user page
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
import { Response } from "express";
|
||||
import { logger } from "../app";
|
||||
import { LivebeatRequest } from "../lib/request";
|
||||
import { Beat } from "../models/beat/beat.model.";
|
||||
import { Phone } from "../models/phone/phone.model";
|
||||
|
||||
export async function GetPhone(req: LivebeatRequest, res: Response) {
|
||||
const phoneId: String = req.params['id'];
|
||||
|
||||
// If none id provided, return all.
|
||||
if (phoneId === undefined) {
|
||||
res.status(400).send();
|
||||
const phone = await Phone.find({ user: req.user?._id });
|
||||
res.status(200).send(phone);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -18,7 +21,10 @@ export async function GetPhone(req: LivebeatRequest, res: Response) {
|
||||
return;
|
||||
}
|
||||
|
||||
res.status(200).send(phone);
|
||||
// Get last beat
|
||||
const lastBeat = await Beat.findOne({ phone: phone?._id }).sort({ createdAt: -1 });
|
||||
|
||||
res.status(200).send({ phone, lastBeat });
|
||||
}
|
||||
|
||||
export async function PostPhone(req: LivebeatRequest, res: Response) {
|
||||
|
||||
Reference in New Issue
Block a user