Configure remote database connection and update documentation
This commit is contained in:
2
backend/dist/modules/conversations/conversations.module.d.ts
vendored
Normal file
2
backend/dist/modules/conversations/conversations.module.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
export declare class ConversationsModule {
|
||||
}
|
25
backend/dist/modules/conversations/conversations.module.js
vendored
Normal file
25
backend/dist/modules/conversations/conversations.module.js
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
"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;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ConversationsModule = void 0;
|
||||
const common_1 = require("@nestjs/common");
|
||||
const typeorm_1 = require("@nestjs/typeorm");
|
||||
const conversations_service_1 = require("./conversations.service");
|
||||
const conversations_resolver_1 = require("./conversations.resolver");
|
||||
const conversation_entity_1 = require("./entities/conversation.entity");
|
||||
let ConversationsModule = class ConversationsModule {
|
||||
};
|
||||
exports.ConversationsModule = ConversationsModule;
|
||||
exports.ConversationsModule = ConversationsModule = __decorate([
|
||||
(0, common_1.Module)({
|
||||
imports: [typeorm_1.TypeOrmModule.forFeature([conversation_entity_1.Conversation])],
|
||||
providers: [conversations_resolver_1.ConversationsResolver, conversations_service_1.ConversationsService],
|
||||
exports: [conversations_service_1.ConversationsService],
|
||||
})
|
||||
], ConversationsModule);
|
||||
//# sourceMappingURL=conversations.module.js.map
|
1
backend/dist/modules/conversations/conversations.module.js.map
vendored
Normal file
1
backend/dist/modules/conversations/conversations.module.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"conversations.module.js","sourceRoot":"","sources":["../../../src/modules/conversations/conversations.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,6CAAgD;AAChD,mEAA+D;AAC/D,qEAAiE;AACjE,wEAA8D;AAOvD,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;CAAG,CAAA;AAAtB,kDAAmB;8BAAnB,mBAAmB;IAL/B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,uBAAa,CAAC,UAAU,CAAC,CAAC,kCAAY,CAAC,CAAC,CAAC;QACnD,SAAS,EAAE,CAAC,8CAAqB,EAAE,4CAAoB,CAAC;QACxD,OAAO,EAAE,CAAC,4CAAoB,CAAC;KAChC,CAAC;GACW,mBAAmB,CAAG"}
|
11
backend/dist/modules/conversations/conversations.resolver.d.ts
vendored
Normal file
11
backend/dist/modules/conversations/conversations.resolver.d.ts
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
import { ConversationsService } from './conversations.service';
|
||||
import { Conversation } from './entities/conversation.entity';
|
||||
import { User } from '../users/entities/user.entity';
|
||||
export declare class ConversationsResolver {
|
||||
private readonly conversationsService;
|
||||
constructor(conversationsService: ConversationsService);
|
||||
findAll(user: User): Promise<Conversation[]>;
|
||||
findOne(id: string, user: User): Promise<Conversation>;
|
||||
createConversation(user: User, participantIds: string[], name?: string): Promise<Conversation>;
|
||||
createPrivateConversation(user: User, recipientId: string): Promise<Conversation>;
|
||||
}
|
82
backend/dist/modules/conversations/conversations.resolver.js
vendored
Normal file
82
backend/dist/modules/conversations/conversations.resolver.js
vendored
Normal 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
|
1
backend/dist/modules/conversations/conversations.resolver.js.map
vendored
Normal file
1
backend/dist/modules/conversations/conversations.resolver.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"conversations.resolver.js","sourceRoot":"","sources":["../../../src/modules/conversations/conversations.resolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAAsE;AACtE,2CAA2C;AAC3C,mEAA+D;AAC/D,wEAA8D;AAC9D,kEAA6D;AAC7D,sFAAwE;AACxE,+DAAqD;AAI9C,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IACH;IAA7B,YAA6B,oBAA0C;QAA1C,yBAAoB,GAApB,oBAAoB,CAAsB;IAAG,CAAC;IAG3E,OAAO,CAAgB,IAAU;QAC/B,OAAO,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC3D,CAAC;IAGD,OAAO,CAC2B,EAAU,EAC3B,IAAU;QAEzB,OAAO,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IACxD,CAAC;IAGD,kBAAkB,CACD,IAAU,EACqB,cAAwB,EACpC,IAAa;QAE/C,MAAM,OAAO,GAAG,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC;QAE1C,MAAM,iBAAiB,GAAG,CAAC,GAAG,cAAc,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QACvD,MAAM,YAAY,GAAG,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,EAAW,CAAA,CAAC,CAAC;QACnE,OAAO,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACvE,CAAC;IAGD,yBAAyB,CACR,IAAU,EACgB,WAAmB;QAE5D,OAAO,IAAI,CAAC,oBAAoB,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC;IAC7E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backend/dist/modules/conversations/conversations.service.d.ts
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
import { Repository } from 'typeorm';
|
||||
import { Conversation } from './entities/conversation.entity';
|
||||
import { User } from '../users/entities/user.entity';
|
||||
export declare class ConversationsService {
|
||||
private conversationsRepository;
|
||||
constructor(conversationsRepository: Repository<Conversation>);
|
||||
create(participants: User[], name?: string, isGroup?: boolean): Promise<Conversation>;
|
||||
findAllForUser(userId: string): Promise<Conversation[]>;
|
||||
findOne(id: string, userId: string): Promise<Conversation>;
|
||||
findOrCreatePrivate(user1Id: string, user2Id: string): Promise<Conversation>;
|
||||
addParticipant(conversationId: string, userId: string, participantId: string): Promise<Conversation>;
|
||||
}
|
89
backend/dist/modules/conversations/conversations.service.js
vendored
Normal file
89
backend/dist/modules/conversations/conversations.service.js
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
"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.ConversationsService = void 0;
|
||||
const common_1 = require("@nestjs/common");
|
||||
const typeorm_1 = require("@nestjs/typeorm");
|
||||
const typeorm_2 = require("typeorm");
|
||||
const conversation_entity_1 = require("./entities/conversation.entity");
|
||||
let ConversationsService = class ConversationsService {
|
||||
conversationsRepository;
|
||||
constructor(conversationsRepository) {
|
||||
this.conversationsRepository = conversationsRepository;
|
||||
}
|
||||
async create(participants, name, isGroup = false) {
|
||||
const conversation = this.conversationsRepository.create({
|
||||
participants,
|
||||
name,
|
||||
isGroup,
|
||||
});
|
||||
return this.conversationsRepository.save(conversation);
|
||||
}
|
||||
async findAllForUser(userId) {
|
||||
return this.conversationsRepository
|
||||
.createQueryBuilder('conversation')
|
||||
.leftJoinAndSelect('conversation.participants', 'participants')
|
||||
.leftJoinAndSelect('conversation.messages', 'messages')
|
||||
.leftJoin('conversation.participants', 'user')
|
||||
.where('user.id = :userId', { userId })
|
||||
.orderBy('messages.createdAt', 'DESC')
|
||||
.getMany();
|
||||
}
|
||||
async findOne(id, userId) {
|
||||
const conversation = await this.conversationsRepository
|
||||
.createQueryBuilder('conversation')
|
||||
.leftJoinAndSelect('conversation.participants', 'participants')
|
||||
.leftJoinAndSelect('conversation.messages', 'messages')
|
||||
.leftJoinAndSelect('messages.sender', 'sender')
|
||||
.where('conversation.id = :id', { id })
|
||||
.orderBy('messages.createdAt', 'ASC')
|
||||
.getOne();
|
||||
if (!conversation) {
|
||||
throw new common_1.NotFoundException('Беседа не найдена');
|
||||
}
|
||||
const isParticipant = conversation.participants.some(p => p.id === userId);
|
||||
if (!isParticipant) {
|
||||
throw new common_1.ForbiddenException('Вы не являетесь участником этой беседы');
|
||||
}
|
||||
return conversation;
|
||||
}
|
||||
async findOrCreatePrivate(user1Id, user2Id) {
|
||||
const existingConversation = await this.conversationsRepository
|
||||
.createQueryBuilder('conversation')
|
||||
.leftJoin('conversation.participants', 'p1')
|
||||
.leftJoin('conversation.participants', 'p2')
|
||||
.where('conversation.isGroup = false')
|
||||
.andWhere('p1.id = :user1Id', { user1Id })
|
||||
.andWhere('p2.id = :user2Id', { user2Id })
|
||||
.getOne();
|
||||
if (existingConversation) {
|
||||
return existingConversation;
|
||||
}
|
||||
return this.create([], undefined, false);
|
||||
}
|
||||
async addParticipant(conversationId, userId, participantId) {
|
||||
const conversation = await this.findOne(conversationId, userId);
|
||||
if (!conversation.isGroup) {
|
||||
throw new common_1.ForbiddenException('Нельзя добавлять участников в приватные беседы');
|
||||
}
|
||||
return conversation;
|
||||
}
|
||||
};
|
||||
exports.ConversationsService = ConversationsService;
|
||||
exports.ConversationsService = ConversationsService = __decorate([
|
||||
(0, common_1.Injectable)(),
|
||||
__param(0, (0, typeorm_1.InjectRepository)(conversation_entity_1.Conversation)),
|
||||
__metadata("design:paramtypes", [typeorm_2.Repository])
|
||||
], ConversationsService);
|
||||
//# sourceMappingURL=conversations.service.js.map
|
1
backend/dist/modules/conversations/conversations.service.js.map
vendored
Normal file
1
backend/dist/modules/conversations/conversations.service.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"conversations.service.js","sourceRoot":"","sources":["../../../src/modules/conversations/conversations.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAmF;AACnF,6CAAmD;AACnD,qCAAqC;AACrC,wEAA8D;AAIvD,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAGrB;IAFV,YAEU,uBAAiD;QAAjD,4BAAuB,GAAvB,uBAAuB,CAA0B;IACxD,CAAC;IAEJ,KAAK,CAAC,MAAM,CAAC,YAAoB,EAAE,IAAa,EAAE,OAAO,GAAG,KAAK;QAC/D,MAAM,YAAY,GAAG,IAAI,CAAC,uBAAuB,CAAC,MAAM,CAAC;YACvD,YAAY;YACZ,IAAI;YACJ,OAAO;SACR,CAAC,CAAC;QACH,OAAO,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACzD,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,MAAc;QACjC,OAAO,IAAI,CAAC,uBAAuB;aAChC,kBAAkB,CAAC,cAAc,CAAC;aAClC,iBAAiB,CAAC,2BAA2B,EAAE,cAAc,CAAC;aAC9D,iBAAi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AA8B,CAAC;aACrC,QAAQ,CAAC,kBAAkB,EAAE,EAAE,OAAO,EAAE,CAAC;aACzC,QAAQ,CAAC,kBAAkB,EAAE,EAAE,OAAO,EAAE,CAAC;aACzC,MAAM,EAAE,CAAC;QAEZ,IAAI,oBAAoB,EAAE,CAAC;YACzB,OAAO,oBAAoB,CAAC;QAC9B,CAAC;QAGD,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,cAAsB,EAAE,MAAc,EAAE,aAAqB;QAChF,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;QAEhE,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;YAC1B,MAAM,IAAI,2BAAkB,CAAC,gDAAgD,CAAC,CAAC;QACjF,CAAC;QAGD,OAAO,YAAY,CAAC;IACtB,CAAC;CACF,CAAA;AA5EY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,0BAAgB,EAAC,kCAAY,CAAC,CAAA;qCACE,oBAAU;GAHlC,oBAAoB,CA4EhC"}
|
12
backend/dist/modules/conversations/entities/conversation.entity.d.ts
vendored
Normal file
12
backend/dist/modules/conversations/entities/conversation.entity.d.ts
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
import { User } from '../../users/entities/user.entity';
|
||||
import { Message } from '../../messages/entities/message.entity';
|
||||
export declare class Conversation {
|
||||
id: string;
|
||||
name?: string;
|
||||
isGroup: boolean;
|
||||
participants: User[];
|
||||
messages: Message[];
|
||||
lastMessage?: Message;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
}
|
76
backend/dist/modules/conversations/entities/conversation.entity.js
vendored
Normal file
76
backend/dist/modules/conversations/entities/conversation.entity.js
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
"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);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Conversation = void 0;
|
||||
const graphql_1 = require("@nestjs/graphql");
|
||||
const typeorm_1 = require("typeorm");
|
||||
const user_entity_1 = require("../../users/entities/user.entity");
|
||||
const message_entity_1 = require("../../messages/entities/message.entity");
|
||||
let Conversation = class Conversation {
|
||||
id;
|
||||
name;
|
||||
isGroup;
|
||||
participants;
|
||||
messages;
|
||||
lastMessage;
|
||||
createdAt;
|
||||
updatedAt;
|
||||
};
|
||||
exports.Conversation = Conversation;
|
||||
__decorate([
|
||||
(0, graphql_1.Field)(() => graphql_1.ID),
|
||||
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
||||
__metadata("design:type", String)
|
||||
], Conversation.prototype, "id", void 0);
|
||||
__decorate([
|
||||
(0, graphql_1.Field)(() => String, { nullable: true }),
|
||||
(0, typeorm_1.Column)({ nullable: true }),
|
||||
__metadata("design:type", String)
|
||||
], Conversation.prototype, "name", void 0);
|
||||
__decorate([
|
||||
(0, graphql_1.Field)(() => Boolean),
|
||||
(0, typeorm_1.Column)({ default: false }),
|
||||
__metadata("design:type", Boolean)
|
||||
], Conversation.prototype, "isGroup", void 0);
|
||||
__decorate([
|
||||
(0, graphql_1.Field)(() => [user_entity_1.User]),
|
||||
(0, typeorm_1.ManyToMany)(() => user_entity_1.User),
|
||||
(0, typeorm_1.JoinTable)({
|
||||
name: 'conversation_participants',
|
||||
joinColumn: { name: 'conversationId', referencedColumnName: 'id' },
|
||||
inverseJoinColumn: { name: 'userId', referencedColumnName: 'id' },
|
||||
}),
|
||||
__metadata("design:type", Array)
|
||||
], Conversation.prototype, "participants", void 0);
|
||||
__decorate([
|
||||
(0, graphql_1.Field)(() => [message_entity_1.Message]),
|
||||
(0, typeorm_1.OneToMany)(() => message_entity_1.Message, message => message.conversation),
|
||||
__metadata("design:type", Array)
|
||||
], Conversation.prototype, "messages", void 0);
|
||||
__decorate([
|
||||
(0, graphql_1.Field)(() => message_entity_1.Message, { nullable: true }),
|
||||
__metadata("design:type", message_entity_1.Message)
|
||||
], Conversation.prototype, "lastMessage", void 0);
|
||||
__decorate([
|
||||
(0, graphql_1.Field)(() => Date),
|
||||
(0, typeorm_1.CreateDateColumn)(),
|
||||
__metadata("design:type", Date)
|
||||
], Conversation.prototype, "createdAt", void 0);
|
||||
__decorate([
|
||||
(0, graphql_1.Field)(() => Date),
|
||||
(0, typeorm_1.UpdateDateColumn)(),
|
||||
__metadata("design:type", Date)
|
||||
], Conversation.prototype, "updatedAt", void 0);
|
||||
exports.Conversation = Conversation = __decorate([
|
||||
(0, graphql_1.ObjectType)(),
|
||||
(0, typeorm_1.Entity)('conversations')
|
||||
], Conversation);
|
||||
//# sourceMappingURL=conversation.entity.js.map
|
1
backend/dist/modules/conversations/entities/conversation.entity.js.map
vendored
Normal file
1
backend/dist/modules/conversations/entities/conversation.entity.js.map
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"conversation.entity.js","sourceRoot":"","sources":["../../../../src/modules/conversations/entities/conversation.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAwD;AACxD,qCAAuI;AACvI,kEAAwD;AACxD,2EAAiE;AAI1D,IAAM,YAAY,GAAlB,MAAM,YAAY;IAGvB,EAAE,CAAS;IAIX,IAAI,C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