Created
September 6, 2017 18:25
-
-
Save puttputt/ecf9b419cf94040449a7a9cfab9e1167 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async deleteCompany(req: Request, res: Response, next: NextFunction) { | |
try { | |
let test = await this.service.delete(req.body.id); | |
res.status(200).json({}); | |
} catch(error) { | |
res.status(400).json(error); | |
} | |
} | |
public async delete(id : number) : Promise<any> { | |
const companyRepository = getEntityManager().getRepository(Company); | |
let company = await companyRepository.findOneById(id) | |
let entity = await companyRepository.remove(company); | |
return entity; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment