Added Delete function and dummy disable function
This commit is contained in:
		
							parent
							
								
									d48b286e4b
								
							
						
					
					
						commit
						58b7ebdd5a
					
				
							
								
								
									
										26
									
								
								src/routes/users/@me/delete.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								src/routes/users/@me/delete.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,26 @@ | ||||
| import { Router, Request, Response } from "express"; | ||||
| import { UserModel, toObject } from "@fosscord/server-util"; | ||||
| import { getPublicUser } from "../../../util/User"; | ||||
| import { HTTPError } from "lambert-server"; | ||||
| import { UserUpdateSchema } from "../../../schema/User"; | ||||
| import { check } from "../../../util/instanceOf"; | ||||
| import { db } from "@fosscord/server-util"; | ||||
| const router = Router(); | ||||
| 
 | ||||
| router.post("/", async (req: Request, res: Response) => { | ||||
| 	// TODO:
 | ||||
| 	const { authorization } = req.headers; | ||||
|  //console.log(req.headers);
 | ||||
| 	console.log(authorization); | ||||
| 	var auth = ""+ authorization; | ||||
| 	let u = JSON.parse(atob(auth.split(".")[1])) | ||||
| 	var userid = u.id; | ||||
| 	console.log(userid); | ||||
| 	const user = await getPublicUser(userid); | ||||
| 	await UserModel.remove(user).exec(); | ||||
| 	//await usermodel.save();
 | ||||
| 
 | ||||
| 	res.sendStatus(204); | ||||
| }); | ||||
| 
 | ||||
| export default router; | ||||
							
								
								
									
										10
									
								
								src/routes/users/@me/disable.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								src/routes/users/@me/disable.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,10 @@ | ||||
| import { Router } from "express"; | ||||
| 
 | ||||
| const router = Router(); | ||||
| 
 | ||||
| router.post("/", (req, res) => { | ||||
| 	// TODO:
 | ||||
| 	res.sendStatus(204); | ||||
| }); | ||||
| 
 | ||||
| export default router; | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Bloom Sirenix
						Bloom Sirenix