trying to push again

This commit is contained in:
Me
2022-12-09 16:53:00 +01:00
parent b75bce4212
commit 15ea27955b
2 changed files with 6 additions and 5 deletions

View File

@@ -68,10 +68,11 @@ export class FriendshipService {
}
//GROS CHANTIER
async create(createFriendshipDto: CreateFriendshipDto, creator : User) {
const addressee = await this.userRepository.findOneBy({username: createFriendshipDto.requesterUsername});
const addressee = await this.userRepository.findOneBy({username: createFriendshipDto.addresseeUsername});
if (!addressee)
throw new HttpException(`The addressee does not exist.`, HttpStatus.NOT_FOUND);
if (creator.id === addressee.id)
// console.log('Addressee ID: ' + addressee.id + 'Username: ' + a)
if (creator.id === addressee.id)
throw new HttpException(`You can't add yourself.`, HttpStatus.FORBIDDEN);
if (createFriendshipDto.status !== FriendshipStatus.REQUESTED && createFriendshipDto.status !== FriendshipStatus.BLOCKED)
throw new HttpException(`The status is not valid.`, HttpStatus.NOT_FOUND);

View File

@@ -103,9 +103,9 @@
method : "POST",
headers: { 'Content-Type': 'application/json'},
body: JSON.stringify({
"requesterId": user.id,
"addresseeId": set.friendId,
"status": r
"requesterUsername": user.username,
"addresseeUsername": set.friendUsername,
"status": "R"
})
})
.then( x => x.json())