tous les trucs du user sont ok, maintenant refonte des requêtes d'amitiés. C'est bien avancé, reste àa tester deux trois trucs
This commit is contained in:
@@ -18,7 +18,7 @@ let AuthenticationService = class AuthenticationService {
|
||||
}
|
||||
async validateUser(createUsersDto) {
|
||||
console.log("Validate inside authentication.service.ts");
|
||||
const user = await this.userService.findOneByFourtyTwoId(createUsersDto.fourtyTwoId);
|
||||
const user = await this.userService.findOneByFourtyTwoId(createUsersDto.fortyTwoId);
|
||||
if (user)
|
||||
return user;
|
||||
return this.userService.create(createUsersDto);
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"authentication.service.js","sourceRoot":"","sources":["../../../src/auth/42/authentication.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAG5C,6DAAuD;AAIhD,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IACjC,YACmB,WAAyB;QAAzB,gBAAW,GAAX,WAAW,CAAc;IAExC,CAAC;IAEL,KAAK,CAAC,YAAY,CAAC,cAA8B;QAChD,OAAO,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAC;QACzD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;QACrF,IAAI,IAAI;YACP,OAAO,IAAI,CAAC;QACb,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAChD,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,YAAqB;QACnC,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAClE,CAAC;CAMD,CAAA;AAtBY,qBAAqB;IADjC,IAAA,mBAAU,GAAE;qCAGoB,4BAAY;GAFhC,qBAAqB,CAsBjC;AAtBY,sDAAqB"}
|
||||
{"version":3,"file":"authentication.service.js","sourceRoot":"","sources":["../../../src/auth/42/authentication.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAG5C,6DAAuD;AAIhD,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IACjC,YACmB,WAAyB;QAAzB,gBAAW,GAAX,WAAW,CAAc;IAExC,CAAC;IAEL,KAAK,CAAC,YAAY,CAAC,cAA8B;QAChD,OAAO,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAC;QACzD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;QACpF,IAAI,IAAI;YACP,OAAO,IAAI,CAAC;QACb,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAChD,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,YAAqB;QACnC,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAClE,CAAC;CAMD,CAAA;AAtBY,qBAAqB;IADjC,IAAA,mBAAU,GAAE;qCAGoB,4BAAY;GAFhC,qBAAqB,CAsBjC;AAtBY,sDAAqB"}
|
||||
@@ -27,7 +27,7 @@ let FortyTwoStrategy = class FortyTwoStrategy extends (0, passport_1.PassportStr
|
||||
async validate(accessToken, refreshToken, profile, callbackURL) {
|
||||
console.log("Validate inside strategy.ts");
|
||||
console.log(profile.id, profile.username, profile.phoneNumbers[0].value, profile.emails[0].value, profile.photos[0].value);
|
||||
const userDTO = { fourtyTwoId: profile.id, username: profile.username, email: profile.emails[0].value, image_url: profile.photos[0].value };
|
||||
const userDTO = { fortyTwoId: profile.id, username: profile.username, email: profile.emails[0].value, image_url: profile.photos[0].value };
|
||||
const user = await this.authenticationService.validateUser(userDTO);
|
||||
if (!user)
|
||||
throw new common_1.UnauthorizedException();
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"42strategy.js","sourceRoot":"","sources":["../../../../src/auth/42/strategy/42strategy.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAoD;AACpD,+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,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;QAC5J,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QACpE,IAAI,CAAC,IAAI;YACR,MAAM,IAAI,8BAAqB,EAAE,CAAC;QACnC,OAAO,IAAI,CAAC;IACX,CAAC;CACF,CAAA;AAnBY,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;qCAE+B,8CAAqB;GADpD,gBAAgB,CAmB5B;AAnBY,4CAAgB"}
|
||||
@@ -22,7 +22,7 @@ let SessionSerializer = class SessionSerializer extends passport_1.PassportSeria
|
||||
done(null, user);
|
||||
}
|
||||
async deserializeUser(user, done) {
|
||||
const userDB = await this.authservice.findUser(user.fourtyTwoId);
|
||||
const userDB = await this.authservice.findUser(user.fortyTwoId);
|
||||
if (userDB)
|
||||
done(null, userDB);
|
||||
else
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"serializer.js","sourceRoot":"","sources":["../../../../src/auth/42/utils/serializer.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAAsD;AACtD,2CAA4C;AAE5C,sEAAkE;AAG3D,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,6BAAkB;IACxD,YAA6B,WAAmC;QAC/D,KAAK,EAAE,CAAC;QADoB,gBAAW,GAAX,WAAW,CAAwB;IAEhE,CAAC;IAED,aAAa,CAAC,IAAW,EAAE,IAAyC;QACnE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,IAAW,EAAE,IAAyC;QAC3E,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACjE,IAAI,MAAM;YACT,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;;YAEnB,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACnB,CAAC;CACD,CAAA;AAhBY,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;qCAE+B,8CAAqB;GADpD,iBAAiB,CAgB7B;AAhBY,8CAAiB"}
|
||||
{"version":3,"file":"serializer.js","sourceRoot":"","sources":["../../../../src/auth/42/utils/serializer.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAAsD;AACtD,2CAA4C;AAE5C,sEAAkE;AAG3D,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,6BAAkB;IACxD,YAA6B,WAAmC;QAC/D,KAAK,EAAE,CAAC;QADoB,gBAAW,GAAX,WAAW,CAAwB;IAEhE,CAAC;IAED,aAAa,CAAC,IAAW,EAAE,IAAyC;QACnE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,IAAW,EAAE,IAAyC;QAC3E,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAChE,IAAI,MAAM;YACT,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;;YAEnB,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACnB,CAAC;CACD,CAAA;AAhBY,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;qCAE+B,8CAAqB;GADpD,iBAAiB,CAgB7B;AAhBY,8CAAiB"}
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"friendship.entity.js","sourceRoot":"","sources":["../../../src/friendship/entities/friendship.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,qCAAmI;AACnI,kEAAwD;AAExD,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC3B,mCAAe,CAAA;IACf,kCAAc,CAAA;IACd,kCAAc,CAAA;IACd,iCAAa,CAAA;AACd,CAAC,EALW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAK3B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,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC;;+CAC9B;AAEpB;IAAC,IAAA,gBAAM,GAAE;IACR,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC;;+CAC9B;AAEpB;IAAC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,gBAAgB,CAAC,SAAS,EAAC,CAAC;;0CAC5D;AAhBb,UAAU;IADtB,IAAA,gBAAM,EAAC,aAAa,CAAC;GACT,UAAU,CAiBtB;AAjBY,gCAAU"}
|
||||
@@ -1,15 +1,15 @@
|
||||
import { HttpException } from '@nestjs/common';
|
||||
import { CreateFriendshipDto } from './dto/create-friendship.dto';
|
||||
import { UpdateFriendshipDto } from './dto/update-friendship.dto';
|
||||
import { FriendshipService } from './friendship.service';
|
||||
export declare class FriendshipController {
|
||||
private readonly friendshipService;
|
||||
constructor(friendshipService: FriendshipService);
|
||||
findEmpty(userId: string): Promise<import("./entities/friendship.entity").Friendship[]>;
|
||||
findAllBlocked(userId: string): Promise<import("./entities/friendship.entity").Friendship[]>;
|
||||
findAllPendantFriendshipRequested(userId: string): Promise<import("./entities/friendship.entity").Friendship[]>;
|
||||
findAllPendantFriendshipReceived(userId: string): Promise<import("./entities/friendship.entity").Friendship[]>;
|
||||
findOneFriend(friendId: string): Promise<import("./entities/friendship.entity").Friendship[]>;
|
||||
create(createFriendshipDto: CreateFriendshipDto): Promise<import("./entities/friendship.entity").Friendship>;
|
||||
update(relationshipId: string, { status }: UpdateFriendshipDto): Promise<import("./entities/friendship.entity").Friendship>;
|
||||
remove(friendId: string): Promise<import("./entities/friendship.entity").Friendship[]>;
|
||||
findEmpty(req: any): Promise<import("./entities/friendship.entity").Friendship[]>;
|
||||
findOneFriend(relationshipId: string, req: any): Promise<import("./entities/friendship.entity").Friendship[]>;
|
||||
create(createFriendshipDto: CreateFriendshipDto, req: any): HttpException | Promise<import("./entities/friendship.entity").Friendship>;
|
||||
update(relationshipId: string, status: string, req: any): Promise<import("./entities/friendship.entity").Friendship>;
|
||||
remove(relationshipId: string): Promise<import("./entities/friendship.entity").Friendship>;
|
||||
findAllBlocked(req: any): Promise<import("./entities/friendship.entity").Friendship[]>;
|
||||
findAllPendantFriendshipRequested(req: any): Promise<import("./entities/friendship.entity").Friendship[]>;
|
||||
findAllPendantFriendshipReceived(req: any): Promise<import("./entities/friendship.entity").Friendship[]>;
|
||||
}
|
||||
|
||||
@@ -14,105 +14,117 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.FriendshipController = void 0;
|
||||
const common_1 = require("@nestjs/common");
|
||||
const jwtGuards_1 = require("../auth/42/guards/jwtGuards");
|
||||
const _42guards_1 = require("../auth/42/guards/42guards");
|
||||
const create_friendship_dto_1 = require("./dto/create-friendship.dto");
|
||||
const update_friendship_dto_1 = require("./dto/update-friendship.dto");
|
||||
const friendship_service_1 = require("./friendship.service");
|
||||
let FriendshipController = class FriendshipController {
|
||||
constructor(friendshipService) {
|
||||
this.friendshipService = friendshipService;
|
||||
}
|
||||
findEmpty(userId) {
|
||||
return this.friendshipService.findAllFriends(userId);
|
||||
findEmpty(req) {
|
||||
const user = req.user;
|
||||
return this.friendshipService.findAllFriends(user.id);
|
||||
}
|
||||
findAllBlocked(userId) {
|
||||
return this.friendshipService.findAllBlockedFriends(userId);
|
||||
findOneFriend(relationshipId, req) {
|
||||
const user = req.user;
|
||||
return this.friendshipService.findOneFriend(relationshipId, user.id);
|
||||
}
|
||||
findAllPendantFriendshipRequested(userId) {
|
||||
return this.friendshipService.findAllPendantRequestsForFriendship(userId);
|
||||
create(createFriendshipDto, req) {
|
||||
const user = req.user;
|
||||
console.log(`User id: ${user.id}\n Friend id: ${createFriendshipDto.requesterId}`);
|
||||
if (user.id === +createFriendshipDto.requesterId)
|
||||
return this.friendshipService.create(createFriendshipDto, user);
|
||||
return new common_1.HttpException('You can\'t request a frienship for another user', common_1.HttpStatus.FORBIDDEN);
|
||||
}
|
||||
findAllPendantFriendshipReceived(userId) {
|
||||
return this.friendshipService.findAllReceivedRequestsForFriendship(userId);
|
||||
update(relationshipId, status, req) {
|
||||
const user = req.user;
|
||||
return this.friendshipService.updateFriendship(relationshipId, user, status);
|
||||
}
|
||||
findOneFriend(friendId) {
|
||||
return this.friendshipService.findOneFriend(friendId);
|
||||
remove(relationshipId) {
|
||||
return this.friendshipService.removeFriendship(relationshipId);
|
||||
}
|
||||
create(createFriendshipDto) {
|
||||
return this.friendshipService.create(createFriendshipDto);
|
||||
findAllBlocked(req) {
|
||||
const user = req.user;
|
||||
return this.friendshipService.findAllBlockedFriends(user.id);
|
||||
}
|
||||
update(relationshipId, { status }) {
|
||||
return this.friendshipService.updateFriendship(relationshipId, { status });
|
||||
findAllPendantFriendshipRequested(req) {
|
||||
const user = req.user;
|
||||
return this.friendshipService.findAllPendantRequestsForFriendship(user.id);
|
||||
}
|
||||
remove(friendId) {
|
||||
return this.friendshipService.removeFriendship(friendId);
|
||||
findAllPendantFriendshipReceived(req) {
|
||||
const user = req.user;
|
||||
return this.friendshipService.findAllReceivedRequestsForFriendship(user.id);
|
||||
}
|
||||
};
|
||||
__decorate([
|
||||
(0, common_1.Get)(':userId/friends'),
|
||||
(0, common_1.UseGuards)(jwtGuards_1.JwtAuthGuard),
|
||||
__param(0, (0, common_1.Param)('userId')),
|
||||
(0, common_1.Get)('myfriends'),
|
||||
(0, common_1.UseGuards)(_42guards_1.AuthenticateGuard),
|
||||
__param(0, (0, common_1.Req)()),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [String]),
|
||||
__metadata("design:paramtypes", [Object]),
|
||||
__metadata("design:returntype", void 0)
|
||||
], FriendshipController.prototype, "findEmpty", null);
|
||||
__decorate([
|
||||
(0, common_1.Get)(':userId/blocked'),
|
||||
(0, common_1.UseGuards)(jwtGuards_1.JwtAuthGuard),
|
||||
__param(0, (0, common_1.Param)('userId')),
|
||||
(0, common_1.Get)('myfriends/:relationshipId'),
|
||||
(0, common_1.UseGuards)(_42guards_1.AuthenticateGuard),
|
||||
__param(0, (0, common_1.Param)('relationshipId')),
|
||||
__param(1, (0, common_1.Req)()),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [String]),
|
||||
__metadata("design:returntype", void 0)
|
||||
], FriendshipController.prototype, "findAllBlocked", null);
|
||||
__decorate([
|
||||
(0, common_1.Get)(':userId/pending'),
|
||||
(0, common_1.UseGuards)(jwtGuards_1.JwtAuthGuard),
|
||||
__param(0, (0, common_1.Param)('userId')),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [String]),
|
||||
__metadata("design:returntype", void 0)
|
||||
], FriendshipController.prototype, "findAllPendantFriendshipRequested", null);
|
||||
__decorate([
|
||||
(0, common_1.Get)(':userId/received'),
|
||||
(0, common_1.UseGuards)(jwtGuards_1.JwtAuthGuard),
|
||||
__param(0, (0, common_1.Param)('userId')),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [String]),
|
||||
__metadata("design:returntype", void 0)
|
||||
], FriendshipController.prototype, "findAllPendantFriendshipReceived", null);
|
||||
__decorate([
|
||||
(0, common_1.Get)(':userId/myfriends/:friendId'),
|
||||
(0, common_1.UseGuards)(jwtGuards_1.JwtAuthGuard),
|
||||
__param(0, (0, common_1.Param)('friendId')),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [String]),
|
||||
__metadata("design:paramtypes", [String, Object]),
|
||||
__metadata("design:returntype", void 0)
|
||||
], FriendshipController.prototype, "findOneFriend", null);
|
||||
__decorate([
|
||||
(0, common_1.Post)(),
|
||||
(0, common_1.Post)('myfriends'),
|
||||
(0, common_1.HttpCode)(common_1.HttpStatus.CREATED),
|
||||
(0, common_1.UseGuards)(jwtGuards_1.JwtAuthGuard),
|
||||
(0, common_1.UseGuards)(_42guards_1.AuthenticateGuard),
|
||||
__param(0, (0, common_1.Body)()),
|
||||
__param(1, (0, common_1.Req)()),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [create_friendship_dto_1.CreateFriendshipDto]),
|
||||
__metadata("design:paramtypes", [create_friendship_dto_1.CreateFriendshipDto, Object]),
|
||||
__metadata("design:returntype", void 0)
|
||||
], FriendshipController.prototype, "create", null);
|
||||
__decorate([
|
||||
(0, common_1.Patch)(':userId/received/:relationshipId'),
|
||||
(0, common_1.UseGuards)(jwtGuards_1.JwtAuthGuard),
|
||||
__param(0, (0, common_1.Param)('friendId')),
|
||||
__param(1, (0, common_1.Body)()),
|
||||
(0, common_1.Patch)('myfriends/:relationshipId'),
|
||||
(0, common_1.UseGuards)(_42guards_1.AuthenticateGuard),
|
||||
__param(0, (0, common_1.Param)('relationshipId')),
|
||||
__param(1, (0, common_1.Query)('status')),
|
||||
__param(2, (0, common_1.Req)()),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [String, update_friendship_dto_1.UpdateFriendshipDto]),
|
||||
__metadata("design:paramtypes", [String, String, Object]),
|
||||
__metadata("design:returntype", void 0)
|
||||
], FriendshipController.prototype, "update", null);
|
||||
__decorate([
|
||||
(0, common_1.Delete)(':userId/:friendId'),
|
||||
(0, common_1.UseGuards)(jwtGuards_1.JwtAuthGuard),
|
||||
__param(0, (0, common_1.Param)('friendId')),
|
||||
(0, common_1.Delete)('myfriends/:relationshipId'),
|
||||
(0, common_1.UseGuards)(_42guards_1.AuthenticateGuard),
|
||||
__param(0, (0, common_1.Param)('relationshipId')),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [String]),
|
||||
__metadata("design:returntype", void 0)
|
||||
], FriendshipController.prototype, "remove", null);
|
||||
__decorate([
|
||||
(0, common_1.Get)('blocked'),
|
||||
(0, common_1.UseGuards)(_42guards_1.AuthenticateGuard),
|
||||
__param(0, (0, common_1.Req)()),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [Object]),
|
||||
__metadata("design:returntype", void 0)
|
||||
], FriendshipController.prototype, "findAllBlocked", null);
|
||||
__decorate([
|
||||
(0, common_1.Get)('pending'),
|
||||
(0, common_1.UseGuards)(_42guards_1.AuthenticateGuard),
|
||||
__param(0, (0, common_1.Req)()),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [Object]),
|
||||
__metadata("design:returntype", void 0)
|
||||
], FriendshipController.prototype, "findAllPendantFriendshipRequested", null);
|
||||
__decorate([
|
||||
(0, common_1.Get)('received'),
|
||||
(0, common_1.UseGuards)(_42guards_1.AuthenticateGuard),
|
||||
__param(0, (0, common_1.Req)()),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [Object]),
|
||||
__metadata("design:returntype", void 0)
|
||||
], FriendshipController.prototype, "findAllPendantFriendshipReceived", null);
|
||||
FriendshipController = __decorate([
|
||||
(0, common_1.Controller)('network'),
|
||||
__metadata("design:paramtypes", [friendship_service_1.FriendshipService])
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"friendship.controller.js","sourceRoot":"","sources":["../../src/friendship/friendship.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAmI;AAEnI,2DAA4D;AAE5D,uEAAkE;AAClE,uEAAkE;AAElE,6DAAyD;AAGlD,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAChC,YAA6B,iBAAoC;QAApC,sBAAiB,GAAjB,iBAAiB,CAAmB;IAAG,CAAC;IAIrE,SAAS,CAAkB,MAAc;QACxC,OAAO,IAAI,CAAC,iBAAiB,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IACtD,CAAC;IAID,cAAc,CAAkB,MAAc;QAC7C,OAAO,IAAI,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAC7D,CAAC;IAID,iCAAiC,CAAkB,MAAc;QAChE,OAAO,IAAI,CAAC,iBA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EhD;AAED;IAAC,IAAA,YAAG,EAAC,6BAA6B,CAAC;IAClC,IAAA,kBAAS,EAAC,wBAAY,CAAC;IACT,WAAA,IAAA,cAAK,EAAC,UAAU,CAAC,CAAA;;;;yDAE/B;AAED;IAAC,IAAA,aAAI,GAAE;IACN,IAAA,iBAAQ,EAAC,mBAAU,CAAC,OAAO,CAAC;IAC5B,IAAA,kBAAS,EAAC,wBAAY,CAAC;IAChB,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAsB,2CAAmB;;kDAEtD;AAED;IAAC,IAAA,cAAK,EAAC,kCAAkC,CAAC;IACzC,IAAA,kBAAS,EAAC,wBAAY,CAAC;IAChB,WAAA,IAAA,cAAK,EAAC,UAAU,CAAC,CAAA;IAA0B,WAAA,IAAA,aAAI,GAAE,CAAA;;6CAAW,2CAAmB;;kDAEtF;AAED;IAAC,IAAA,eAAM,EAAC,mBAAmB,CAAC;IAC3B,IAAA,kBAAS,EAAC,wBAAY,CAAC;IAChB,WAAA,IAAA,cAAK,EAAC,UAAU,CAAC,CAAA;;;;kDAExB;AAlDW,oBAAoB;IADhC,IAAA,mBAAU,EAAC,SAAS,CAAC;qCAE2B,sCAAiB;GADrD,oBAAoB,CAmDhC;AAnDY,oDAAoB"}
|
||||
{"version":3,"file":"friendship.controller.js","sourceRoot":"","sources":["../../src/friendship/friendship.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA+I;AAC/I,0DAAgE;AAEhE,uEAAkE;AAGlE,6DAAyD;AAGlD,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAChC,YAA6B,iBAAoC;QAApC,sBAAiB,GAAjB,iBAAiB,CAAmB;IAAI,CAAC;IAKtE,SAAS,CAAQ,GAAG;QACnB,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;QACtB,OAAO,IAAI,CAAC,iBAAiB,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACvD,CAAC;IAKD,aAAa,CAA0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,IAAA,YAAG,GAAE,CAAA;;;;0DAGpB;AAGD;IAAC,IAAA,YAAG,EAAC,SAAS,CAAC;IACd,IAAA,kBAAS,EAAC,6BAAiB,CAAC;IACM,WAAA,IAAA,YAAG,GAAE,CAAA;;;;6EAGvC;AAGD;IAAC,IAAA,YAAG,EAAC,UAAU,CAAC;IACf,IAAA,kBAAS,EAAC,6BAAiB,CAAC;IACK,WAAA,IAAA,YAAG,GAAE,CAAA;;;;4EAGtC;AAtEW,oBAAoB;IADhC,IAAA,mBAAU,EAAC,SAAS,CAAC;qCAE2B,sCAAiB;GADrD,oBAAoB,CAuEhC;AAvEY,oDAAoB"}
|
||||
@@ -1,19 +1,18 @@
|
||||
import { User } from 'src/users/entities/user.entity';
|
||||
import { Repository } from 'typeorm';
|
||||
import { CreateFriendshipDto } from './dto/create-friendship.dto';
|
||||
import { UpdateFriendshipDto } from './dto/update-friendship.dto';
|
||||
import { Friendship } from './entities/friendship.entity';
|
||||
export declare class FriendshipService {
|
||||
private readonly friendshipRepository;
|
||||
private readonly userRepository;
|
||||
constructor(friendshipRepository: Repository<Friendship>, userRepository: Repository<User>);
|
||||
findOneFriend(id: string): Promise<Friendship[]>;
|
||||
findOneBlocked(id: string): Promise<Friendship[]>;
|
||||
findAllFriends(id: string): Promise<Friendship[]>;
|
||||
findAllBlockedFriends(id: string): Promise<Friendship[]>;
|
||||
findAllPendantRequestsForFriendship(id: string): Promise<Friendship[]>;
|
||||
findAllReceivedRequestsForFriendship(id: string): Promise<Friendship[]>;
|
||||
create(createFriendshipDto: CreateFriendshipDto): Promise<Friendship>;
|
||||
updateFriendship(id: string, updateFriendshipDto: UpdateFriendshipDto): Promise<Friendship>;
|
||||
removeFriendship(id: string): Promise<Friendship[]>;
|
||||
findOneFriend(friendshipId: string, userId: string): Promise<Friendship[]>;
|
||||
findOneBlocked(friendshipId: string): Promise<Friendship[]>;
|
||||
findAllFriends(userId: string): Promise<Friendship[]>;
|
||||
findAllBlockedFriends(userId: string): Promise<Friendship[]>;
|
||||
findAllPendantRequestsForFriendship(userId: string): Promise<Friendship[]>;
|
||||
findAllReceivedRequestsForFriendship(userId: string): Promise<Friendship[]>;
|
||||
create(createFriendshipDto: CreateFriendshipDto, creator: User): Promise<Friendship>;
|
||||
updateFriendship(relationshipId: string, user: User, status: string): Promise<Friendship>;
|
||||
removeFriendship(relationshipId: string): Promise<Friendship>;
|
||||
}
|
||||
|
||||
@@ -23,60 +23,57 @@ let FriendshipService = class FriendshipService {
|
||||
this.friendshipRepository = friendshipRepository;
|
||||
this.userRepository = userRepository;
|
||||
}
|
||||
async findOneFriend(id) {
|
||||
const friendship = await this.friendshipRepository.find({ where: { id: +id, status: friendship_entity_1.FriendshipStatus.ACCEPTED } });
|
||||
async findOneFriend(friendshipId, userId) {
|
||||
const friendship = await this.friendshipRepository.find({ where: { id: +friendshipId, requesterId: userId, status: friendship_entity_1.FriendshipStatus.ACCEPTED } });
|
||||
if (!friendship)
|
||||
throw new common_1.HttpException(`The requested friend not found.`, common_1.HttpStatus.NOT_FOUND);
|
||||
return friendship;
|
||||
}
|
||||
async findOneBlocked(id) {
|
||||
const friendship = await this.friendshipRepository.find({ where: { id: +id, status: friendship_entity_1.FriendshipStatus.BLOCKED } });
|
||||
async findOneBlocked(friendshipId) {
|
||||
const friendship = await this.friendshipRepository.find({ where: { id: +friendshipId, status: friendship_entity_1.FriendshipStatus.BLOCKED } });
|
||||
if (!friendship)
|
||||
throw new common_1.HttpException(`The requested friend not found.`, common_1.HttpStatus.NOT_FOUND);
|
||||
throw new common_1.HttpException(`The requested user not found.`, common_1.HttpStatus.NOT_FOUND);
|
||||
return friendship;
|
||||
}
|
||||
async findAllFriends(id) {
|
||||
const user = await this.userRepository.findOneBy({ id: +id });
|
||||
if (!user)
|
||||
throw new common_1.HttpException(`The requested user not found.`, common_1.HttpStatus.NOT_FOUND);
|
||||
const friends = await this.friendshipRepository.find({ where: { requesterId: id, status: friendship_entity_1.FriendshipStatus.ACCEPTED } });
|
||||
return friends;
|
||||
async findAllFriends(userId) {
|
||||
const friendship = await this.friendshipRepository
|
||||
.createQueryBuilder('friendship')
|
||||
.where('friendship.status = :status', { status: friendship_entity_1.FriendshipStatus.ACCEPTED })
|
||||
.andWhere('friendship.addresseeId = :addressee', { addressee: userId })
|
||||
.orWhere('friendship.requesterId = :requester', { requester: userId })
|
||||
.andWhere('friendship.status = :status', { status: friendship_entity_1.FriendshipStatus.ACCEPTED })
|
||||
.getMany();
|
||||
for (const friend of friendship)
|
||||
console.log("FRIENDSHIP : " + friend.status);
|
||||
return friendship;
|
||||
}
|
||||
async findAllBlockedFriends(id) {
|
||||
const user = await this.userRepository.findOneBy({ id: +id });
|
||||
if (!user)
|
||||
throw new common_1.HttpException(`The requested user not found.`, common_1.HttpStatus.NOT_FOUND);
|
||||
const blocked = await this.friendshipRepository.find({ where: { requesterId: id, status: friendship_entity_1.FriendshipStatus.BLOCKED } });
|
||||
return blocked;
|
||||
async findAllBlockedFriends(userId) {
|
||||
return await this.friendshipRepository
|
||||
.createQueryBuilder('friendship')
|
||||
.where('friendship.requesterId = :requestee', { requestee: userId })
|
||||
.orWhere('friendship.addresseeId = :addressee', { addressee: userId })
|
||||
.andWhere('friendship.status = :status', { status: friendship_entity_1.FriendshipStatus.BLOCKED })
|
||||
.getMany();
|
||||
}
|
||||
async findAllPendantRequestsForFriendship(id) {
|
||||
const user = await this.userRepository.findOneBy({ id: +id });
|
||||
if (!user)
|
||||
throw new common_1.HttpException(`The requested user not found.`, common_1.HttpStatus.NOT_FOUND);
|
||||
const requests = await this.friendshipRepository.find({
|
||||
where: { requesterId: id, status: friendship_entity_1.FriendshipStatus.REQUESTED },
|
||||
relations: ['requesterId']
|
||||
});
|
||||
return requests;
|
||||
async findAllPendantRequestsForFriendship(userId) {
|
||||
return await this.friendshipRepository
|
||||
.createQueryBuilder('friendship')
|
||||
.where('friendship.requesterId = :requestee', { requestee: userId })
|
||||
.andWhere('friendship.status = :status', { status: friendship_entity_1.FriendshipStatus.REQUESTED })
|
||||
.getMany();
|
||||
}
|
||||
async findAllReceivedRequestsForFriendship(id) {
|
||||
const user = await this.userRepository.findOneBy({ id: +id });
|
||||
if (!user)
|
||||
throw new common_1.HttpException(`The requested user not found.`, common_1.HttpStatus.NOT_FOUND);
|
||||
const requests = await this.friendshipRepository.find({
|
||||
where: { addresseeId: id, status: friendship_entity_1.FriendshipStatus.REQUESTED },
|
||||
relations: ['addresseeId']
|
||||
});
|
||||
return requests;
|
||||
async findAllReceivedRequestsForFriendship(userId) {
|
||||
return await this.friendshipRepository
|
||||
.createQueryBuilder('friendship')
|
||||
.where('friendship.addresseeId = :addressee', { addressee: userId })
|
||||
.andWhere('friendship.status = :status', { status: friendship_entity_1.FriendshipStatus.REQUESTED })
|
||||
.getMany();
|
||||
}
|
||||
async create(createFriendshipDto) {
|
||||
const requester = await this.userRepository.findOneBy({ id: +createFriendshipDto.requesterId });
|
||||
if (!requester)
|
||||
throw new common_1.HttpException(`The user does not exist.`, common_1.HttpStatus.NOT_FOUND);
|
||||
async create(createFriendshipDto, creator) {
|
||||
const addressee = await this.userRepository.findOneBy({ id: +createFriendshipDto.addresseeId });
|
||||
if (!addressee)
|
||||
throw new common_1.HttpException(`The user does not exist.`, common_1.HttpStatus.NOT_FOUND);
|
||||
if (createFriendshipDto.requesterId == createFriendshipDto.addresseeId)
|
||||
throw new common_1.HttpException(`The addressee does not exist.`, common_1.HttpStatus.NOT_FOUND);
|
||||
if (creator.id === addressee.id)
|
||||
throw new common_1.HttpException(`You can't add yourself.`, common_1.HttpStatus.NOT_FOUND);
|
||||
const friendship = await this.friendshipRepository.findOneBy({ requesterId: createFriendshipDto.requesterId, addresseeId: createFriendshipDto.addresseeId });
|
||||
if (friendship) {
|
||||
@@ -85,21 +82,31 @@ let FriendshipService = class FriendshipService {
|
||||
else if (friendship.status && friendship.status === friendship_entity_1.FriendshipStatus.REQUESTED)
|
||||
throw new common_1.HttpException(`The friendship request has already been sent the ${friendship.date}.`, common_1.HttpStatus.OK);
|
||||
else if (friendship.status && friendship.status === friendship_entity_1.FriendshipStatus.BLOCKED)
|
||||
throw new common_1.HttpException(``, common_1.HttpStatus.OK);
|
||||
throw new common_1.HttpException(`We can't do that`, common_1.HttpStatus.OK);
|
||||
else if (friendship.status && friendship.status === friendship_entity_1.FriendshipStatus.DECLINED)
|
||||
throw new common_1.HttpException(`The request has been declined.`, common_1.HttpStatus.OK);
|
||||
}
|
||||
const newFriendship = this.friendshipRepository.create({ requesterId: createFriendshipDto.requesterId, addresseeId: createFriendshipDto.addresseeId, status: friendship_entity_1.FriendshipStatus.REQUESTED });
|
||||
return this.friendshipRepository.save(newFriendship);
|
||||
}
|
||||
async updateFriendship(id, updateFriendshipDto) {
|
||||
const friendship = await this.friendshipRepository.preload(Object.assign({ id: +id }, updateFriendshipDto));
|
||||
if (!friendship)
|
||||
throw new common_1.HttpException(`The friendship could not be updated.`, common_1.HttpStatus.NOT_FOUND);
|
||||
return this.friendshipRepository.save(friendship);
|
||||
async updateFriendship(relationshipId, user, status) {
|
||||
const relation = await this.friendshipRepository.findOneBy({ id: +relationshipId });
|
||||
if (!relation)
|
||||
throw new common_1.HttpException(`The requested relationship not found.`, common_1.HttpStatus.NOT_FOUND);
|
||||
if (status === friendship_entity_1.FriendshipStatus.ACCEPTED)
|
||||
relation.status = friendship_entity_1.FriendshipStatus.ACCEPTED;
|
||||
else if (status === friendship_entity_1.FriendshipStatus.DECLINED)
|
||||
relation.status = friendship_entity_1.FriendshipStatus.DECLINED;
|
||||
else if (status === friendship_entity_1.FriendshipStatus.BLOCKED)
|
||||
relation.status = friendship_entity_1.FriendshipStatus.BLOCKED;
|
||||
else
|
||||
throw new common_1.HttpException(`The status is not valid.`, common_1.HttpStatus.NOT_FOUND);
|
||||
if (relation.status !== status)
|
||||
throw new common_1.HttpException(`We could not update the status.`, common_1.HttpStatus.OK);
|
||||
return this.friendshipRepository.save(relation);
|
||||
}
|
||||
async removeFriendship(id) {
|
||||
const friendship = await this.findOneFriend(id);
|
||||
async removeFriendship(relationshipId) {
|
||||
const friendship = await this.friendshipRepository.findOneBy({ id: +relationshipId });
|
||||
if (!friendship)
|
||||
throw new common_1.HttpException(`Your friend could not be deleted.`, common_1.HttpStatus.NOT_FOUND);
|
||||
return this.friendshipRepository.remove(friendship);
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"friendship.service.js","sourceRoot":"","sources":["../../src/friendship/friendship.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAuE;AACvE,6CAAmD;AACnD,+DAAsD;AACtD,qCAAqC;AAGrC,oEAA4E;AAGrE,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAE7B,YAEkB,oBAA4C,EAE5C,cAAgC;QAFhC,yBAAoB,GAApB,oBAAoB,CAAwB;QAE5C,mBAAc,GAAd,cAAc,CAAkB;IAC/C,CAAC;IAGJ,KAAK,CAAC,aAAa,CAAC,EAAU;QAC7B,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAC,KAAK,EAAE,EAAC,EAAE,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,oCAAgB,CAAC,QAAQ,EAAC,EAAC,CAAC,CAAC;QAC/G,IAAI,CAAC,UAAU;YACd,MAAM,IAAI,sBAAa,CAAC,iCAAiC,EAAC,mBAAU,CAAC,SAAS,CAAC,CAAC;QACjF,OAAO,UAAU,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,EAAU;QAC9B,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAC,KAAK,EAAE,EAAC,EAAE,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,oCAAgB,CAAC,OAAO,EAAC,EAAC,CAAC,CAAC;QAC9G,IAAI,CAAC,UAAU;YACd,MAAM,IAAI,sBAAa,CAAC,iCAAiC,EAAC,mBAAU,CAAC,SAAS,CAAC,CAAC;QACjF,OAAO,UAAU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a,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,EAAU,EAAE,mBAAwC;QAE1E,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO,iBACxD,EAAE,EAAE,CAAC,EAAE,IACL,mBAAmB,EAAE,CAAC;QAC1B,IAAI,CAAC,UAAU;YACd,MAAM,IAAI,sBAAa,CAAC,sCAAsC,EAAC,mBAAU,CAAC,SAAS,CAAC,CAAC;QACtF,OAAO,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACnD,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,EAAU;QAChC,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QAChD,IAAI,CAAC,UAAU;YACd,MAAM,IAAI,sBAAa,CAAC,mCAAmC,EAAC,mBAAU,CAAC,SAAS,CAAC,CAAC;QACnF,OAAO,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACrD,CAAC;CACD,CAAA;AAzGY,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;IAIV,WAAA,IAAA,0BAAgB,EAAC,8BAAU,CAAC,CAAA;IAE5B,WAAA,IAAA,0BAAgB,EAAC,kBAAI,CAAC,CAAA;qCADgB,oBAAU;QAEhB,oBAAU;GANhC,iBAAiB,CAyG7B;AAzGY,8CAAiB"}
|
||||
{"version":3,"file":"friendship.service.js","sourceRoot":"","sources":["../../src/friendship/friendship.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAuE;AACvE,6CAAmD;AACnD,+DAAsD;AACtD,qCAAqC;AAGrC,oEAA4E;AAGrE,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAE7B,YAEkB,oBAA4C,EAE5C,cAAgC;QAFhC,yBAAoB,GAApB,oBAAoB,CAAwB;QAE5C,mBAAc,GAAd,cAAc,CAAkB;IAC9C,CAAC;I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IAAI,sBAAa,CAAC,mCAAmC,EAAE,mBAAU,CAAC,SAAS,CAAC,CAAC;QACpF,OAAO,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACrD,CAAC;CACD,CAAA;AA9GY,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;IAIV,WAAA,IAAA,0BAAgB,EAAC,8BAAU,CAAC,CAAA;IAE5B,WAAA,IAAA,0BAAgB,EAAC,kBAAI,CAAC,CAAA;qCADgB,oBAAU;QAEhB,oBAAU;GANhC,iBAAiB,CA8G7B;AA9GY,8CAAiB"}
|
||||
@@ -17,7 +17,7 @@ async function bootstrap() {
|
||||
client.connect();
|
||||
const RedisStore = connectRedis(session);
|
||||
client.on('connect', () => {
|
||||
console.log("Redis Connected");
|
||||
console.log("Redis successfully Connected");
|
||||
});
|
||||
app.useGlobalPipes(new common_1.ValidationPipe({
|
||||
whitelist: true,
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;AAAA,uCAA2C;AAC3C,2CAAgD;AAChD,6CAAyC;AACzC,2CAA2C;AAC3C,qCAAqC;AACrC,+BAA+B;AAC/B,8CAA8C;AAE9C,KAAK,UAAU,SAAS;IACvB,MAAM,GAAG,GAAG,MAAM,kBAAW,CAAC,MAAM,CAAC,sBAAS,CAAC,CAAC;IAChD,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC;IACtC,MAAM,MAAM,GAAG,KAAK,CAAC,YAAY,CAChC;QACC,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;QAChF,UAAU,EAAE,IAAI;KAChB,CACD,CAAC;IACF,MAAM,CAAC,OAAO,EAAE,CAAC;IACjB,MAAM,UAAU,GAAG,YAAY,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AAG,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7E,CAAC;AACD,SAAS,EAAE,CAAC"}
|
||||
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
||||
export declare class CreateUsersDto {
|
||||
readonly username: string;
|
||||
readonly fourtyTwoId: string;
|
||||
readonly fortyTwoId: string;
|
||||
readonly email: string;
|
||||
readonly image_url: string;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ __decorate([
|
||||
__decorate([
|
||||
(0, class_validator_1.IsString)(),
|
||||
__metadata("design:type", String)
|
||||
], CreateUsersDto.prototype, "fourtyTwoId", void 0);
|
||||
], CreateUsersDto.prototype, "fortyTwoId", void 0);
|
||||
__decorate([
|
||||
(0, class_validator_1.IsEmail)(),
|
||||
__metadata("design:type", String)
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"create-users.dto.js","sourceRoot":"","sources":["../../../src/users/dto/create-users.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAoD;AAGpD,MAAa,cAAc;CAS1B;AARA;IAAC,IAAA,0BAAQ,GAAE;;gDACe;AAC1B;IAAC,IAAA,0BAAQ,GAAE;;mDACkB;AAC7B;IAAC,IAAA,yBAAO,GAAE;;6CACa;AACvB;IAAC,IAAA,0BAAQ,GAAE;;iDACgB;AAR5B,wCASC"}
|
||||
{"version":3,"file":"create-users.dto.js","sourceRoot":"","sources":["../../../src/users/dto/create-users.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAoD;AAGpD,MAAa,cAAc;CAS1B;AARA;IAAC,IAAA,0BAAQ,GAAE;;gDACe;AAC1B;IAAC,IAAA,0BAAQ,GAAE;;kDACiB;AAC5B;IAAC,IAAA,yBAAO,GAAE;;6CACa;AACvB;IAAC,IAAA,0BAAQ,GAAE;;iDACgB;AAR5B,wCASC"}
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Friendship } from "../../friendship/entities/friendship.entity";
|
||||
export declare class User {
|
||||
id: number;
|
||||
fourtyTwoId: string;
|
||||
fortyTwoId: string;
|
||||
username: string;
|
||||
email: string;
|
||||
image_url: string;
|
||||
|
||||
@@ -22,7 +22,7 @@ __decorate([
|
||||
__decorate([
|
||||
(0, typeorm_1.Column)({ unique: true }),
|
||||
__metadata("design:type", String)
|
||||
], User.prototype, "fourtyTwoId", void 0);
|
||||
], User.prototype, "fortyTwoId", void 0);
|
||||
__decorate([
|
||||
(0, typeorm_1.Column)(),
|
||||
__metadata("design:type", String)
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"user.entity.js","sourceRoot":"","sources":["../../../src/users/entities/user.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,qDAAkD;AAClD,qCAA2G;AAC3G,mFAAyE;AAKlE,IAAM,IAAI,GAAV,MAAM,IAAI;CA+BhB,CAAA;AA7BA;IAAC,IAAA,gCAAsB,GAAE;;gCACd;AAEX;IAAC,IAAA,gBAAM,EAAC,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC;;yCACH;AAEpB;IAAC,IAAA,gBAAM,GAAE;;sCACQ;AAEjB;IAAC,IAAA,gBAAM,GAAE;IACR,IAAA,yBAAO,GAAE;;mCACI;AAEd;IAAC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uCACR;AAEnB;IAAC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mCACb;AAEd;IAAC,IAAA,gBAAM,EAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;oCAClB;AAEjB;IAAC,IAAA,mBAAS,GAAE;IACX,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,8BAAU,EAAG,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC;;yCA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EAAE,CAAC,UAAU,CAAC,WAAW,CAAC;;yCAC7C;AA9Bd,IAAI;IAFhB,IAAA,gBAAM,EAAC,MAAM,CAAC;IACd,IAAA,gBAAM,EAAC,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;GACjB,IAAI,CA+BhB;AA/BY,oBAAI"}
|
||||
@@ -27,8 +27,6 @@ let UsersController = class UsersController {
|
||||
return this.usersService.findAll(paginationquery);
|
||||
}
|
||||
findOne(req) {
|
||||
console.log('INSIDE USER CONTROLLER');
|
||||
console.log(req.user);
|
||||
return this.usersService.findOne(req.user.id);
|
||||
}
|
||||
create(createUsersDto) {
|
||||
@@ -67,8 +65,8 @@ __decorate([
|
||||
__metadata("design:returntype", void 0)
|
||||
], UsersController.prototype, "create", null);
|
||||
__decorate([
|
||||
(0, common_1.Patch)(),
|
||||
(0, common_1.UseGuards)(_42guards_1.AuthenticateGuard),
|
||||
(0, common_1.Patch)(),
|
||||
__param(0, (0, common_1.Req)()),
|
||||
__param(1, (0, common_1.Body)()),
|
||||
__metadata("design:type", Function),
|
||||
@@ -76,8 +74,8 @@ __decorate([
|
||||
__metadata("design:returntype", void 0)
|
||||
], UsersController.prototype, "update", null);
|
||||
__decorate([
|
||||
(0, common_1.Delete)(':id'),
|
||||
(0, common_1.UseGuards)(_42guards_1.AuthenticateGuard),
|
||||
(0, common_1.Delete)(),
|
||||
__param(0, (0, common_1.Req)()),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [Object]),
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"users.controller.js","sourceRoot":"","sources":["../../src/users/users.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAGwB;AACxB,0DAAgE;AAChE,6EAAyE;AACzE,6DAAwD;AACxD,6DAAwD;AAExD,mDAA+C;AAIxC,IAAM,eAAe,GAArB,MAAM,eAAe;IAC3B,YAA6B,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;IAAG,CAAC;I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AC;IAC9C,CAAC;CACD,CAAA;AAxCA;IAAC,IAAA,kBAAS,EAAC,6BAAiB,CAAC;IAC5B,IAAA,YAAG,EAAC,KAAK,CAAC;IACF,WAAA,IAAA,cAAK,GAAE,CAAA;;qCAAmB,yCAAkB;;8CAGpD;AAWD;IAAC,IAAA,kBAAS,EAAC,6BAAiB,CAAC;IAC5B,IAAA,YAAG,GAAE;IACG,WAAA,IAAA,YAAG,GAAE,CAAA;;;;8CAEb;AAED;IAAC,IAAA,kBAAS,EAAC,6BAAiB,CAAC;IAC5B,IAAA,aAAI,GAAE;IACN,IAAA,iBAAQ,EAAC,mBAAU,CAAC,OAAO,CAAC;IACrB,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAkB,iCAAc;;6CAE7C;AAED;IAAC,IAAA,kBAAS,EAAC,6BAAiB,CAAC;IAC5B,IAAA,cAAK,GAAE;IACA,WAAA,IAAA,YAAG,GAAE,CAAA;IAAO,WAAA,IAAA,aAAI,GAAE,CAAA;;6CAAiB,iCAAc;;6CAExD;AAED;IAAC,IAAA,kBAAS,EAAC,6BAAiB,CAAC;IAC5B,IAAA,eAAM,GAAE;IACD,WAAA,IAAA,YAAG,GAAE,CAAA;;;;6CAEZ;AA3CW,eAAe;IAD3B,IAAA,mBAAU,EAAC,MAAM,CAAC;qCAEyB,4BAAY;GAD3C,eAAe,CA4C3B;AA5CY,0CAAe"}
|
||||
@@ -8,7 +8,7 @@ export declare class UsersService {
|
||||
private readonly userRepository;
|
||||
private readonly friendshipRepository;
|
||||
constructor(userRepository: Repository<User>, friendshipRepository: Repository<Friendship>);
|
||||
findOneByFourtyTwoId(fourtytwo_id: string): Promise<User>;
|
||||
findOneByFourtyTwoId(fortytwo_id: string): Promise<User>;
|
||||
findOne(id: string): Promise<User>;
|
||||
findAll(paginationquery: PaginationQueryDto): Promise<User[]>;
|
||||
create(createUserDto: CreateUsersDto): Promise<User>;
|
||||
|
||||
@@ -18,17 +18,13 @@ const typeorm_1 = require("@nestjs/typeorm");
|
||||
const user_entity_1 = require("./entities/user.entity");
|
||||
const typeorm_2 = require("typeorm");
|
||||
const friendship_entity_1 = require("../friendship/entities/friendship.entity");
|
||||
const class_validator_1 = require("class-validator");
|
||||
let UsersService = class UsersService {
|
||||
constructor(userRepository, friendshipRepository) {
|
||||
this.userRepository = userRepository;
|
||||
this.friendshipRepository = friendshipRepository;
|
||||
}
|
||||
async findOneByFourtyTwoId(fourtytwo_id) {
|
||||
console.log(`Find user with fourtytwo_id ${fourtytwo_id}`);
|
||||
if (!(0, class_validator_1.isNumberString)(fourtytwo_id))
|
||||
throw new common_1.HttpException(`The requested user not found.`, common_1.HttpStatus.NOT_FOUND);
|
||||
const user = await this.userRepository.findOneBy({ fourtyTwoId: fourtytwo_id });
|
||||
async findOneByFourtyTwoId(fortytwo_id) {
|
||||
const user = await this.userRepository.findOneBy({ fortyTwoId: fortytwo_id });
|
||||
if (!user) {
|
||||
console.log(`The requested user not found.`);
|
||||
return null;
|
||||
@@ -50,8 +46,7 @@ let UsersService = class UsersService {
|
||||
});
|
||||
}
|
||||
async create(createUserDto) {
|
||||
console.log(`Create user with ${createUserDto}`);
|
||||
if (await this.userRepository.findOneBy({ fourtyTwoId: createUserDto.fourtyTwoId }))
|
||||
if (await this.userRepository.findOneBy({ fortyTwoId: createUserDto.fortyTwoId }))
|
||||
throw new common_1.HttpException(`The user already exists.`, common_1.HttpStatus.CONFLICT);
|
||||
const user = this.userRepository.create(createUserDto);
|
||||
if (!user)
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"users.service.js","sourceRoot":"","sources":["../../src/users/users.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAsG;AACtG,6CAAmD;AAEnD,wDAA8C;AAC9C,qCAA8D;AAG9D,gFAAsE;AACtE,qDAAiD;AAM1C,IAAM,YAAY,GAAlB,MAAM,YAAY;IAExB,YAEiB,cAAgC,EAEhC,oBAA4C;QAF5C,mBAAc,GAAd,cAAc,CAAkB;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