diff --git a/Dockerfile b/Dockerfile index e0d5ae68..1113978f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ FROM node:lts-alpine -RUN mkdir -p /usr/src/fosscord-api WORKDIR /usr/src/fosscord-api -COPY package.json /usr/src/fosscord-api +COPY package.json . RUN npm install -COPY . /usr/src/fosscord-api RUN npx patch-package +COPY . . +EXPOSE 3001 CMD ["npm", "start"] \ No newline at end of file diff --git a/src/routes/users/@me/delete.ts b/src/routes/users/@me/delete.ts new file mode 100644 index 00000000..ec4cc223 --- /dev/null +++ b/src/routes/users/@me/delete.ts @@ -0,0 +1,30 @@ +import { Router, Request, Response } from "express"; +import { UserModel,UserDocument, toObject } from "@fosscord/server-util"; +import { getPublicUser } from "../../../util/User"; +import { HTTPError } from "lambert-server"; +import { UserUpdateSchema } from "../../../schema/User"; +import { check, FieldErrors, Length } from "../../../util/instanceOf"; +import { db } from "@fosscord/server-util"; +import bcrypt from "bcrypt"; +const router = Router(); + +router.post("/", async (req: Request, res: Response) => { + + const user = await UserModel.findOne( + { id: req.user_id }, + + ).exec(); //User object + + let correctpass = await bcrypt.compare(req.body.password,user!.user_data.hash) //Not sure if user typed right password :/ + if(correctpass){ + await UserModel.deleteOne({id: req.user_id}).exec() //Yeetus user deletus + + res.sendStatus(204); + } + else{ + res.sendStatus(401); + + } +}); + +export default router; diff --git a/src/routes/users/@me/disable.ts b/src/routes/users/@me/disable.ts new file mode 100644 index 00000000..ab3ce58c --- /dev/null +++ b/src/routes/users/@me/disable.ts @@ -0,0 +1,10 @@ +import { Router } from "express"; + +const router = Router(); + +router.post("/", (req, res) => { + // TODO: + res.sendStatus(204); +}); + +export default router;