@signa-app/entities 0.3.2 → 0.4.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.
@@ -11,11 +11,22 @@ export declare class PaymentMessageEntity extends BaseEntity {
11
11
  fee: string;
12
12
  paymentInvoice: PaymentInvoiceEntity;
13
13
  }
14
+ export declare class FilesMessageEntity extends BaseEntity {
15
+ text: string;
16
+ files: ChatFilesEntity[];
17
+ }
18
+ export declare class ChatFilesEntity extends BaseEntity {
19
+ originalName: string;
20
+ format: string;
21
+ metadata: Record<string, unknown>;
22
+ filesMessage: FilesMessageEntity;
23
+ }
14
24
  export declare class MessageEntity extends BaseEntity {
15
25
  author: UserEntity;
16
26
  chat: ChatEntity;
17
27
  type: EMessageType;
18
28
  textMessage: TextMessageEntity;
19
29
  paymentMessage: PaymentMessageEntity;
30
+ filesMessage: FilesMessageEntity;
20
31
  }
21
32
  //# sourceMappingURL=message.entity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"message.entity.d.ts","sourceRoot":"","sources":["../../src/entities/message.entity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAGhE,qBACa,iBAAkB,SAAQ,UAAU;IAE/C,IAAI,EAAG,MAAM,CAAC;CACf;AAGD,qBACa,oBAAqB,SAAQ,UAAU;IAElD,MAAM,EAAG,MAAM,CAAC;IAGhB,GAAG,EAAG,MAAM,CAAC;IAIb,cAAc,EAAG,oBAAoB,CAAC;CACvC;AAED,qBACa,aAAc,SAAQ,UAAU;IAE3C,MAAM,EAAG,UAAU,CAAC;IAGpB,IAAI,EAAG,UAAU,CAAC;IAGlB,IAAI,EAAG,YAAY,CAAC;IAKpB,WAAW,EAAG,iBAAiB,CAAC;IAKhC,cAAc,EAAG,oBAAoB,CAAC;CACvC"}
1
+ {"version":3,"file":"message.entity.d.ts","sourceRoot":"","sources":["../../src/entities/message.entity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAGhE,qBACa,iBAAkB,SAAQ,UAAU;IAE/C,IAAI,EAAG,MAAM,CAAC;CACf;AAGD,qBACa,oBAAqB,SAAQ,UAAU;IAElD,MAAM,EAAG,MAAM,CAAC;IAGhB,GAAG,EAAG,MAAM,CAAC;IAIb,cAAc,EAAG,oBAAoB,CAAC;CACvC;AAGD,qBACa,kBAAmB,SAAQ,UAAU;IAEhD,IAAI,EAAG,MAAM,CAAC;IAGd,KAAK,EAAG,eAAe,EAAE,CAAC;CAC3B;AAGD,qBACa,eAAgB,SAAQ,UAAU;IAE7C,YAAY,EAAG,MAAM,CAAC;IAGtB,MAAM,EAAG,MAAM,CAAC;IAGhB,QAAQ,EAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAMnC,YAAY,EAAG,kBAAkB,CAAC;CACnC;AAED,qBACa,aAAc,SAAQ,UAAU;IAE3C,MAAM,EAAG,UAAU,CAAC;IAGpB,IAAI,EAAG,UAAU,CAAC;IAGlB,IAAI,EAAG,YAAY,CAAC;IAKpB,WAAW,EAAG,iBAAiB,CAAC;IAKhC,cAAc,EAAG,oBAAoB,CAAC;IAKtC,YAAY,EAAG,kBAAkB,CAAC;CACnC"}
@@ -9,7 +9,7 @@ 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
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.MessageEntity = exports.PaymentMessageEntity = exports.TextMessageEntity = void 0;
12
+ exports.MessageEntity = exports.ChatFilesEntity = exports.FilesMessageEntity = exports.PaymentMessageEntity = exports.TextMessageEntity = void 0;
13
13
  const typeorm_1 = require("typeorm");
14
14
  const base_entity_1 = require("./base.entity");
15
15
  const user_entity_1 = require("./user.entity");
@@ -47,6 +47,47 @@ __decorate([
47
47
  exports.PaymentMessageEntity = PaymentMessageEntity = __decorate([
48
48
  (0, typeorm_1.Entity)('payment_messages')
49
49
  ], PaymentMessageEntity);
50
+ // Holds content for messages contain files. Linked 1:1 with base MessageEntity.
51
+ let FilesMessageEntity = class FilesMessageEntity extends base_entity_1.BaseEntity {
52
+ };
53
+ exports.FilesMessageEntity = FilesMessageEntity;
54
+ __decorate([
55
+ (0, typeorm_1.Column)({ type: 'text' }),
56
+ __metadata("design:type", String)
57
+ ], FilesMessageEntity.prototype, "text", void 0);
58
+ __decorate([
59
+ (0, typeorm_1.OneToMany)(() => ChatFilesEntity, (file) => file.filesMessage, { cascade: true }),
60
+ __metadata("design:type", Array)
61
+ ], FilesMessageEntity.prototype, "files", void 0);
62
+ exports.FilesMessageEntity = FilesMessageEntity = __decorate([
63
+ (0, typeorm_1.Entity)('files_messages')
64
+ ], FilesMessageEntity);
65
+ // Files are stored in the cloud.
66
+ let ChatFilesEntity = class ChatFilesEntity extends base_entity_1.BaseEntity {
67
+ };
68
+ exports.ChatFilesEntity = ChatFilesEntity;
69
+ __decorate([
70
+ (0, typeorm_1.Column)({ type: 'varchar' }),
71
+ __metadata("design:type", String)
72
+ ], ChatFilesEntity.prototype, "originalName", void 0);
73
+ __decorate([
74
+ (0, typeorm_1.Column)({ type: 'varchar' }),
75
+ __metadata("design:type", String)
76
+ ], ChatFilesEntity.prototype, "format", void 0);
77
+ __decorate([
78
+ (0, typeorm_1.Column)({ type: 'jsonb', default: '{}' }),
79
+ __metadata("design:type", Object)
80
+ ], ChatFilesEntity.prototype, "metadata", void 0);
81
+ __decorate([
82
+ (0, typeorm_1.ManyToOne)(() => FilesMessageEntity, (filesMessage) => filesMessage.files, {
83
+ nullable: false,
84
+ onDelete: 'CASCADE',
85
+ }),
86
+ __metadata("design:type", FilesMessageEntity)
87
+ ], ChatFilesEntity.prototype, "filesMessage", void 0);
88
+ exports.ChatFilesEntity = ChatFilesEntity = __decorate([
89
+ (0, typeorm_1.Entity)('chat_files')
90
+ ], ChatFilesEntity);
50
91
  let MessageEntity = class MessageEntity extends base_entity_1.BaseEntity {
51
92
  };
52
93
  exports.MessageEntity = MessageEntity;
@@ -72,6 +113,11 @@ __decorate([
72
113
  (0, typeorm_1.JoinColumn)(),
73
114
  __metadata("design:type", PaymentMessageEntity)
74
115
  ], MessageEntity.prototype, "paymentMessage", void 0);
116
+ __decorate([
117
+ (0, typeorm_1.OneToOne)(() => FilesMessageEntity),
118
+ (0, typeorm_1.JoinColumn)(),
119
+ __metadata("design:type", FilesMessageEntity)
120
+ ], MessageEntity.prototype, "filesMessage", void 0);
75
121
  exports.MessageEntity = MessageEntity = __decorate([
76
122
  (0, typeorm_1.Entity)('messages')
77
123
  ], MessageEntity);
@@ -1 +1 @@
1
- {"version":3,"file":"message.entity.js","sourceRoot":"","sources":["../../src/entities/message.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAA0E;AAC1E,+CAA2C;AAC3C,+CAA2C;AAC3C,+CAA2C;AAC3C,0CAA8C;AAC9C,qEAAgE;AAEhE,uEAAuE;AAEhE,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,wBAAU;CAGhD,CAAA;AAHY,8CAAiB;AAE5B;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;+CACX;4BAFH,iBAAiB;IAD7B,IAAA,gBAAM,EAAC,eAAe,CAAC;G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IAAA,oBAAU,GAAE;8BACC,iBAAiB;kDAAC;AAKhC;IAFC,IAAA,kBAAQ,EAAC,GAAG,EAAE,CAAC,oBAAoB,CAAC;IACpC,IAAA,oBAAU,GAAE;8BACI,oBAAoB;qDAAC;AAKtC;IAFC,IAAA,kBAAQ,EAAC,GAAG,EAAE,CAAC,kBAAkB,CAAC;IAClC,IAAA,oBAAU,GAAE;8BACE,kBAAkB;mDAAC;wBAvBvB,aAAa;IADzB,IAAA,gBAAM,EAAC,UAAU,CAAC;GACN,aAAa,CAwBzB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signa-app/entities",
3
- "version": "0.3.2",
3
+ "version": "0.4.0",
4
4
  "description": "Shared TypeORM entities for Signa services.",
5
5
  "license": "UNLICENSED",
6
6
  "main": "./dist/index.js",