trying to push again
This commit is contained in:
@@ -68,9 +68,10 @@ export class FriendshipService {
|
|||||||
}
|
}
|
||||||
//GROS CHANTIER
|
//GROS CHANTIER
|
||||||
async create(createFriendshipDto: CreateFriendshipDto, creator : User) {
|
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)
|
if (!addressee)
|
||||||
throw new HttpException(`The addressee does not exist.`, HttpStatus.NOT_FOUND);
|
throw new HttpException(`The addressee does not exist.`, HttpStatus.NOT_FOUND);
|
||||||
|
// console.log('Addressee ID: ' + addressee.id + 'Username: ' + a)
|
||||||
if (creator.id === addressee.id)
|
if (creator.id === addressee.id)
|
||||||
throw new HttpException(`You can't add yourself.`, HttpStatus.FORBIDDEN);
|
throw new HttpException(`You can't add yourself.`, HttpStatus.FORBIDDEN);
|
||||||
if (createFriendshipDto.status !== FriendshipStatus.REQUESTED && createFriendshipDto.status !== FriendshipStatus.BLOCKED)
|
if (createFriendshipDto.status !== FriendshipStatus.REQUESTED && createFriendshipDto.status !== FriendshipStatus.BLOCKED)
|
||||||
|
|||||||
@@ -103,9 +103,9 @@
|
|||||||
method : "POST",
|
method : "POST",
|
||||||
headers: { 'Content-Type': 'application/json'},
|
headers: { 'Content-Type': 'application/json'},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
"requesterId": user.id,
|
"requesterUsername": user.username,
|
||||||
"addresseeId": set.friendId,
|
"addresseeUsername": set.friendUsername,
|
||||||
"status": r
|
"status": "R"
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.then( x => x.json())
|
.then( x => x.json())
|
||||||
|
|||||||
Reference in New Issue
Block a user