@signa-app/dto 0.1.0
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/README.md +36 -0
- package/dist/dto/auth.dto.d.ts +37 -0
- package/dist/dto/auth.dto.d.ts.map +1 -0
- package/dist/dto/auth.dto.js +213 -0
- package/dist/dto/auth.dto.js.map +1 -0
- package/dist/dto/box-offer.dto.d.ts +17 -0
- package/dist/dto/box-offer.dto.d.ts.map +1 -0
- package/dist/dto/box-offer.dto.js +86 -0
- package/dist/dto/box-offer.dto.js.map +1 -0
- package/dist/dto/box-slot.dto.d.ts +18 -0
- package/dist/dto/box-slot.dto.d.ts.map +1 -0
- package/dist/dto/box-slot.dto.js +89 -0
- package/dist/dto/box-slot.dto.js.map +1 -0
- package/dist/dto/box.dto.d.ts +23 -0
- package/dist/dto/box.dto.d.ts.map +1 -0
- package/dist/dto/box.dto.js +107 -0
- package/dist/dto/box.dto.js.map +1 -0
- package/dist/dto/chat.dto.d.ts +38 -0
- package/dist/dto/chat.dto.d.ts.map +1 -0
- package/dist/dto/chat.dto.js +181 -0
- package/dist/dto/chat.dto.js.map +1 -0
- package/dist/dto/message.dto.d.ts +41 -0
- package/dist/dto/message.dto.d.ts.map +1 -0
- package/dist/dto/message.dto.js +263 -0
- package/dist/dto/message.dto.js.map +1 -0
- package/dist/dto/payment.d.ts +60 -0
- package/dist/dto/payment.d.ts.map +1 -0
- package/dist/dto/payment.js +258 -0
- package/dist/dto/payment.js.map +1 -0
- package/dist/dto/user.dto.d.ts +18 -0
- package/dist/dto/user.dto.d.ts.map +1 -0
- package/dist/dto/user.dto.js +96 -0
- package/dist/dto/user.dto.js.map +1 -0
- package/dist/dto//321/201ommon.dto.d.ts +19 -0
- package/dist/dto//321/201ommon.dto.d.ts.map +1 -0
- package/dist/dto//321/201ommon.dto.js +53 -0
- package/dist/dto//321/201ommon.dto.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -0
- package/dist/types/query-parameters.d.ts +19 -0
- package/dist/types/query-parameters.d.ts.map +1 -0
- package/dist/types/query-parameters.js +3 -0
- package/dist/types/query-parameters.js.map +1 -0
- package/package.json +45 -0
|
@@ -0,0 +1,107 @@
|
|
|
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.BoxUpdateAndCloseResponseDTO = exports.BoxUpdateAndCloseRequestDTO = exports.BoxUpdateDTO = exports.BoxDTO = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const entities_1 = require("@signa-app/entities");
|
|
15
|
+
const class_validator_1 = require("class-validator");
|
|
16
|
+
class BoxDTO {
|
|
17
|
+
static fromEntity(entity) {
|
|
18
|
+
const dto = new BoxDTO();
|
|
19
|
+
dto.uuid = entity.uuid;
|
|
20
|
+
dto.ownerUuid = entity.owner?.uuid ?? entity.owner_uuid; // fallback just in case
|
|
21
|
+
dto.name = entity.name ?? null;
|
|
22
|
+
dto.price = entity?.price ? String(entity.price) : null;
|
|
23
|
+
dto.currency = entity.currency ?? null;
|
|
24
|
+
dto.actualFileSizeBytes = entity.actualFileSizeBytes != null ? String(entity.actualFileSizeBytes) : null;
|
|
25
|
+
dto.isClosed = entity.isClosed;
|
|
26
|
+
dto.slotUuid = entity.slot?.uuid ?? entity.slot_uuid ?? null;
|
|
27
|
+
return dto;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.BoxDTO = BoxDTO;
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, swagger_1.ApiProperty)({ description: "Box UUID", example: "123e4567-e89b-12d3-a456-426614174000" }),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], BoxDTO.prototype, "uuid", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, swagger_1.ApiProperty)({ description: "Owner UUID", example: "123e4567-e89b-12d3-a456-426614174001" }),
|
|
37
|
+
__metadata("design:type", String)
|
|
38
|
+
], BoxDTO.prototype, "ownerUuid", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, swagger_1.ApiPropertyOptional)({ description: "Box name", example: "My first box", nullable: true }),
|
|
41
|
+
__metadata("design:type", Object)
|
|
42
|
+
], BoxDTO.prototype, "name", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, swagger_1.ApiPropertyOptional)({ description: "Box price (bigint)", example: "1500", nullable: true }),
|
|
45
|
+
__metadata("design:type", Object)
|
|
46
|
+
], BoxDTO.prototype, "price", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, swagger_1.ApiPropertyOptional)({ description: "Currency", enum: entities_1.ECurrency, nullable: true }),
|
|
49
|
+
__metadata("design:type", Object)
|
|
50
|
+
], BoxDTO.prototype, "currency", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, swagger_1.ApiPropertyOptional)({ description: "Actual file size in bytes (bigint)", example: "1048576", nullable: true }),
|
|
53
|
+
__metadata("design:type", Object)
|
|
54
|
+
], BoxDTO.prototype, "actualFileSizeBytes", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, swagger_1.ApiProperty)({ description: "Whether box is closed", example: false, default: false }),
|
|
57
|
+
__metadata("design:type", Boolean)
|
|
58
|
+
], BoxDTO.prototype, "isClosed", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
61
|
+
description: "Slot UUID if box is linked to a global slot",
|
|
62
|
+
example: "123e4567-e89b-12d3-a456-426614174099",
|
|
63
|
+
nullable: true,
|
|
64
|
+
}),
|
|
65
|
+
__metadata("design:type", Object)
|
|
66
|
+
], BoxDTO.prototype, "slotUuid", void 0);
|
|
67
|
+
class BoxUpdateDTO {
|
|
68
|
+
}
|
|
69
|
+
exports.BoxUpdateDTO = BoxUpdateDTO;
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, swagger_1.ApiPropertyOptional)({ description: "Box name", example: "My first box", nullable: true }),
|
|
72
|
+
(0, class_validator_1.IsOptional)(),
|
|
73
|
+
(0, class_validator_1.IsString)(),
|
|
74
|
+
(0, class_validator_1.MaxLength)(255),
|
|
75
|
+
__metadata("design:type", Object)
|
|
76
|
+
], BoxUpdateDTO.prototype, "name", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
(0, swagger_1.ApiPropertyOptional)({ description: "Box price (bigint)", example: "1500", nullable: true }),
|
|
79
|
+
(0, class_validator_1.IsOptional)(),
|
|
80
|
+
(0, class_validator_1.IsString)(),
|
|
81
|
+
__metadata("design:type", Object)
|
|
82
|
+
], BoxUpdateDTO.prototype, "price", void 0);
|
|
83
|
+
class BoxUpdateAndCloseRequestDTO {
|
|
84
|
+
}
|
|
85
|
+
exports.BoxUpdateAndCloseRequestDTO = BoxUpdateAndCloseRequestDTO;
|
|
86
|
+
__decorate([
|
|
87
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
88
|
+
description: "Key of files archive frontend generated",
|
|
89
|
+
example: "f4b7c91...",
|
|
90
|
+
nullable: false,
|
|
91
|
+
}),
|
|
92
|
+
(0, class_validator_1.IsOptional)(),
|
|
93
|
+
(0, class_validator_1.IsString)(),
|
|
94
|
+
__metadata("design:type", String)
|
|
95
|
+
], BoxUpdateAndCloseRequestDTO.prototype, "boxContentKey", void 0);
|
|
96
|
+
class BoxUpdateAndCloseResponseDTO {
|
|
97
|
+
}
|
|
98
|
+
exports.BoxUpdateAndCloseResponseDTO = BoxUpdateAndCloseResponseDTO;
|
|
99
|
+
__decorate([
|
|
100
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
101
|
+
description: "Presigned URL to upload the files archive",
|
|
102
|
+
example: "https://example.com/upload/presigned-url",
|
|
103
|
+
nullable: false,
|
|
104
|
+
}),
|
|
105
|
+
__metadata("design:type", String)
|
|
106
|
+
], BoxUpdateAndCloseResponseDTO.prototype, "presignedUrl", void 0);
|
|
107
|
+
//# sourceMappingURL=box.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"box.dto.js","sourceRoot":"","sources":["../../src/dto/box.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAiE;AACjE,kDAAyD;AACzD,qDAAgE;AAEhE,MAAa,MAAM;IA6BjB,MAAM,CAAC,UAAU,CAAC,MAAiB;QACjC,MAAM,GAAG,GAAG,IAAI,MAAM,EAAE,CAAC;QACzB,GAAG,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACvB,GAAG,CAAC,SAAS,GAAG,MAAM,CAAC,KAAK,EAAE,IAAI,IAAK,MAAc,CAAC,UAAU,CAAC,CAAC,wBAAwB;QAC1F,GAAG,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC;QAC/B,GAAG,CAAC,KAAK,GAAG,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACxD,GAAG,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,IAAI,CAAC;QACvC,GAAG,CAAC,mBAAmB,GAAG,MAAM,CAAC,m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,OAAO,EAAE,sCAAsC;QAC/C,QAAQ,EAAE,IAAI;KACf,CAAC;;wCACuB;AAgB3B,MAAa,YAAY;CAWxB;AAXD,oCAWC;AANC;IAJC,IAAA,6BAAmB,EAAC,EAAC,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC;IACvF,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,2BAAS,EAAC,GAAG,CAAC;;0CACM;AAKrB;IAHC,IAAA,6BAAmB,EAAC,EAAC,WAAW,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAa,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC;IAChG,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;2CACW;AAGxB,MAAa,2BAA2B;CASvC;AATD,kEASC;AADC;IAPC,IAAA,6BAAmB,EAAC;QACnB,WAAW,EAAE,yCAAyC;QACtD,OAAO,EAAE,YAAmB;QAC5B,QAAQ,EAAE,KAAK;KAChB,CAAC;IACD,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;kEACW;AAGxB,MAAa,4BAA4B;CAOxC;AAPD,oEAOC;AADC;IALC,IAAA,6BAAmB,EAAC;QACnB,WAAW,EAAE,2CAA2C;QACxD,OAAO,EAAE,0CAA0C;QACnD,QAAQ,EAAE,KAAK;KAChB,CAAC;;kEACmB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ChatEntity, EChatType, MessageEntity } from "@signa-app/entities";
|
|
2
|
+
import { GetMessageDTO } from "./message.dto";
|
|
3
|
+
export declare class GetChatDTO {
|
|
4
|
+
uuid: string;
|
|
5
|
+
visibleUuid: string;
|
|
6
|
+
name: string;
|
|
7
|
+
type: EChatType;
|
|
8
|
+
lastMessage: GetMessageDTO | null;
|
|
9
|
+
createdAt: Date;
|
|
10
|
+
updatedAt: Date;
|
|
11
|
+
static fromEntity(chat: ChatEntity, currentUserUuid: string, lastMessage: MessageEntity | null): {
|
|
12
|
+
uuid: string;
|
|
13
|
+
visibleUuid: string;
|
|
14
|
+
name: string;
|
|
15
|
+
type: EChatType;
|
|
16
|
+
lastMessage: GetMessageDTO | null;
|
|
17
|
+
createdAt: Date;
|
|
18
|
+
updatedAt: Date;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export declare class CreateChatRequestDTO {
|
|
22
|
+
type: EChatType;
|
|
23
|
+
userUuids: string[];
|
|
24
|
+
name?: string;
|
|
25
|
+
}
|
|
26
|
+
export declare class CreateChatResponseDTO {
|
|
27
|
+
uuid: string;
|
|
28
|
+
visibleUuid: string;
|
|
29
|
+
name: string;
|
|
30
|
+
type: EChatType;
|
|
31
|
+
static fromEntity(chat: ChatEntity, currentUserUuid: string): {
|
|
32
|
+
uuid: string;
|
|
33
|
+
type: EChatType;
|
|
34
|
+
name: string;
|
|
35
|
+
visibleUuid: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=chat.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.dto.d.ts","sourceRoot":"","sources":["../../src/dto/chat.dto.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAE,SAAS,EAAE,aAAa,EAAC,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAC,aAAa,EAAC,MAAM,eAAe,CAAC;AAe5C,qBAAa,UAAU;IAKrB,IAAI,EAAG,MAAM,CAAC;IAMd,WAAW,EAAG,MAAM,CAAC;IAMrB,IAAI,EAAG,MAAM,CAAC;IAOd,IAAI,EAAG,SAAS,CAAC;IAMjB,WAAW,EAAG,aAAa,GAAG,IAAI,CAAC;IAMnC,SAAS,EAAG,IAAI,CAAC;IAMjB,SAAS,EAAG,IAAI,CAAC;IAEjB,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,GAAG,IAAI;;;;;;;;;CAuB/F;AAED,qBAAa,oBAAoB;IAQ/B,IAAI,EAAE,SAAS,CAAC;IAchB,SAAS,EAAE,MAAM,EAAE,CAAC;IAgBpB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,qBAAa,qBAAqB;IAKhC,IAAI,EAAG,MAAM,CAAC;IAMd,WAAW,EAAG,MAAM,CAAC;IAMrB,IAAI,EAAG,MAAM,CAAC;IAGd,IAAI,EAAE,SAAS,CAAC;IAEhB,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM;;;;;;CAe5D"}
|
|
@@ -0,0 +1,181 @@
|
|
|
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.CreateChatResponseDTO = exports.CreateChatRequestDTO = exports.GetChatDTO = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const entities_1 = require("@signa-app/entities");
|
|
15
|
+
const message_dto_1 = require("./message.dto");
|
|
16
|
+
const class_validator_1 = require("class-validator");
|
|
17
|
+
class GetChatDTO {
|
|
18
|
+
static fromEntity(chat, currentUserUuid, lastMessage) {
|
|
19
|
+
let visibleUuid;
|
|
20
|
+
let name;
|
|
21
|
+
if (chat.type === entities_1.EChatType.DIRECT) {
|
|
22
|
+
const anotherParticipant = chat?.participants?.find((user) => user.uuid !== currentUserUuid && user.isActive);
|
|
23
|
+
visibleUuid = anotherParticipant?.uuid || "";
|
|
24
|
+
name = anotherParticipant?.displayName || anotherParticipant?.userName || "";
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
visibleUuid = chat.uuid;
|
|
28
|
+
name = chat.name;
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
uuid: chat.uuid,
|
|
32
|
+
visibleUuid,
|
|
33
|
+
name,
|
|
34
|
+
type: chat.type,
|
|
35
|
+
lastMessage: lastMessage ? message_dto_1.GetMessageDTO.fromEntity(lastMessage) : null,
|
|
36
|
+
createdAt: chat.createdAt,
|
|
37
|
+
updatedAt: chat.updatedAt,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.GetChatDTO = GetChatDTO;
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, swagger_1.ApiProperty)({
|
|
44
|
+
description: "Chat UUID",
|
|
45
|
+
example: "123e4567-e89b-12d3-a456-426614174000",
|
|
46
|
+
}),
|
|
47
|
+
__metadata("design:type", String)
|
|
48
|
+
], GetChatDTO.prototype, "uuid", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, swagger_1.ApiProperty)({
|
|
51
|
+
description: "Chat for creating avatar on the GUI.",
|
|
52
|
+
example: "123e4567-e89b-12d3-a456-426614174000",
|
|
53
|
+
}),
|
|
54
|
+
__metadata("design:type", String)
|
|
55
|
+
], GetChatDTO.prototype, "visibleUuid", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, swagger_1.ApiProperty)({
|
|
58
|
+
description: "Chat name",
|
|
59
|
+
example: "My Chat Group",
|
|
60
|
+
}),
|
|
61
|
+
__metadata("design:type", String)
|
|
62
|
+
], GetChatDTO.prototype, "name", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
(0, swagger_1.ApiProperty)({
|
|
65
|
+
description: "Chat type",
|
|
66
|
+
enum: entities_1.EChatType,
|
|
67
|
+
example: entities_1.EChatType.GROUP,
|
|
68
|
+
}),
|
|
69
|
+
__metadata("design:type", String)
|
|
70
|
+
], GetChatDTO.prototype, "type", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
(0, swagger_1.ApiProperty)({
|
|
73
|
+
description: "The newest message in the chat, or null if the chat is empty.",
|
|
74
|
+
type: message_dto_1.GetMessageDTO,
|
|
75
|
+
}),
|
|
76
|
+
__metadata("design:type", Object)
|
|
77
|
+
], GetChatDTO.prototype, "lastMessage", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, swagger_1.ApiProperty)({
|
|
80
|
+
description: "Chat creation timestamp",
|
|
81
|
+
example: "2023-01-01T00:00:00Z",
|
|
82
|
+
}),
|
|
83
|
+
__metadata("design:type", Date)
|
|
84
|
+
], GetChatDTO.prototype, "createdAt", void 0);
|
|
85
|
+
__decorate([
|
|
86
|
+
(0, swagger_1.ApiProperty)({
|
|
87
|
+
description: "Chat last update timestamp",
|
|
88
|
+
example: "2023-01-01T00:00:00Z",
|
|
89
|
+
}),
|
|
90
|
+
__metadata("design:type", Date)
|
|
91
|
+
], GetChatDTO.prototype, "updatedAt", void 0);
|
|
92
|
+
class CreateChatRequestDTO {
|
|
93
|
+
}
|
|
94
|
+
exports.CreateChatRequestDTO = CreateChatRequestDTO;
|
|
95
|
+
__decorate([
|
|
96
|
+
(0, swagger_1.ApiProperty)({
|
|
97
|
+
description: "Chat type",
|
|
98
|
+
required: true,
|
|
99
|
+
example: entities_1.EChatType.GROUP,
|
|
100
|
+
enum: entities_1.EChatType,
|
|
101
|
+
}),
|
|
102
|
+
(0, class_validator_1.IsEnum)(entities_1.EChatType),
|
|
103
|
+
__metadata("design:type", String)
|
|
104
|
+
], CreateChatRequestDTO.prototype, "type", void 0);
|
|
105
|
+
__decorate([
|
|
106
|
+
(0, swagger_1.ApiProperty)({
|
|
107
|
+
description: "Array of user UUIDs to add to the chat. Only one user for DIRECT chats and no limits for another types of chats.",
|
|
108
|
+
required: true,
|
|
109
|
+
example: ["123e4567-e89b-12d3-a456-426614174000", "123e4567-e89b-12d3-a456-426614174001"],
|
|
110
|
+
}),
|
|
111
|
+
(0, class_validator_1.IsArray)(),
|
|
112
|
+
(0, class_validator_1.ArrayNotEmpty)(),
|
|
113
|
+
(0, class_validator_1.IsUUID)("4", { each: true })
|
|
114
|
+
// For DIRECT chats, must be exactly one user
|
|
115
|
+
,
|
|
116
|
+
(0, class_validator_1.ValidateIf)((o) => o.type === entities_1.EChatType.DIRECT),
|
|
117
|
+
(0, class_validator_1.ArrayMaxSize)(1),
|
|
118
|
+
__metadata("design:type", Array)
|
|
119
|
+
], CreateChatRequestDTO.prototype, "userUuids", void 0);
|
|
120
|
+
__decorate([
|
|
121
|
+
(0, swagger_1.ApiProperty)({
|
|
122
|
+
description: "Optional. Chat name, not for DIRECT chats.",
|
|
123
|
+
required: false,
|
|
124
|
+
example: "My Chat Group",
|
|
125
|
+
})
|
|
126
|
+
// Disallow name when DIRECT
|
|
127
|
+
,
|
|
128
|
+
(0, class_validator_1.ValidateIf)((o) => o.type === entities_1.EChatType.DIRECT),
|
|
129
|
+
(0, class_validator_1.IsEmpty)({ message: "name must not be provided for DIRECT chats" })
|
|
130
|
+
// Allow name only for non-DIRECT
|
|
131
|
+
,
|
|
132
|
+
(0, class_validator_1.ValidateIf)((o) => o.type !== entities_1.EChatType.DIRECT),
|
|
133
|
+
(0, class_validator_1.IsOptional)(),
|
|
134
|
+
(0, class_validator_1.IsString)(),
|
|
135
|
+
(0, class_validator_1.MinLength)(1),
|
|
136
|
+
(0, class_validator_1.MaxLength)(100),
|
|
137
|
+
__metadata("design:type", String)
|
|
138
|
+
], CreateChatRequestDTO.prototype, "name", void 0);
|
|
139
|
+
class CreateChatResponseDTO {
|
|
140
|
+
static fromEntity(chat, currentUserUuid) {
|
|
141
|
+
let visibleUuid;
|
|
142
|
+
let name;
|
|
143
|
+
if (chat.type === entities_1.EChatType.DIRECT) {
|
|
144
|
+
const anotherParticipant = chat.participants.find((user) => user.uuid !== currentUserUuid && user.isActive);
|
|
145
|
+
visibleUuid = anotherParticipant?.uuid || "";
|
|
146
|
+
name = anotherParticipant?.displayName || anotherParticipant?.userName || "";
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
visibleUuid = chat.uuid;
|
|
150
|
+
name = chat.name;
|
|
151
|
+
}
|
|
152
|
+
return { uuid: chat.uuid, type: chat.type, name, visibleUuid };
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
exports.CreateChatResponseDTO = CreateChatResponseDTO;
|
|
156
|
+
__decorate([
|
|
157
|
+
(0, swagger_1.ApiProperty)({
|
|
158
|
+
description: "Uuid of the created chat. Can be used to get chat details.",
|
|
159
|
+
example: "123e4567-e89b-12d3-a456-426614174000",
|
|
160
|
+
}),
|
|
161
|
+
__metadata("design:type", String)
|
|
162
|
+
], CreateChatResponseDTO.prototype, "uuid", void 0);
|
|
163
|
+
__decorate([
|
|
164
|
+
(0, swagger_1.ApiProperty)({
|
|
165
|
+
description: "Chat for creating avatar on the GUI.",
|
|
166
|
+
example: "123e4567-e89b-12d3-a456-426614174000",
|
|
167
|
+
}),
|
|
168
|
+
__metadata("design:type", String)
|
|
169
|
+
], CreateChatResponseDTO.prototype, "visibleUuid", void 0);
|
|
170
|
+
__decorate([
|
|
171
|
+
(0, swagger_1.ApiProperty)({
|
|
172
|
+
description: "Chat name",
|
|
173
|
+
example: "My Chat Group",
|
|
174
|
+
}),
|
|
175
|
+
__metadata("design:type", String)
|
|
176
|
+
], CreateChatResponseDTO.prototype, "name", void 0);
|
|
177
|
+
__decorate([
|
|
178
|
+
(0, class_validator_1.IsEnum)(entities_1.EChatType),
|
|
179
|
+
__metadata("design:type", String)
|
|
180
|
+
], CreateChatResponseDTO.prototype, "type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C;YACN,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC;YACxB,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACnB,CAAC;QAED,OAAO,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAC,CAAC;IAC/D,CAAC;CACF;AArCD,sDAqCC;AAhCC;IAJC,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,4DAA4D;QACzE,OAAO,EAAE,sCAAsC;KAChD,CAAC;;mDACY;AAMd;IAJC,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,sCAAsC;QACnD,OAAO,EAAE,sCAAsC;KAChD,CAAC;;0DACmB;AAMrB;IAJC,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,WAAW;QACxB,OAAO,EAAE,eAAe;KACzB,CAAC;;mDACY;AAGd;IADC,IAAA,wBAAM,EAAC,oBAAS,CAAC;;mDACF"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { GetUserDTO } from "./user.dto";
|
|
2
|
+
import { EChains, ECurrency, EMessageType, EPaymentStatus, MessageEntity, PaymentMessageEntity, TextMessageEntity } from "@signa-app/entities";
|
|
3
|
+
export declare class GetTextMessageDTO {
|
|
4
|
+
uuid: string;
|
|
5
|
+
text: string;
|
|
6
|
+
createdAt: Date;
|
|
7
|
+
updatedAt: Date;
|
|
8
|
+
static fromEntity(entity: TextMessageEntity): GetTextMessageDTO;
|
|
9
|
+
}
|
|
10
|
+
export declare class GetPaymentMessageDTO {
|
|
11
|
+
uuid: string;
|
|
12
|
+
amount: string;
|
|
13
|
+
fee: string;
|
|
14
|
+
chain?: EChains;
|
|
15
|
+
currency?: ECurrency;
|
|
16
|
+
status?: EPaymentStatus;
|
|
17
|
+
createdAt: Date;
|
|
18
|
+
updatedAt: Date;
|
|
19
|
+
static fromEntity(entity: PaymentMessageEntity): GetPaymentMessageDTO;
|
|
20
|
+
}
|
|
21
|
+
export declare class GetMessageDTO {
|
|
22
|
+
uuid: string;
|
|
23
|
+
type: EMessageType;
|
|
24
|
+
payload: GetTextMessageDTO | GetPaymentMessageDTO;
|
|
25
|
+
author: GetUserDTO;
|
|
26
|
+
chatUuid: string;
|
|
27
|
+
createdAt: Date;
|
|
28
|
+
updatedAt: Date;
|
|
29
|
+
isRead: boolean;
|
|
30
|
+
static fromEntity(entity: MessageEntity, lastSeenTimestamp?: Date | null): GetMessageDTO;
|
|
31
|
+
}
|
|
32
|
+
export declare class PostMessageDTO {
|
|
33
|
+
type: EMessageType;
|
|
34
|
+
payload: any;
|
|
35
|
+
authorUuid: string;
|
|
36
|
+
chatUuid: string;
|
|
37
|
+
}
|
|
38
|
+
export declare class MarkMessageSeenDTO {
|
|
39
|
+
lastSeenTimestamp: string;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=message.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.dto.d.ts","sourceRoot":"","sources":["../../src/dto/message.dto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AAGtC,OAAO,EACL,OAAO,EACP,SAAS,EACT,YAAY,EACZ,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,qBAAqB,CAAC;AAE7B,qBAAa,iBAAiB;IAK5B,IAAI,EAAG,MAAM,CAAC;IAMd,IAAI,EAAG,MAAM,CAAC;IAMd,SAAS,EAAG,IAAI,CAAC;IAMjB,SAAS,EAAG,IAAI,CAAC;IAEjB,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,iBAAiB,GAAG,iBAAiB;CAQhE;AAED,qBAAa,oBAAoB;IAK/B,IAAI,EAAG,MAAM,CAAC;IAMd,MAAM,EAAG,MAAM,CAAC;IAMhB,GAAG,EAAG,MAAM,CAAC;IAOb,KAAK,CAAC,EAAE,OAAO,CAAC;IAOhB,QAAQ,CAAC,EAAE,SAAS,CAAC;IAOrB,MAAM,CAAC,EAAE,cAAc,CAAC;IAMxB,SAAS,EAAG,IAAI,CAAC;IAMjB,SAAS,EAAG,IAAI,CAAC;IAEjB,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,oBAAoB,GAAG,oBAAoB;CAatE;AAED,qBAAa,aAAa;IAKxB,IAAI,EAAE,MAAM,CAAC;IAOb,IAAI,EAAE,YAAY,CAAC;IAMnB,OAAO,EAAE,iBAAiB,GAAG,oBAAoB,CAAC;IAMlD,MAAM,EAAE,UAAU,CAAC;IAMnB,QAAQ,EAAE,MAAM,CAAC;IAMjB,SAAS,EAAE,IAAI,CAAC;IAMhB,SAAS,EAAE,IAAI,CAAC;IAKhB,MAAM,EAAE,OAAO,CAAS;IAExB,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,aAAa,EAAE,iBAAiB,GAAE,IAAI,GAAG,IAAW,GAAG,aAAa;CA2B/F;AAED,qBAAa,cAAc;IAMzB,IAAI,EAAE,YAAY,CAAC;IAOnB,OAAO,EAAE,GAAG,CAAC;IAMb,UAAU,EAAE,MAAM,CAAC;IAMnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,kBAAkB;IAQ7B,iBAAiB,EAAE,MAAM,CAAC;CAC3B"}
|
|
@@ -0,0 +1,263 @@
|
|
|
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.MarkMessageSeenDTO = exports.PostMessageDTO = exports.GetMessageDTO = exports.GetPaymentMessageDTO = exports.GetTextMessageDTO = void 0;
|
|
13
|
+
const user_dto_1 = require("./user.dto");
|
|
14
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
15
|
+
const class_validator_1 = require("class-validator");
|
|
16
|
+
const entities_1 = require("@signa-app/entities");
|
|
17
|
+
class GetTextMessageDTO {
|
|
18
|
+
static fromEntity(entity) {
|
|
19
|
+
const dto = new GetTextMessageDTO();
|
|
20
|
+
dto.uuid = entity.uuid;
|
|
21
|
+
dto.text = entity.text;
|
|
22
|
+
dto.createdAt = entity.createdAt;
|
|
23
|
+
dto.updatedAt = entity.updatedAt;
|
|
24
|
+
return dto;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.GetTextMessageDTO = GetTextMessageDTO;
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, swagger_1.ApiProperty)({
|
|
30
|
+
description: "Message UUID",
|
|
31
|
+
example: "123e4567-e89b-12d3-a456-426614174000",
|
|
32
|
+
}),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], GetTextMessageDTO.prototype, "uuid", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, swagger_1.ApiProperty)({
|
|
37
|
+
description: "Text content of the message",
|
|
38
|
+
example: "Hello world!",
|
|
39
|
+
}),
|
|
40
|
+
__metadata("design:type", String)
|
|
41
|
+
], GetTextMessageDTO.prototype, "text", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, swagger_1.ApiProperty)({
|
|
44
|
+
description: "Message creation timestamp",
|
|
45
|
+
example: "2023-01-01T00:00:00Z",
|
|
46
|
+
}),
|
|
47
|
+
__metadata("design:type", Date)
|
|
48
|
+
], GetTextMessageDTO.prototype, "createdAt", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, swagger_1.ApiProperty)({
|
|
51
|
+
description: "Message last update timestamp",
|
|
52
|
+
example: "2023-01-01T00:00:00Z",
|
|
53
|
+
}),
|
|
54
|
+
__metadata("design:type", Date)
|
|
55
|
+
], GetTextMessageDTO.prototype, "updatedAt", void 0);
|
|
56
|
+
class GetPaymentMessageDTO {
|
|
57
|
+
static fromEntity(entity) {
|
|
58
|
+
const dto = new GetPaymentMessageDTO();
|
|
59
|
+
dto.uuid = entity.uuid;
|
|
60
|
+
const currency = entity?.paymentInvoice?.currency;
|
|
61
|
+
dto.amount = entity.paymentInvoice?.amount;
|
|
62
|
+
dto.fee = entity.paymentInvoice?.fee;
|
|
63
|
+
dto.chain = entity?.paymentInvoice?.chain;
|
|
64
|
+
dto.currency = currency;
|
|
65
|
+
dto.status = entity?.paymentInvoice?.status;
|
|
66
|
+
dto.createdAt = entity.createdAt;
|
|
67
|
+
dto.updatedAt = entity.updatedAt;
|
|
68
|
+
return dto;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.GetPaymentMessageDTO = GetPaymentMessageDTO;
|
|
72
|
+
__decorate([
|
|
73
|
+
(0, swagger_1.ApiProperty)({
|
|
74
|
+
description: "Message UUID",
|
|
75
|
+
example: "123e4567-e89b-12d3-a456-426614174000",
|
|
76
|
+
}),
|
|
77
|
+
__metadata("design:type", String)
|
|
78
|
+
], GetPaymentMessageDTO.prototype, "uuid", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
(0, swagger_1.ApiProperty)({
|
|
81
|
+
description: "Payment amount as a string (to preserve precision)",
|
|
82
|
+
example: "0.0105",
|
|
83
|
+
}),
|
|
84
|
+
__metadata("design:type", String)
|
|
85
|
+
], GetPaymentMessageDTO.prototype, "amount", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
(0, swagger_1.ApiProperty)({
|
|
88
|
+
description: "Network fee for the payment as a string",
|
|
89
|
+
example: "0.00021",
|
|
90
|
+
}),
|
|
91
|
+
__metadata("design:type", String)
|
|
92
|
+
], GetPaymentMessageDTO.prototype, "fee", void 0);
|
|
93
|
+
__decorate([
|
|
94
|
+
(0, swagger_1.ApiProperty)({
|
|
95
|
+
description: "Blockchain network of the payment",
|
|
96
|
+
enum: entities_1.EChains,
|
|
97
|
+
required: false,
|
|
98
|
+
}),
|
|
99
|
+
__metadata("design:type", String)
|
|
100
|
+
], GetPaymentMessageDTO.prototype, "chain", void 0);
|
|
101
|
+
__decorate([
|
|
102
|
+
(0, swagger_1.ApiProperty)({
|
|
103
|
+
description: "Currency of the payment",
|
|
104
|
+
enum: entities_1.ECurrency,
|
|
105
|
+
required: false,
|
|
106
|
+
}),
|
|
107
|
+
__metadata("design:type", String)
|
|
108
|
+
], GetPaymentMessageDTO.prototype, "currency", void 0);
|
|
109
|
+
__decorate([
|
|
110
|
+
(0, swagger_1.ApiProperty)({
|
|
111
|
+
description: "Current status of the payment invoice",
|
|
112
|
+
enum: entities_1.EPaymentStatus,
|
|
113
|
+
required: false,
|
|
114
|
+
}),
|
|
115
|
+
__metadata("design:type", String)
|
|
116
|
+
], GetPaymentMessageDTO.prototype, "status", void 0);
|
|
117
|
+
__decorate([
|
|
118
|
+
(0, swagger_1.ApiProperty)({
|
|
119
|
+
description: "Message creation timestamp",
|
|
120
|
+
example: "2023-01-01T00:00:00Z",
|
|
121
|
+
}),
|
|
122
|
+
__metadata("design:type", Date)
|
|
123
|
+
], GetPaymentMessageDTO.prototype, "createdAt", void 0);
|
|
124
|
+
__decorate([
|
|
125
|
+
(0, swagger_1.ApiProperty)({
|
|
126
|
+
description: "Message last update timestamp",
|
|
127
|
+
example: "2023-01-01T00:00:00Z",
|
|
128
|
+
}),
|
|
129
|
+
__metadata("design:type", Date)
|
|
130
|
+
], GetPaymentMessageDTO.prototype, "updatedAt", void 0);
|
|
131
|
+
class GetMessageDTO {
|
|
132
|
+
constructor() {
|
|
133
|
+
this.isRead = false;
|
|
134
|
+
}
|
|
135
|
+
static fromEntity(entity, lastSeenTimestamp = null) {
|
|
136
|
+
const dto = new GetMessageDTO();
|
|
137
|
+
dto.uuid = entity.uuid;
|
|
138
|
+
dto.type = entity.type;
|
|
139
|
+
// Map author and timestamps via the base MessageEntity from the 1:1 relation
|
|
140
|
+
dto.author = entity?.author ? user_dto_1.GetUserDTO.fromEntity(entity.author) : undefined;
|
|
141
|
+
dto.chatUuid = entity?.chat?.uuid;
|
|
142
|
+
dto.createdAt = entity?.createdAt;
|
|
143
|
+
dto.updatedAt = entity?.updatedAt;
|
|
144
|
+
dto.isRead = lastSeenTimestamp ? entity.createdAt <= lastSeenTimestamp : false;
|
|
145
|
+
// Map payload based on message type
|
|
146
|
+
switch (entity.type) {
|
|
147
|
+
case entities_1.EMessageType.TEXT:
|
|
148
|
+
dto.payload = GetTextMessageDTO.fromEntity(entity.textMessage);
|
|
149
|
+
break;
|
|
150
|
+
case entities_1.EMessageType.PAYMENT:
|
|
151
|
+
dto.payload = GetPaymentMessageDTO.fromEntity(entity.paymentMessage);
|
|
152
|
+
break;
|
|
153
|
+
default:
|
|
154
|
+
// No payload mapping for unknown type
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
return dto;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
exports.GetMessageDTO = GetMessageDTO;
|
|
161
|
+
__decorate([
|
|
162
|
+
(0, swagger_1.ApiProperty)({
|
|
163
|
+
description: "Message UUID",
|
|
164
|
+
example: "123e4567-e89b-12d3-a456-426614174000",
|
|
165
|
+
}),
|
|
166
|
+
__metadata("design:type", String)
|
|
167
|
+
], GetMessageDTO.prototype, "uuid", void 0);
|
|
168
|
+
__decorate([
|
|
169
|
+
(0, swagger_1.ApiProperty)({
|
|
170
|
+
description: "Message type",
|
|
171
|
+
enum: entities_1.EMessageType,
|
|
172
|
+
example: entities_1.EMessageType.TEXT,
|
|
173
|
+
}),
|
|
174
|
+
__metadata("design:type", String)
|
|
175
|
+
], GetMessageDTO.prototype, "type", void 0);
|
|
176
|
+
__decorate([
|
|
177
|
+
(0, swagger_1.ApiProperty)({
|
|
178
|
+
description: "Message payload containing type-specific content",
|
|
179
|
+
oneOf: [{ $ref: (0, swagger_1.getSchemaPath)(GetTextMessageDTO) }, { $ref: (0, swagger_1.getSchemaPath)(GetPaymentMessageDTO) }],
|
|
180
|
+
}),
|
|
181
|
+
__metadata("design:type", Object)
|
|
182
|
+
], GetMessageDTO.prototype, "payload", void 0);
|
|
183
|
+
__decorate([
|
|
184
|
+
(0, swagger_1.ApiProperty)({
|
|
185
|
+
description: "Message author",
|
|
186
|
+
type: user_dto_1.GetUserDTO,
|
|
187
|
+
}),
|
|
188
|
+
__metadata("design:type", user_dto_1.GetUserDTO)
|
|
189
|
+
], GetMessageDTO.prototype, "author", void 0);
|
|
190
|
+
__decorate([
|
|
191
|
+
(0, swagger_1.ApiProperty)({
|
|
192
|
+
description: "Message chat uuid",
|
|
193
|
+
type: "string",
|
|
194
|
+
}),
|
|
195
|
+
__metadata("design:type", String)
|
|
196
|
+
], GetMessageDTO.prototype, "chatUuid", void 0);
|
|
197
|
+
__decorate([
|
|
198
|
+
(0, swagger_1.ApiProperty)({
|
|
199
|
+
description: "Message creation timestamp",
|
|
200
|
+
example: "2023-01-01T00:00:00Z",
|
|
201
|
+
}),
|
|
202
|
+
__metadata("design:type", Date)
|
|
203
|
+
], GetMessageDTO.prototype, "createdAt", void 0);
|
|
204
|
+
__decorate([
|
|
205
|
+
(0, swagger_1.ApiProperty)({
|
|
206
|
+
description: "Message last update timestamp",
|
|
207
|
+
example: "2023-01-01T00:00:00Z",
|
|
208
|
+
}),
|
|
209
|
+
__metadata("design:type", Date)
|
|
210
|
+
], GetMessageDTO.prototype, "updatedAt", void 0);
|
|
211
|
+
__decorate([
|
|
212
|
+
(0, swagger_1.ApiProperty)({
|
|
213
|
+
description: "User read status of the message. True if the user has read the message, false otherwise.",
|
|
214
|
+
}),
|
|
215
|
+
__metadata("design:type", Boolean)
|
|
216
|
+
], GetMessageDTO.prototype, "isRead", void 0);
|
|
217
|
+
class PostMessageDTO {
|
|
218
|
+
}
|
|
219
|
+
exports.PostMessageDTO = PostMessageDTO;
|
|
220
|
+
__decorate([
|
|
221
|
+
(0, swagger_1.ApiProperty)({
|
|
222
|
+
description: "Message type",
|
|
223
|
+
enum: entities_1.EMessageType,
|
|
224
|
+
example: entities_1.EMessageType.TEXT,
|
|
225
|
+
}),
|
|
226
|
+
__metadata("design:type", String)
|
|
227
|
+
], PostMessageDTO.prototype, "type", void 0);
|
|
228
|
+
__decorate([
|
|
229
|
+
(0, swagger_1.ApiProperty)({
|
|
230
|
+
description: "Message payload containing type-specific content",
|
|
231
|
+
type: "object",
|
|
232
|
+
additionalProperties: true,
|
|
233
|
+
}),
|
|
234
|
+
__metadata("design:type", Object)
|
|
235
|
+
], PostMessageDTO.prototype, "payload", void 0);
|
|
236
|
+
__decorate([
|
|
237
|
+
(0, swagger_1.ApiProperty)({
|
|
238
|
+
description: "UUID of message author",
|
|
239
|
+
example: "123e4567-e89b-12d3-a456-426614174000",
|
|
240
|
+
}),
|
|
241
|
+
__metadata("design:type", String)
|
|
242
|
+
], PostMessageDTO.prototype, "authorUuid", void 0);
|
|
243
|
+
__decorate([
|
|
244
|
+
(0, swagger_1.ApiProperty)({
|
|
245
|
+
description: "UUID of chat where message is posted",
|
|
246
|
+
example: "123e4567-e89b-12d3-a456-426614174000",
|
|
247
|
+
}),
|
|
248
|
+
__metadata("design:type", String)
|
|
249
|
+
], PostMessageDTO.prototype, "chatUuid", void 0);
|
|
250
|
+
class MarkMessageSeenDTO {
|
|
251
|
+
}
|
|
252
|
+
exports.MarkMessageSeenDTO = MarkMessageSeenDTO;
|
|
253
|
+
__decorate([
|
|
254
|
+
(0, swagger_1.ApiProperty)({
|
|
255
|
+
description: "CreatedAt of the last message the user has seen (ISOString)",
|
|
256
|
+
type: "string",
|
|
257
|
+
}),
|
|
258
|
+
(0, class_validator_1.IsString)(),
|
|
259
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
260
|
+
(0, class_validator_1.IsISO8601)(),
|
|
261
|
+
__metadata("design:type", String)
|
|
262
|
+
], MarkMessageSeenDTO.prototype, "lastSeenTimestamp", void 0);
|
|
263
|
+
//# sourceMappingURL=message.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.dto.js","sourceRoot":"","sources":["../../src/dto/message.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAsC;AACtC,6CAA2D;AAC3D,qDAAgE;AAChE,kDAQ6B;AAE7B,MAAa,iBAAiB;IAyB5B,MAAM,CAAC,UAAU,CAAC,MAAyB;QACzC,MAAM,GAAG,GAAG,IAAI,iBAAiB,EAAE,CAAC;QACpC,GAAG,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACvB,GAAG,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACvB,GAAG,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QACjC,GAAG,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QACjC,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAjCD,8CAiCC;AA5BC;IAJC,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,cAAc;QAC3B,OAAO,EAAE,sCAAsC;KAChD,CAAC;;+CACY;AAMd;IAJC,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,6BAA6B;QAC1C,OAAO,EAAE,cAAc;KACxB,CAAC;;+CACY;AAMd;IAJC,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,4BAA4B;QACzC,OAAO,EAAE,sBAAsB;KAChC,CAAC;8BACU,IAAI;oDAAC;AAMjB;IAJC,IAAA,qBAAW,EAAC;QACX,WAAW,EAAE,+BAA+B;QAC5C,OAAO,EAAE,sBAAsB;KAChC,CAAC;8BACU,IAAI;oDAAC;AAYnB,MAAa,oBAAoB;IAoD/B,MAAM,CAA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