feat: Implement (most) API endpoints

This commit is contained in:
Alexander Polynomdivision
2018-09-29 19:34:22 +02:00
parent 9ea5078c5c
commit e6e7505383
6 changed files with 50 additions and 36 deletions

View File

@@ -1,8 +1,8 @@
import { Db } from "mongodb";
import { IUser } from "../models/user";
import { IUserDBModel } from "../models/user";
export async function userFromSession(token: string, db: Db): Promise<IUser> {
export async function userFromSession(token: string, db: Db): Promise<IUserDBModel> {
// Get the username
const session = await db.collection("sessions").findOne({ token, });
if (session) {