user create wip

This commit is contained in:
2022-10-10 12:11:11 +02:00
parent da02f87e97
commit f19e24533e
16 changed files with 576 additions and 23 deletions

View File

@ -0,0 +1,16 @@
import { MongoClient, Db } from "mongodb";
class Mongo {
private client: MongoClient;
private dbName: string;
constructor(uri: string) {
this.client = new MongoClient(uri);
}
getDb(): Db {
return this.client.db(this.dbName);
}
}
export default Mongo;

View File

@ -0,0 +1,14 @@
import { CreateUserBody, User, UserInfo } from "@core";
import { Services } from "../express/server";
export function Create(services: Services): (tracker: string, user: CreateUserBody) => Promise<UserInfo> {
const { db } = services;
const coll = db.collection("users");
return async (tracker, user) => {
await coll.insertOne(user);
return {
name: "test"
}
}
}