Configure remote database connection and update documentation

This commit is contained in:
Bivekich
2025-08-06 02:24:01 +03:00
parent 5bd7d79642
commit e1b79f017a
67 changed files with 1513 additions and 15 deletions

View File

@ -0,0 +1,82 @@
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConversationsResolver = void 0;
const graphql_1 = require("@nestjs/graphql");
const common_1 = require("@nestjs/common");
const conversations_service_1 = require("./conversations.service");
const conversation_entity_1 = require("./entities/conversation.entity");
const gql_auth_guard_1 = require("../auth/guards/gql-auth.guard");
const current_user_decorator_1 = require("../auth/decorators/current-user.decorator");
const user_entity_1 = require("../users/entities/user.entity");
let ConversationsResolver = class ConversationsResolver {
conversationsService;
constructor(conversationsService) {
this.conversationsService = conversationsService;
}
findAll(user) {
return this.conversationsService.findAllForUser(user.id);
}
findOne(id, user) {
return this.conversationsService.findOne(id, user.id);
}
createConversation(user, participantIds, name) {
const isGroup = participantIds.length > 1;
const allParticipantIds = [...participantIds, user.id];
const participants = allParticipantIds.map(id => ({ id }));
return this.conversationsService.create(participants, name, isGroup);
}
createPrivateConversation(user, recipientId) {
return this.conversationsService.findOrCreatePrivate(user.id, recipientId);
}
};
exports.ConversationsResolver = ConversationsResolver;
__decorate([
(0, graphql_1.Query)(() => [conversation_entity_1.Conversation], { name: 'conversations' }),
__param(0, (0, current_user_decorator_1.CurrentUser)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [user_entity_1.User]),
__metadata("design:returntype", void 0)
], ConversationsResolver.prototype, "findAll", null);
__decorate([
(0, graphql_1.Query)(() => conversation_entity_1.Conversation, { name: 'conversation' }),
__param(0, (0, graphql_1.Args)('id', { type: () => graphql_1.ID })),
__param(1, (0, current_user_decorator_1.CurrentUser)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String, user_entity_1.User]),
__metadata("design:returntype", void 0)
], ConversationsResolver.prototype, "findOne", null);
__decorate([
(0, graphql_1.Mutation)(() => conversation_entity_1.Conversation),
__param(0, (0, current_user_decorator_1.CurrentUser)()),
__param(1, (0, graphql_1.Args)('participantIds', { type: () => [graphql_1.ID] })),
__param(2, (0, graphql_1.Args)('name', { nullable: true })),
__metadata("design:type", Function),
__metadata("design:paramtypes", [user_entity_1.User, Array, String]),
__metadata("design:returntype", void 0)
], ConversationsResolver.prototype, "createConversation", null);
__decorate([
(0, graphql_1.Mutation)(() => conversation_entity_1.Conversation),
__param(0, (0, current_user_decorator_1.CurrentUser)()),
__param(1, (0, graphql_1.Args)('recipientId', { type: () => graphql_1.ID })),
__metadata("design:type", Function),
__metadata("design:paramtypes", [user_entity_1.User, String]),
__metadata("design:returntype", void 0)
], ConversationsResolver.prototype, "createPrivateConversation", null);
exports.ConversationsResolver = ConversationsResolver = __decorate([
(0, graphql_1.Resolver)(() => conversation_entity_1.Conversation),
(0, common_1.UseGuards)(gql_auth_guard_1.GqlAuthGuard),
__metadata("design:paramtypes", [conversations_service_1.ConversationsService])
], ConversationsResolver);
//# sourceMappingURL=conversations.resolver.js.map