Advertisement
Guest User

Untitled

a guest
May 20th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. public async banUser(id: string, description: string): Promise<string> {
  2.  
  3. const findUser = await this.userRepo.findOne({
  4. where: {
  5. id,
  6. },
  7. });
  8. const date = new Date();
  9.  
  10. const banStatus = await findUser.banStatus;
  11. banStatus.isBanned = true;
  12. banStatus.expDate = (date.getDate() + 3).toString();
  13. banStatus.description = description;
  14.  
  15. findUser.banStatus = Promise.resolve(banStatus)
  16.  
  17. await this.banRepo.save(banStatus);
  18. return `You successfully succeeded to ban ${findUser.username}!`;
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement