@social.dev/server-sdk 0.0.1-alpha.50 → 0.0.1-alpha.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat/chat.acl.js +1 -4
- package/dist/chat/chat.acl.js.map +1 -1
- package/dist/chat/chat.controller.d.ts +6 -2
- package/dist/chat/chat.controller.js +43 -7
- package/dist/chat/chat.controller.js.map +1 -1
- package/dist/chat/chat.module.js +2 -0
- package/dist/chat/chat.module.js.map +1 -1
- package/dist/chat/chat.service.d.ts +13 -3
- package/dist/chat/chat.service.js +74 -34
- package/dist/chat/chat.service.js.map +1 -1
- package/dist/chat/dto/responses.dto.d.ts +15 -7
- package/dist/chat/dto/responses.dto.js +85 -30
- package/dist/chat/dto/responses.dto.js.map +1 -1
- package/dist/chat/dto/update-cursor.dto.d.ts +5 -0
- package/dist/chat/dto/update-cursor.dto.js +36 -0
- package/dist/chat/dto/update-cursor.dto.js.map +1 -0
- package/dist/chat/entities/conversation.entity.d.ts +2 -1
- package/dist/chat/entities/conversation.entity.js +6 -7
- package/dist/chat/entities/conversation.entity.js.map +1 -1
- package/dist/chat/entities/read-cursor.entity.d.ts +10 -0
- package/dist/chat/entities/read-cursor.entity.js +64 -0
- package/dist/chat/entities/read-cursor.entity.js.map +1 -0
- package/dist/migrations/1760444646328-ChatReadCursor.d.ts +6 -0
- package/dist/migrations/1760444646328-ChatReadCursor.js +18 -0
- package/dist/migrations/1760444646328-ChatReadCursor.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -8,8 +8,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
+
var _a, _b;
|
|
11
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
13
|
+
exports.ChatUnreadCountDto = exports.ChatConversationResponseDto = exports.ChatMessageResponseDto = void 0;
|
|
13
14
|
const openapi = require("@nestjs/swagger");
|
|
14
15
|
const class_transformer_1 = require("class-transformer");
|
|
15
16
|
const user_response_dto_1 = require("../../user/dto/user-response.dto");
|
|
@@ -17,15 +18,55 @@ const conversation_member_entity_1 = require("../entities/conversation-member.en
|
|
|
17
18
|
const conversation_type_enum_1 = require("../enums/conversation-type.enum");
|
|
18
19
|
const swagger_1 = require("@nestjs/swagger");
|
|
19
20
|
const media_response_dto_1 = require("../../media/dto/media-response.dto");
|
|
21
|
+
const community_response_dto_1 = require("../../community/dto/community-response.dto");
|
|
22
|
+
class ChatMessageResponseDto {
|
|
23
|
+
id;
|
|
24
|
+
text;
|
|
25
|
+
audio;
|
|
26
|
+
sender;
|
|
27
|
+
createdAt;
|
|
28
|
+
static _OPENAPI_METADATA_FACTORY() {
|
|
29
|
+
return { id: { required: true, type: () => Number }, text: { required: false, type: () => String }, audio: { required: false, type: () => require("../../media/dto/media-response.dto").MediaResponseDto }, sender: { required: true, type: () => require("../../user/dto/user-response.dto").UserResponseDto }, createdAt: { required: true, type: () => Date } };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.ChatMessageResponseDto = ChatMessageResponseDto;
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, class_transformer_1.Expose)(),
|
|
35
|
+
__metadata("design:type", Object)
|
|
36
|
+
], ChatMessageResponseDto.prototype, "id", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, class_transformer_1.Expose)(),
|
|
39
|
+
__metadata("design:type", Object)
|
|
40
|
+
], ChatMessageResponseDto.prototype, "text", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, swagger_1.ApiProperty)({
|
|
43
|
+
description: 'Audio voice recording',
|
|
44
|
+
}),
|
|
45
|
+
(0, class_transformer_1.Type)(() => media_response_dto_1.MediaResponseDto),
|
|
46
|
+
(0, class_transformer_1.Expose)(),
|
|
47
|
+
__metadata("design:type", media_response_dto_1.MediaResponseDto)
|
|
48
|
+
], ChatMessageResponseDto.prototype, "audio", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, class_transformer_1.Expose)(),
|
|
51
|
+
(0, class_transformer_1.Type)(() => user_response_dto_1.UserResponseDto),
|
|
52
|
+
__metadata("design:type", user_response_dto_1.UserResponseDto)
|
|
53
|
+
], ChatMessageResponseDto.prototype, "sender", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, class_transformer_1.Expose)(),
|
|
56
|
+
__metadata("design:type", Date)
|
|
57
|
+
], ChatMessageResponseDto.prototype, "createdAt", void 0);
|
|
20
58
|
class ChatConversationResponseDto {
|
|
21
59
|
id;
|
|
22
60
|
name;
|
|
23
61
|
membersCount;
|
|
24
62
|
type;
|
|
25
63
|
members;
|
|
64
|
+
community;
|
|
65
|
+
lastReadTs;
|
|
26
66
|
latestMessage;
|
|
67
|
+
isUnread;
|
|
27
68
|
static _OPENAPI_METADATA_FACTORY() {
|
|
28
|
-
return { id: { required: true, type: () => Number }, name: { required: true, type: () => String }, membersCount: { required: true, type: () => Number }, type: { required: true, enum: require("../enums/conversation-type.enum").ConversationType }, members: { required: true, type: () => [require("../../user/dto/user-response.dto").UserResponseDto] }, latestMessage: { required: true, type: () =>
|
|
69
|
+
return { id: { required: true, type: () => Number }, name: { required: true, type: () => String }, membersCount: { required: true, type: () => Number }, type: { required: true, enum: require("../enums/conversation-type.enum").ConversationType }, members: { required: true, type: () => [require("../../user/dto/user-response.dto").UserResponseDto] }, community: { required: true, type: () => require("../../community/dto/community-response.dto").CommunityResponseDto }, lastReadTs: { required: true, type: () => Date }, latestMessage: { required: true, type: () => require("./responses.dto").ChatMessageResponseDto }, isUnread: { required: true, type: () => Boolean } };
|
|
29
70
|
}
|
|
30
71
|
}
|
|
31
72
|
exports.ChatConversationResponseDto = ChatConversationResponseDto;
|
|
@@ -57,42 +98,56 @@ __decorate([
|
|
|
57
98
|
], ChatConversationResponseDto.prototype, "members", void 0);
|
|
58
99
|
__decorate([
|
|
59
100
|
(0, class_transformer_1.Expose)(),
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
audio;
|
|
66
|
-
sender;
|
|
67
|
-
createdAt;
|
|
68
|
-
static _OPENAPI_METADATA_FACTORY() {
|
|
69
|
-
return { id: { required: true, type: () => Number }, text: { required: false, type: () => String }, audio: { required: false, type: () => require("../../media/dto/media-response.dto").MediaResponseDto }, sender: { required: true, type: () => require("../../user/dto/user-response.dto").UserResponseDto }, createdAt: { required: true, type: () => Date } };
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
exports.ChatMessageResponseDto = ChatMessageResponseDto;
|
|
101
|
+
(0, class_transformer_1.Transform)(({ obj }) => {
|
|
102
|
+
return (0, class_transformer_1.plainToInstance)(community_response_dto_1.CommunityResponseDto, obj.community);
|
|
103
|
+
}),
|
|
104
|
+
__metadata("design:type", community_response_dto_1.CommunityResponseDto)
|
|
105
|
+
], ChatConversationResponseDto.prototype, "community", void 0);
|
|
73
106
|
__decorate([
|
|
74
107
|
(0, class_transformer_1.Expose)(),
|
|
75
|
-
|
|
76
|
-
|
|
108
|
+
(0, class_transformer_1.Transform)(({ obj }) => {
|
|
109
|
+
return obj.readCursor?.ts;
|
|
110
|
+
}),
|
|
111
|
+
__metadata("design:type", Date)
|
|
112
|
+
], ChatConversationResponseDto.prototype, "lastReadTs", void 0);
|
|
77
113
|
__decorate([
|
|
78
114
|
(0, class_transformer_1.Expose)(),
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
__decorate([
|
|
82
|
-
(0, swagger_1.ApiProperty)({
|
|
83
|
-
description: 'Audio voice recording',
|
|
115
|
+
(0, class_transformer_1.Transform)(({ obj }) => {
|
|
116
|
+
return (0, class_transformer_1.plainToInstance)(ChatMessageResponseDto, obj.lastMessage);
|
|
84
117
|
}),
|
|
85
|
-
(
|
|
118
|
+
__metadata("design:type", ChatMessageResponseDto)
|
|
119
|
+
], ChatConversationResponseDto.prototype, "latestMessage", void 0);
|
|
120
|
+
__decorate([
|
|
86
121
|
(0, class_transformer_1.Expose)(),
|
|
87
|
-
|
|
88
|
-
|
|
122
|
+
(0, class_transformer_1.Transform)(({ obj }) => {
|
|
123
|
+
if (!obj.readCursor) {
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
return ((obj.lastMessage?.createdAt).getTime() >
|
|
127
|
+
obj.readCursor?.ts.getTime());
|
|
128
|
+
}),
|
|
129
|
+
__metadata("design:type", Boolean)
|
|
130
|
+
], ChatConversationResponseDto.prototype, "isUnread", void 0);
|
|
131
|
+
class ChatUnreadCountDto {
|
|
132
|
+
[_a = conversation_type_enum_1.ConversationType.OneOnOne];
|
|
133
|
+
[_b = conversation_type_enum_1.ConversationType.Community];
|
|
134
|
+
static _OPENAPI_METADATA_FACTORY() {
|
|
135
|
+
return {};
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
exports.ChatUnreadCountDto = ChatUnreadCountDto;
|
|
89
139
|
__decorate([
|
|
90
140
|
(0, class_transformer_1.Expose)(),
|
|
91
|
-
(0,
|
|
92
|
-
|
|
93
|
-
|
|
141
|
+
(0, swagger_1.ApiProperty)({
|
|
142
|
+
name: conversation_type_enum_1.ConversationType.OneOnOne,
|
|
143
|
+
}),
|
|
144
|
+
__metadata("design:type", Number)
|
|
145
|
+
], ChatUnreadCountDto.prototype, _a, void 0);
|
|
94
146
|
__decorate([
|
|
95
147
|
(0, class_transformer_1.Expose)(),
|
|
96
|
-
|
|
97
|
-
|
|
148
|
+
(0, swagger_1.ApiProperty)({
|
|
149
|
+
name: conversation_type_enum_1.ConversationType.Community,
|
|
150
|
+
}),
|
|
151
|
+
__metadata("design:type", Number)
|
|
152
|
+
], ChatUnreadCountDto.prototype, _b, void 0);
|
|
98
153
|
//# sourceMappingURL=responses.dto.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responses.dto.js","sourceRoot":"","sources":["../../../src/chat/dto/responses.dto.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"responses.dto.js","sourceRoot":"","sources":["../../../src/chat/dto/responses.dto.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.UpdateChatReadCursorDto = void 0;
|
|
13
|
+
const openapi = require("@nestjs/swagger");
|
|
14
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
15
|
+
const class_transformer_1 = require("class-transformer");
|
|
16
|
+
class UpdateChatReadCursorDto {
|
|
17
|
+
conversation;
|
|
18
|
+
unixts;
|
|
19
|
+
static _OPENAPI_METADATA_FACTORY() {
|
|
20
|
+
return { conversation: { required: true, type: () => Number }, unixts: { required: true, type: () => Number } };
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.UpdateChatReadCursorDto = UpdateChatReadCursorDto;
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, class_transformer_1.Expose)(),
|
|
26
|
+
(0, swagger_1.ApiProperty)({ description: 'ID of the conversation' }),
|
|
27
|
+
__metadata("design:type", Object)
|
|
28
|
+
], UpdateChatReadCursorDto.prototype, "conversation", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, class_transformer_1.Expose)(),
|
|
31
|
+
(0, swagger_1.ApiProperty)({
|
|
32
|
+
description: 'UNIX timestamp of the position of the read cursor',
|
|
33
|
+
}),
|
|
34
|
+
__metadata("design:type", Number)
|
|
35
|
+
], UpdateChatReadCursorDto.prototype, "unixts", void 0);
|
|
36
|
+
//# sourceMappingURL=update-cursor.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-cursor.dto.js","sourceRoot":"","sources":["../../../src/chat/dto/update-cursor.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,6CAA8C;AAC9C,yDAA2C;AAG3C,MAAa,uBAAuB;IAGlC,YAAY,CAAyB;IAMrC,MAAM,CAAS;;;;CAChB;AAVD,0DAUC;AAPC;IAFC,IAAA,0BAAM,GAAE;IACR,IAAA,qBAAW,EAAC,EAAE,WAAW,EAAE,wBAAwB,EAAE,CAAC;;6DAClB;AAMrC;IAJC,IAAA,0BAAM,GAAE;IACR,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,mDAAmD;KACjE,CAAC;;uDACa"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { ConversationType } from '../enums/conversation-type.enum';
|
|
2
2
|
import { ChatConversationMember } from './conversation-member.entity';
|
|
3
3
|
import { Community } from '~/community/entities/community.entity';
|
|
4
|
+
import { ChatMessage } from './message.entity';
|
|
4
5
|
export declare class ChatConversation {
|
|
5
6
|
id: number;
|
|
6
7
|
type: ConversationType;
|
|
7
8
|
name: string;
|
|
8
9
|
members: ChatConversationMember[];
|
|
9
10
|
community: Community;
|
|
10
|
-
|
|
11
|
+
messages: ChatMessage[];
|
|
11
12
|
createdAt: Date;
|
|
12
13
|
}
|
|
@@ -15,16 +15,17 @@ const typeorm_1 = require("typeorm");
|
|
|
15
15
|
const conversation_type_enum_1 = require("../enums/conversation-type.enum");
|
|
16
16
|
const conversation_member_entity_1 = require("./conversation-member.entity");
|
|
17
17
|
const community_entity_1 = require("../../community/entities/community.entity");
|
|
18
|
+
const message_entity_1 = require("./message.entity");
|
|
18
19
|
let ChatConversation = class ChatConversation {
|
|
19
20
|
id;
|
|
20
21
|
type;
|
|
21
22
|
name;
|
|
22
23
|
members;
|
|
23
24
|
community;
|
|
24
|
-
|
|
25
|
+
messages;
|
|
25
26
|
createdAt;
|
|
26
27
|
static _OPENAPI_METADATA_FACTORY() {
|
|
27
|
-
return { id: { required: true, type: () => Number }, type: { required: true, enum: require("../enums/conversation-type.enum").ConversationType }, name: { required: true, type: () => String }, members: { required: true, type: () => [require("./conversation-member.entity").ChatConversationMember] }, community: { required: true, type: () => require("../../community/entities/community.entity").Community },
|
|
28
|
+
return { id: { required: true, type: () => Number }, type: { required: true, enum: require("../enums/conversation-type.enum").ConversationType }, name: { required: true, type: () => String }, members: { required: true, type: () => [require("./conversation-member.entity").ChatConversationMember] }, community: { required: true, type: () => require("../../community/entities/community.entity").Community }, messages: { required: true, type: () => [require("./message.entity").ChatMessage] }, createdAt: { required: true, type: () => Date } };
|
|
28
29
|
}
|
|
29
30
|
};
|
|
30
31
|
exports.ChatConversation = ChatConversation;
|
|
@@ -54,11 +55,9 @@ __decorate([
|
|
|
54
55
|
__metadata("design:type", community_entity_1.Community)
|
|
55
56
|
], ChatConversation.prototype, "community", void 0);
|
|
56
57
|
__decorate([
|
|
57
|
-
(0, typeorm_1.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
__metadata("design:type", String)
|
|
61
|
-
], ChatConversation.prototype, "latestMessage", void 0);
|
|
58
|
+
(0, typeorm_1.OneToMany)(() => message_entity_1.ChatMessage, (message) => message.conversation),
|
|
59
|
+
__metadata("design:type", Array)
|
|
60
|
+
], ChatConversation.prototype, "messages", void 0);
|
|
62
61
|
__decorate([
|
|
63
62
|
(0, typeorm_1.CreateDateColumn)(),
|
|
64
63
|
__metadata("design:type", Date)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.entity.js","sourceRoot":"","sources":["../../../src/chat/entities/conversation.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qCAUiB;AACjB,4EAAmE;AACnE,6EAAsE;AACtE,gFAAkE;
|
|
1
|
+
{"version":3,"file":"conversation.entity.js","sourceRoot":"","sources":["../../../src/chat/entities/conversation.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qCAUiB;AACjB,4EAAmE;AACnE,6EAAsE;AACtE,gFAAkE;AAClE,qDAA+C;AAGxC,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAE3B,EAAE,CAAS;IAOX,IAAI,CAAmB;IAGvB,IAAI,CAAS;IAIb,OAAO,CAA2B;IAGlC,SAAS,CAAY;IAGrB,QAAQ,CAAgB;IAGxB,SAAS,CAAO;;;;CACjB,CAAA;AA1BY,4CAAgB;AAE3B;IADC,IAAA,gCAAsB,GAAE;;4CACd;AAOX;IALC,IAAA,gBAAM,EAAC;QACN,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,yCAAgB;QACtB,OAAO,EAAE,yCAAgB,CAAC,QAAQ;KACnC,CAAC;;8CACqB;AAGvB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACd;AAIb;IAFC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,mDAAsB,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC;IACxE,IAAA,mBAAS,GAAE;;iDACsB;AAGlC;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,4BAAS,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACzD,4BAAS;mDAAC;AAGrB;IADC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,4BAAW,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC;;kDACxC;AAGxB;IADC,IAAA,0BAAgB,GAAE;8BACR,IAAI;mDAAC;2BAzBL,gBAAgB;IAD5B,IAAA,gBAAM,GAAE;GACI,gBAAgB,CA0B5B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ChatConversation } from './conversation.entity';
|
|
2
|
+
import { User } from '~/user/entities/user.entity';
|
|
3
|
+
export declare class ChatReadCursor {
|
|
4
|
+
readonly conversationId: ChatConversation['id'];
|
|
5
|
+
conversation: ChatConversation;
|
|
6
|
+
readonly userId: User['id'];
|
|
7
|
+
user: User;
|
|
8
|
+
ts: Date;
|
|
9
|
+
updatedAt: Date;
|
|
10
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ChatReadCursor = void 0;
|
|
13
|
+
const openapi = require("@nestjs/swagger");
|
|
14
|
+
const typeorm_1 = require("typeorm");
|
|
15
|
+
const conversation_entity_1 = require("./conversation.entity");
|
|
16
|
+
const user_entity_1 = require("../../user/entities/user.entity");
|
|
17
|
+
let ChatReadCursor = class ChatReadCursor {
|
|
18
|
+
conversationId;
|
|
19
|
+
conversation;
|
|
20
|
+
userId;
|
|
21
|
+
user;
|
|
22
|
+
ts;
|
|
23
|
+
updatedAt;
|
|
24
|
+
static _OPENAPI_METADATA_FACTORY() {
|
|
25
|
+
return { conversationId: { required: true, type: () => Number }, conversation: { required: true, type: () => require("./conversation.entity").ChatConversation }, userId: { required: true, type: () => Number }, user: { required: true, type: () => require("../../user/entities/user.entity").User }, ts: { required: true, type: () => Date }, updatedAt: { required: true, type: () => Date } };
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
exports.ChatReadCursor = ChatReadCursor;
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, typeorm_1.PrimaryColumn)(),
|
|
31
|
+
__metadata("design:type", Object)
|
|
32
|
+
], ChatReadCursor.prototype, "conversationId", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, typeorm_1.ManyToOne)(() => conversation_entity_1.ChatConversation, (conversation) => conversation.members, {
|
|
35
|
+
eager: true,
|
|
36
|
+
cascade: true,
|
|
37
|
+
}),
|
|
38
|
+
(0, typeorm_1.JoinColumn)({ name: 'conversationId' }),
|
|
39
|
+
__metadata("design:type", conversation_entity_1.ChatConversation)
|
|
40
|
+
], ChatReadCursor.prototype, "conversation", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, typeorm_1.PrimaryColumn)(),
|
|
43
|
+
__metadata("design:type", Object)
|
|
44
|
+
], ChatReadCursor.prototype, "userId", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, typeorm_1.ManyToOne)(() => user_entity_1.User, (user) => user.chats, {
|
|
47
|
+
eager: true,
|
|
48
|
+
cascade: true,
|
|
49
|
+
}),
|
|
50
|
+
(0, typeorm_1.JoinColumn)({ name: 'userId' }),
|
|
51
|
+
__metadata("design:type", user_entity_1.User)
|
|
52
|
+
], ChatReadCursor.prototype, "user", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, typeorm_1.Column)(),
|
|
55
|
+
__metadata("design:type", Date)
|
|
56
|
+
], ChatReadCursor.prototype, "ts", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, typeorm_1.UpdateDateColumn)(),
|
|
59
|
+
__metadata("design:type", Date)
|
|
60
|
+
], ChatReadCursor.prototype, "updatedAt", void 0);
|
|
61
|
+
exports.ChatReadCursor = ChatReadCursor = __decorate([
|
|
62
|
+
(0, typeorm_1.Entity)()
|
|
63
|
+
], ChatReadCursor);
|
|
64
|
+
//# sourceMappingURL=read-cursor.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-cursor.entity.js","sourceRoot":"","sources":["../../../src/chat/entities/read-cursor.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qCAQiB;AACjB,+DAAyD;AACzD,iEAAmD;AAG5C,IAAM,cAAc,GAApB,MAAM,cAAc;IAKhB,cAAc,CAAyB;IAUhD,YAAY,CAAmB;IAMtB,MAAM,CAAa;IAU5B,IAAI,CAAO;IAGX,EAAE,CAAO;IAGT,SAAS,CAAO;;;;CACjB,CAAA;AAtCY,wCAAc;AAKhB;IADR,IAAA,uBAAa,GAAE;;sDACgC;AAUhD;IALC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,sCAAgB,EAAE,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE;QACzE,KAAK,EAAE,IAAI;QACX,OAAO,EAAE,IAAI;KACd,CAAC;IACD,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC;8BACzB,sCAAgB;oDAAC;AAMtB;IADR,IAAA,uBAAa,GAAE;;8CACY;AAU5B;IALC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,kBAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE;QAC3C,KAAK,EAAE,IAAI;QACX,OAAO,EAAE,IAAI;KACd,CAAC;IACD,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;8BACzB,kBAAI;4CAAC;AAGX;IADC,IAAA,gBAAM,GAAE;8BACL,IAAI;0CAAC;AAGT;IADC,IAAA,0BAAgB,GAAE;8BACR,IAAI;iDAAC;yBArCL,cAAc;IAD1B,IAAA,gBAAM,GAAE;GACI,cAAc,CAsC1B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChatReadCursor1760444646328 = void 0;
|
|
4
|
+
class ChatReadCursor1760444646328 {
|
|
5
|
+
name = 'ChatReadCursor1760444646328';
|
|
6
|
+
async up(queryRunner) {
|
|
7
|
+
await queryRunner.query(`CREATE TABLE "chat_read_cursor" ("conversationId" integer NOT NULL, "userId" integer NOT NULL, "ts" TIMESTAMP NOT NULL, "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_1a8a46f2037a2855419b177b5c4" PRIMARY KEY ("conversationId", "userId"))`);
|
|
8
|
+
await queryRunner.query(`ALTER TABLE "chat_read_cursor" ADD CONSTRAINT "FK_8ceddfc4c2260367933ca36cacf" FOREIGN KEY ("conversationId") REFERENCES "chat_conversation"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
|
9
|
+
await queryRunner.query(`ALTER TABLE "chat_read_cursor" ADD CONSTRAINT "FK_7e7a9e30b62cdb02ed03ab44211" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
|
10
|
+
}
|
|
11
|
+
async down(queryRunner) {
|
|
12
|
+
await queryRunner.query(`ALTER TABLE "chat_read_cursor" DROP CONSTRAINT "FK_7e7a9e30b62cdb02ed03ab44211"`);
|
|
13
|
+
await queryRunner.query(`ALTER TABLE "chat_read_cursor" DROP CONSTRAINT "FK_8ceddfc4c2260367933ca36cacf"`);
|
|
14
|
+
await queryRunner.query(`DROP TABLE "chat_read_cursor"`);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.ChatReadCursor1760444646328 = ChatReadCursor1760444646328;
|
|
18
|
+
//# sourceMappingURL=1760444646328-ChatReadCursor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1760444646328-ChatReadCursor.js","sourceRoot":"","sources":["../../src/migrations/1760444646328-ChatReadCursor.ts"],"names":[],"mappings":";;;AAEA,MAAa,2BAA2B;IACpC,IAAI,GAAG,6BAA6B,CAAA;IAE7B,KAAK,CAAC,EAAE,CAAC,WAAwB;QACpC,MAAM,WAAW,CAAC,KAAK,CAAC,6PAA6P,CAAC,CAAC;QACvR,MAAM,WAAW,CAAC,KAAK,CAAC,4LAA4L,CAAC,CAAC;QACtN,MAAM,WAAW,CAAC,KAAK,CAAC,uKAAuK,CAAC,CAAC;IACrM,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,WAAwB;QACtC,MAAM,WAAW,CAAC,KAAK,CAAC,iFAAiF,CAAC,CAAC;QAC3G,MAAM,WAAW,CAAC,KAAK,CAAC,iFAAiF,CAAC,CAAC;QAC3G,MAAM,WAAW,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;IAC7D,CAAC;CAEJ;AAfD,kEAeC"}
|