@natrave/shared-entities 8.33.0 → 8.34.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.
Files changed (94) hide show
  1. package/dist/app-auth/index.d.ts +1 -0
  2. package/dist/app-auth/index.d.ts.map +1 -1
  3. package/dist/app-auth/index.js +1 -0
  4. package/dist/app-auth/user-localities/enums/user-locality-source.enum.d.ts +5 -0
  5. package/dist/app-auth/user-localities/enums/user-locality-source.enum.d.ts.map +1 -0
  6. package/dist/app-auth/user-localities/enums/user-locality-source.enum.js +8 -0
  7. package/dist/app-auth/user-localities/index.d.ts +3 -0
  8. package/dist/app-auth/user-localities/index.d.ts.map +1 -0
  9. package/dist/app-auth/user-localities/index.js +6 -0
  10. package/dist/app-auth/user-localities/user-locality.entity.d.ts +14 -0
  11. package/dist/app-auth/user-localities/user-locality.entity.d.ts.map +1 -0
  12. package/dist/app-auth/user-localities/user-locality.entity.js +94 -0
  13. package/dist/database-entities/index.d.ts +3 -2
  14. package/dist/database-entities/index.d.ts.map +1 -1
  15. package/dist/database-entities/index.js +19 -1
  16. package/dist/index.d.ts +1 -0
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +1 -0
  19. package/dist/promotions/enums/promotion-advertiser-entity-type.enum.d.ts +4 -0
  20. package/dist/promotions/enums/promotion-advertiser-entity-type.enum.d.ts.map +1 -0
  21. package/dist/promotions/enums/promotion-advertiser-entity-type.enum.js +7 -0
  22. package/dist/promotions/enums/promotion-creative-status.enum.d.ts +6 -0
  23. package/dist/promotions/enums/promotion-creative-status.enum.d.ts.map +1 -0
  24. package/dist/promotions/enums/promotion-creative-status.enum.js +9 -0
  25. package/dist/promotions/enums/promotion-creative-template.enum.d.ts +4 -0
  26. package/dist/promotions/enums/promotion-creative-template.enum.d.ts.map +1 -0
  27. package/dist/promotions/enums/promotion-creative-template.enum.js +7 -0
  28. package/dist/promotions/enums/promotion-event-type.enum.d.ts +7 -0
  29. package/dist/promotions/enums/promotion-event-type.enum.d.ts.map +1 -0
  30. package/dist/promotions/enums/promotion-event-type.enum.js +10 -0
  31. package/dist/promotions/enums/promotion-match-source.enum.d.ts +8 -0
  32. package/dist/promotions/enums/promotion-match-source.enum.d.ts.map +1 -0
  33. package/dist/promotions/enums/promotion-match-source.enum.js +11 -0
  34. package/dist/promotions/enums/promotion-placement.enum.d.ts +4 -0
  35. package/dist/promotions/enums/promotion-placement.enum.d.ts.map +1 -0
  36. package/dist/promotions/enums/promotion-placement.enum.js +7 -0
  37. package/dist/promotions/enums/promotion-status.enum.d.ts +7 -0
  38. package/dist/promotions/enums/promotion-status.enum.d.ts.map +1 -0
  39. package/dist/promotions/enums/promotion-status.enum.js +10 -0
  40. package/dist/promotions/enums/promotion-subject-type.enum.d.ts +4 -0
  41. package/dist/promotions/enums/promotion-subject-type.enum.d.ts.map +1 -0
  42. package/dist/promotions/enums/promotion-subject-type.enum.js +7 -0
  43. package/dist/promotions/enums/promotion-target-type.enum.d.ts +5 -0
  44. package/dist/promotions/enums/promotion-target-type.enum.d.ts.map +1 -0
  45. package/dist/promotions/enums/promotion-target-type.enum.js +8 -0
  46. package/dist/promotions/index.d.ts +18 -0
  47. package/dist/promotions/index.d.ts.map +1 -0
  48. package/dist/promotions/index.js +27 -0
  49. package/dist/promotions/promotion-advertisers/index.d.ts +2 -0
  50. package/dist/promotions/promotion-advertisers/index.d.ts.map +1 -0
  51. package/dist/promotions/promotion-advertisers/index.js +4 -0
  52. package/dist/promotions/promotion-advertisers/promotion-advertiser.entity.d.ts +15 -0
  53. package/dist/promotions/promotion-advertisers/promotion-advertiser.entity.d.ts.map +1 -0
  54. package/dist/promotions/promotion-advertisers/promotion-advertiser.entity.js +117 -0
  55. package/dist/promotions/promotion-contacts/index.d.ts +2 -0
  56. package/dist/promotions/promotion-contacts/index.d.ts.map +1 -0
  57. package/dist/promotions/promotion-contacts/index.js +4 -0
  58. package/dist/promotions/promotion-contacts/promotion-contact.entity.d.ts +14 -0
  59. package/dist/promotions/promotion-contacts/promotion-contact.entity.d.ts.map +1 -0
  60. package/dist/promotions/promotion-contacts/promotion-contact.entity.js +106 -0
  61. package/dist/promotions/promotion-creatives/index.d.ts +2 -0
  62. package/dist/promotions/promotion-creatives/index.d.ts.map +1 -0
  63. package/dist/promotions/promotion-creatives/index.js +4 -0
  64. package/dist/promotions/promotion-creatives/promotion-creative.entity.d.ts +21 -0
  65. package/dist/promotions/promotion-creatives/promotion-creative.entity.d.ts.map +1 -0
  66. package/dist/promotions/promotion-creatives/promotion-creative.entity.js +136 -0
  67. package/dist/promotions/promotion-events/index.d.ts +2 -0
  68. package/dist/promotions/promotion-events/index.d.ts.map +1 -0
  69. package/dist/promotions/promotion-events/index.js +4 -0
  70. package/dist/promotions/promotion-events/promotion-event.entity.d.ts +20 -0
  71. package/dist/promotions/promotion-events/promotion-event.entity.d.ts.map +1 -0
  72. package/dist/promotions/promotion-events/promotion-event.entity.js +135 -0
  73. package/dist/promotions/promotion-targets/index.d.ts +2 -0
  74. package/dist/promotions/promotion-targets/index.d.ts.map +1 -0
  75. package/dist/promotions/promotion-targets/index.js +4 -0
  76. package/dist/promotions/promotion-targets/promotion-target.entity.d.ts +15 -0
  77. package/dist/promotions/promotion-targets/promotion-target.entity.d.ts.map +1 -0
  78. package/dist/promotions/promotion-targets/promotion-target.entity.js +102 -0
  79. package/dist/promotions/promotion-user-states/index.d.ts +2 -0
  80. package/dist/promotions/promotion-user-states/index.d.ts.map +1 -0
  81. package/dist/promotions/promotion-user-states/index.js +4 -0
  82. package/dist/promotions/promotion-user-states/promotion-user-state.entity.d.ts +21 -0
  83. package/dist/promotions/promotion-user-states/promotion-user-state.entity.d.ts.map +1 -0
  84. package/dist/promotions/promotion-user-states/promotion-user-state.entity.js +158 -0
  85. package/dist/promotions/promotions/index.d.ts +2 -0
  86. package/dist/promotions/promotions/index.d.ts.map +1 -0
  87. package/dist/promotions/promotions/index.js +4 -0
  88. package/dist/promotions/promotions/promotion.entity.d.ts +27 -0
  89. package/dist/promotions/promotions/promotion.entity.d.ts.map +1 -0
  90. package/dist/promotions/promotions/promotion.entity.js +171 -0
  91. package/dist/promotions/types/promotion-content.types.d.ts +17 -0
  92. package/dist/promotions/types/promotion-content.types.d.ts.map +1 -0
  93. package/dist/promotions/types/promotion-content.types.js +0 -0
  94. package/package.json +1 -1
@@ -0,0 +1,117 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result) __defProp(target, key, result);
9
+ return result;
10
+ };
11
+ import {
12
+ Check,
13
+ Column,
14
+ CreateDateColumn,
15
+ Entity,
16
+ Index,
17
+ OneToMany,
18
+ PrimaryGeneratedColumn,
19
+ UpdateDateColumn
20
+ } from "typeorm";
21
+ import { Promotion } from "../promotions/promotion.entity.js";
22
+ let PromotionAdvertiser = class {
23
+ };
24
+ __decorateClass([
25
+ PrimaryGeneratedColumn("uuid", {
26
+ primaryKeyConstraintName: "PK_promotion_advertisers",
27
+ comment: "Identificador \xFAnico do anunciante."
28
+ })
29
+ ], PromotionAdvertiser.prototype, "id", 2);
30
+ __decorateClass([
31
+ Column({
32
+ type: "varchar",
33
+ length: 160,
34
+ comment: "Nome do anunciante (pessoa, empresa ou organiza\xE7\xE3o)."
35
+ })
36
+ ], PromotionAdvertiser.prototype, "name", 2);
37
+ __decorateClass([
38
+ Column({
39
+ name: "entity_type",
40
+ type: "varchar",
41
+ length: 32,
42
+ nullable: true,
43
+ comment: "Tipo da entidade do NaTrave! que o anunciante representa (ORGANIZATION). Nulo: de fora."
44
+ })
45
+ ], PromotionAdvertiser.prototype, "entityType", 2);
46
+ __decorateClass([
47
+ Column({
48
+ name: "entity_id",
49
+ type: "bigint",
50
+ nullable: true,
51
+ comment: "Id da entidade em entity_type (ex.: organizations.id). Sem FK (polim\xF3rfico)."
52
+ })
53
+ ], PromotionAdvertiser.prototype, "entityId", 2);
54
+ __decorateClass([
55
+ Column({
56
+ name: "contact_name",
57
+ type: "varchar",
58
+ length: 160,
59
+ nullable: true,
60
+ comment: "Pessoa respons\xE1vel pelo an\xFAncio do lado do anunciante."
61
+ })
62
+ ], PromotionAdvertiser.prototype, "contactName", 2);
63
+ __decorateClass([
64
+ Column({
65
+ name: "contact_email",
66
+ type: "varchar",
67
+ length: 255,
68
+ nullable: true,
69
+ comment: "E-mail para enviar relat\xF3rio e lista de interessados."
70
+ })
71
+ ], PromotionAdvertiser.prototype, "contactEmail", 2);
72
+ __decorateClass([
73
+ Column({
74
+ name: "contact_phone",
75
+ type: "varchar",
76
+ length: 20,
77
+ nullable: true,
78
+ comment: "Telefone do respons\xE1vel, com DDI e DDD, s\xF3 d\xEDgitos."
79
+ })
80
+ ], PromotionAdvertiser.prototype, "contactPhone", 2);
81
+ __decorateClass([
82
+ CreateDateColumn({
83
+ name: "created_at",
84
+ type: "timestamptz",
85
+ default: () => "now()",
86
+ comment: "Data/hora de cria\xE7\xE3o do registro."
87
+ })
88
+ ], PromotionAdvertiser.prototype, "createdAt", 2);
89
+ __decorateClass([
90
+ UpdateDateColumn({
91
+ name: "updated_at",
92
+ type: "timestamptz",
93
+ default: () => "now()",
94
+ comment: "Data/hora da \xFAltima altera\xE7\xE3o do registro."
95
+ })
96
+ ], PromotionAdvertiser.prototype, "updatedAt", 2);
97
+ __decorateClass([
98
+ OneToMany(() => Promotion, (promotion) => promotion.advertiser)
99
+ ], PromotionAdvertiser.prototype, "promotions", 2);
100
+ PromotionAdvertiser = __decorateClass([
101
+ Entity("promotion_advertisers"),
102
+ Index("UQ_promotion_advertisers_entity", ["entityType", "entityId"], {
103
+ unique: true,
104
+ where: '"entity_type" IS NOT NULL'
105
+ }),
106
+ Check(
107
+ "CHK_promotion_advertisers_entity",
108
+ `("entity_type" IS NULL AND "entity_id" IS NULL) OR ("entity_type" IS NOT NULL AND "entity_type" IN ('ORGANIZATION') AND "entity_id" IS NOT NULL)`
109
+ ),
110
+ Check(
111
+ "CHK_promotion_advertisers_contact_phone",
112
+ `"contact_phone" IS NULL OR "contact_phone" ~ '^[0-9]{10,15}$'`
113
+ )
114
+ ], PromotionAdvertiser);
115
+ export {
116
+ PromotionAdvertiser
117
+ };
@@ -0,0 +1,2 @@
1
+ export { PromotionContact } from './promotion-contact.entity';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/promotions/promotion-contacts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { PromotionContact } from "./promotion-contact.entity.js";
2
+ export {
3
+ PromotionContact
4
+ };
@@ -0,0 +1,14 @@
1
+ import { Promotion } from '../promotions/promotion.entity';
2
+ export declare class PromotionContact {
3
+ id: string;
4
+ promotionId: string;
5
+ name: string;
6
+ phone: string;
7
+ profilePictureUrl: string | null;
8
+ instagramAccount: string | null;
9
+ position: number;
10
+ createdAt: Date;
11
+ updatedAt: Date;
12
+ promotion: Promotion;
13
+ }
14
+ //# sourceMappingURL=promotion-contact.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promotion-contact.entity.d.ts","sourceRoot":"","sources":["../../../src/promotions/promotion-contacts/promotion-contact.entity.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAa3D,qBAGa,gBAAgB;IAK3B,EAAE,EAAE,MAAM,CAAC;IAOX,WAAW,EAAE,MAAM,CAAC;IAOpB,IAAI,EAAE,MAAM,CAAC;IAOb,KAAK,EAAE,MAAM,CAAC;IAQd,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IASjC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAOhC,QAAQ,EAAE,MAAM,CAAC;IAQjB,SAAS,EAAE,IAAI,CAAC;IAQhB,SAAS,EAAE,IAAI,CAAC;IAShB,SAAS,EAAE,SAAS,CAAC;CACtB"}
@@ -0,0 +1,106 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result) __defProp(target, key, result);
9
+ return result;
10
+ };
11
+ import {
12
+ Check,
13
+ Column,
14
+ CreateDateColumn,
15
+ Entity,
16
+ Index,
17
+ JoinColumn,
18
+ ManyToOne,
19
+ PrimaryGeneratedColumn,
20
+ UpdateDateColumn
21
+ } from "typeorm";
22
+ import { Promotion } from "../promotions/promotion.entity.js";
23
+ let PromotionContact = class {
24
+ };
25
+ __decorateClass([
26
+ PrimaryGeneratedColumn("uuid", {
27
+ primaryKeyConstraintName: "PK_promotion_contacts",
28
+ comment: "Identificador \xFAnico do contato."
29
+ })
30
+ ], PromotionContact.prototype, "id", 2);
31
+ __decorateClass([
32
+ Column({
33
+ name: "promotion_id",
34
+ type: "uuid",
35
+ comment: "FK promotions.id."
36
+ })
37
+ ], PromotionContact.prototype, "promotionId", 2);
38
+ __decorateClass([
39
+ Column({
40
+ type: "varchar",
41
+ length: 160,
42
+ comment: "Nome exibido no cart\xE3o de contato."
43
+ })
44
+ ], PromotionContact.prototype, "name", 2);
45
+ __decorateClass([
46
+ Column({
47
+ type: "varchar",
48
+ length: 20,
49
+ comment: "Telefone (WhatsApp) com DDI e DDD, s\xF3 d\xEDgitos (ex.: 5515999990101)."
50
+ })
51
+ ], PromotionContact.prototype, "phone", 2);
52
+ __decorateClass([
53
+ Column({
54
+ name: "profile_picture_url",
55
+ type: "varchar",
56
+ nullable: true,
57
+ comment: "URL da foto do contato."
58
+ })
59
+ ], PromotionContact.prototype, "profilePictureUrl", 2);
60
+ __decorateClass([
61
+ Column({
62
+ name: "instagram_account",
63
+ type: "varchar",
64
+ length: 64,
65
+ nullable: true,
66
+ comment: "Conta do Instagram do contato (ex.: @usuario)."
67
+ })
68
+ ], PromotionContact.prototype, "instagramAccount", 2);
69
+ __decorateClass([
70
+ Column({
71
+ type: "int",
72
+ default: 0,
73
+ comment: "Ordem de exibi\xE7\xE3o quando h\xE1 mais de um contato. Menor primeiro."
74
+ })
75
+ ], PromotionContact.prototype, "position", 2);
76
+ __decorateClass([
77
+ CreateDateColumn({
78
+ name: "created_at",
79
+ type: "timestamptz",
80
+ default: () => "now()",
81
+ comment: "Data/hora de cria\xE7\xE3o do registro."
82
+ })
83
+ ], PromotionContact.prototype, "createdAt", 2);
84
+ __decorateClass([
85
+ UpdateDateColumn({
86
+ name: "updated_at",
87
+ type: "timestamptz",
88
+ default: () => "now()",
89
+ comment: "Data/hora da \xFAltima altera\xE7\xE3o do registro."
90
+ })
91
+ ], PromotionContact.prototype, "updatedAt", 2);
92
+ __decorateClass([
93
+ ManyToOne(() => Promotion, (promotion) => promotion.contacts, { onDelete: "CASCADE" }),
94
+ JoinColumn({
95
+ name: "promotion_id",
96
+ foreignKeyConstraintName: "FK_promotion_contacts_promotion"
97
+ })
98
+ ], PromotionContact.prototype, "promotion", 2);
99
+ PromotionContact = __decorateClass([
100
+ Entity("promotion_contacts"),
101
+ Index("IDX_promotion_contacts_promotion_position", ["promotionId", "position"]),
102
+ Check("CHK_promotion_contacts_phone", `"phone" ~ '^[0-9]{10,15}$'`)
103
+ ], PromotionContact);
104
+ export {
105
+ PromotionContact
106
+ };
@@ -0,0 +1,2 @@
1
+ export { PromotionCreative } from './promotion-creative.entity';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/promotions/promotion-creatives/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { PromotionCreative } from "./promotion-creative.entity.js";
2
+ export {
3
+ PromotionCreative
4
+ };
@@ -0,0 +1,21 @@
1
+ import { PromotionCreativeStatus } from '../enums/promotion-creative-status.enum';
2
+ import { PromotionCreativeTemplate } from '../enums/promotion-creative-template.enum';
3
+ import { PromotionPlacement } from '../enums/promotion-placement.enum';
4
+ import { Promotion } from '../promotions/promotion.entity';
5
+ import type { PromotionCreativeContent } from '../types/promotion-content.types';
6
+ export declare class PromotionCreative {
7
+ id: string;
8
+ promotionId: string;
9
+ label: string;
10
+ placement: PromotionPlacement;
11
+ template: PromotionCreativeTemplate;
12
+ content: PromotionCreativeContent;
13
+ consentText: string | null;
14
+ status: PromotionCreativeStatus;
15
+ weight: number;
16
+ createdBy: string | null;
17
+ createdAt: Date;
18
+ updatedAt: Date;
19
+ promotion: Promotion;
20
+ }
21
+ //# sourceMappingURL=promotion-creative.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promotion-creative.entity.d.ts","sourceRoot":"","sources":["../../../src/promotions/promotion-creatives/promotion-creative.entity.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAuBjF,qBAWa,iBAAiB;IAK5B,EAAE,EAAE,MAAM,CAAC;IAOX,WAAW,EAAE,MAAM,CAAC;IAOpB,KAAK,EAAE,MAAM,CAAC;IAOd,SAAS,EAAE,kBAAkB,CAAC;IAO9B,QAAQ,EAAE,yBAAyB,CAAC;IAMpC,OAAO,EAAE,wBAAwB,CAAC;IASlC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAQ3B,MAAM,EAAE,uBAAuB,CAAC;IAOhC,MAAM,EAAE,MAAM,CAAC;IASf,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAQzB,SAAS,EAAE,IAAI,CAAC;IAQhB,SAAS,EAAE,IAAI,CAAC;IAShB,SAAS,EAAE,SAAS,CAAC;CACtB"}
@@ -0,0 +1,136 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result) __defProp(target, key, result);
9
+ return result;
10
+ };
11
+ import {
12
+ Check,
13
+ Column,
14
+ CreateDateColumn,
15
+ Entity,
16
+ Index,
17
+ JoinColumn,
18
+ ManyToOne,
19
+ PrimaryGeneratedColumn,
20
+ UpdateDateColumn
21
+ } from "typeorm";
22
+ import { PromotionCreativeStatus } from "../enums/promotion-creative-status.enum.js";
23
+ import { Promotion } from "../promotions/promotion.entity.js";
24
+ let PromotionCreative = class {
25
+ };
26
+ __decorateClass([
27
+ PrimaryGeneratedColumn("uuid", {
28
+ primaryKeyConstraintName: "PK_promotion_creatives",
29
+ comment: "Identificador \xFAnico do criativo."
30
+ })
31
+ ], PromotionCreative.prototype, "id", 2);
32
+ __decorateClass([
33
+ Column({
34
+ name: "promotion_id",
35
+ type: "uuid",
36
+ comment: "FK promotions.id."
37
+ })
38
+ ], PromotionCreative.prototype, "promotionId", 2);
39
+ __decorateClass([
40
+ Column({
41
+ type: "varchar",
42
+ length: 80,
43
+ comment: 'Nome interno da variante (ex.: "A: p\xF4ster verde"). N\xE3o aparece no app.'
44
+ })
45
+ ], PromotionCreative.prototype, "label", 2);
46
+ __decorateClass([
47
+ Column({
48
+ type: "varchar",
49
+ length: 32,
50
+ comment: "Espa\xE7o do app onde aparece (HOME_MODAL)."
51
+ })
52
+ ], PromotionCreative.prototype, "placement", 2);
53
+ __decorateClass([
54
+ Column({
55
+ type: "varchar",
56
+ length: 48,
57
+ comment: "Layout que o app usa para desenhar (TOURNAMENT_POSTER)."
58
+ })
59
+ ], PromotionCreative.prototype, "template", 2);
60
+ __decorateClass([
61
+ Column({
62
+ type: "jsonb",
63
+ comment: "Textos e visual no formato do template. Ver PromotionCreativeContentByTemplate."
64
+ })
65
+ ], PromotionCreative.prototype, "content", 2);
66
+ __decorateClass([
67
+ Column({
68
+ name: "consent_text",
69
+ type: "text",
70
+ nullable: true,
71
+ comment: "Aviso exibido junto do bot\xE3o de interesse. Obrigat\xF3rio quando o template coleta lead."
72
+ })
73
+ ], PromotionCreative.prototype, "consentText", 2);
74
+ __decorateClass([
75
+ Column({
76
+ type: "varchar",
77
+ length: 16,
78
+ default: PromotionCreativeStatus.ACTIVE,
79
+ comment: "ACTIVE | PAUSED | ARCHIVED. S\xF3 ACTIVE entra no sorteio."
80
+ })
81
+ ], PromotionCreative.prototype, "status", 2);
82
+ __decorateClass([
83
+ Column({
84
+ type: "int",
85
+ default: 1,
86
+ comment: "Peso no sorteio entre os criativos ativos do mesmo espa\xE7o."
87
+ })
88
+ ], PromotionCreative.prototype, "weight", 2);
89
+ __decorateClass([
90
+ Column({
91
+ name: "created_by",
92
+ type: "varchar",
93
+ length: 64,
94
+ nullable: true,
95
+ comment: "Usu\xE1rio do backoffice que criou o criativo."
96
+ })
97
+ ], PromotionCreative.prototype, "createdBy", 2);
98
+ __decorateClass([
99
+ CreateDateColumn({
100
+ name: "created_at",
101
+ type: "timestamptz",
102
+ default: () => "now()",
103
+ comment: "Data/hora de cria\xE7\xE3o do registro."
104
+ })
105
+ ], PromotionCreative.prototype, "createdAt", 2);
106
+ __decorateClass([
107
+ UpdateDateColumn({
108
+ name: "updated_at",
109
+ type: "timestamptz",
110
+ default: () => "now()",
111
+ comment: "Data/hora da \xFAltima troca de status ou peso."
112
+ })
113
+ ], PromotionCreative.prototype, "updatedAt", 2);
114
+ __decorateClass([
115
+ ManyToOne(() => Promotion, (promotion) => promotion.creatives, { onDelete: "CASCADE" }),
116
+ JoinColumn({
117
+ name: "promotion_id",
118
+ foreignKeyConstraintName: "FK_promotion_creatives_promotion"
119
+ })
120
+ ], PromotionCreative.prototype, "promotion", 2);
121
+ PromotionCreative = __decorateClass([
122
+ Entity("promotion_creatives"),
123
+ Index("IDX_promotion_creatives_serving", ["promotionId", "placement", "status"]),
124
+ Check("CHK_promotion_creatives_status", `"status" IN ('ACTIVE', 'PAUSED', 'ARCHIVED')`),
125
+ Check("CHK_promotion_creatives_placement", `"placement" IN ('HOME_MODAL')`),
126
+ Check("CHK_promotion_creatives_template", `"template" IN ('TOURNAMENT_POSTER')`),
127
+ Check("CHK_promotion_creatives_weight", `"weight" >= 1`),
128
+ Check("CHK_promotion_creatives_content_object", `jsonb_typeof("content") = 'object'`),
129
+ Check(
130
+ "CHK_promotion_creatives_consent",
131
+ `"template" <> 'TOURNAMENT_POSTER' OR ("consent_text" IS NOT NULL AND length(trim("consent_text")) > 0)`
132
+ )
133
+ ], PromotionCreative);
134
+ export {
135
+ PromotionCreative
136
+ };
@@ -0,0 +1,2 @@
1
+ export { PromotionEvent } from './promotion-event.entity';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/promotions/promotion-events/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { PromotionEvent } from "./promotion-event.entity.js";
2
+ export {
3
+ PromotionEvent
4
+ };
@@ -0,0 +1,20 @@
1
+ import { User } from '../../app-auth';
2
+ import { PromotionEventType } from '../enums/promotion-event-type.enum';
3
+ import { PromotionMatchSource } from '../enums/promotion-match-source.enum';
4
+ import { PromotionCreative } from '../promotion-creatives/promotion-creative.entity';
5
+ import { Promotion } from '../promotions/promotion.entity';
6
+ export declare class PromotionEvent {
7
+ id: string;
8
+ promotionId: string;
9
+ userId: string | null;
10
+ creativeId: string;
11
+ type: PromotionEventType;
12
+ matchedCityIbgeCode: number | null;
13
+ matchedSource: PromotionMatchSource | null;
14
+ metadata: Record<string, unknown> | null;
15
+ createdAt: Date;
16
+ promotion: Promotion;
17
+ creative: PromotionCreative;
18
+ user: User | null;
19
+ }
20
+ //# sourceMappingURL=promotion-event.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promotion-event.entity.d.ts","sourceRoot":"","sources":["../../../src/promotions/promotion-events/promotion-event.entity.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kDAAkD,CAAC;AACrF,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAuB3D,qBAiBa,cAAc;IAMzB,EAAE,EAAE,MAAM,CAAC;IAOX,WAAW,EAAE,MAAM,CAAC;IAQpB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAOtB,UAAU,EAAE,MAAM,CAAC;IAOnB,IAAI,EAAE,kBAAkB,CAAC;IAQzB,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IASnC,aAAa,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAO3C,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAQzC,SAAS,EAAE,IAAI,CAAC;IAShB,SAAS,EAAE,SAAS,CAAC;IAOrB,QAAQ,EAAE,iBAAiB,CAAC;IAO5B,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;CACnB"}
@@ -0,0 +1,135 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result) __defProp(target, key, result);
9
+ return result;
10
+ };
11
+ import {
12
+ Check,
13
+ Column,
14
+ CreateDateColumn,
15
+ Entity,
16
+ Index,
17
+ JoinColumn,
18
+ ManyToOne,
19
+ PrimaryGeneratedColumn
20
+ } from "typeorm";
21
+ import { User } from "../../app-auth/index.js";
22
+ import { PromotionCreative } from "../promotion-creatives/promotion-creative.entity.js";
23
+ import { Promotion } from "../promotions/promotion.entity.js";
24
+ let PromotionEvent = class {
25
+ };
26
+ __decorateClass([
27
+ PrimaryGeneratedColumn({
28
+ type: "bigint",
29
+ primaryKeyConstraintName: "PK_promotion_events",
30
+ comment: "Identificador sequencial do evento."
31
+ })
32
+ ], PromotionEvent.prototype, "id", 2);
33
+ __decorateClass([
34
+ Column({
35
+ name: "promotion_id",
36
+ type: "uuid",
37
+ comment: "FK promotions.id."
38
+ })
39
+ ], PromotionEvent.prototype, "promotionId", 2);
40
+ __decorateClass([
41
+ Column({
42
+ name: "user_id",
43
+ type: "uuid",
44
+ nullable: true,
45
+ comment: "FK users.id. Nulo depois que a conta \xE9 apagada (evento anonimizado)."
46
+ })
47
+ ], PromotionEvent.prototype, "userId", 2);
48
+ __decorateClass([
49
+ Column({
50
+ name: "creative_id",
51
+ type: "uuid",
52
+ comment: "FK promotion_creatives.id. Criativo que estava na tela."
53
+ })
54
+ ], PromotionEvent.prototype, "creativeId", 2);
55
+ __decorateClass([
56
+ Column({
57
+ type: "varchar",
58
+ length: 32,
59
+ comment: "IMPRESSION | DISMISS | INTEREST | CONTACT_CLICK."
60
+ })
61
+ ], PromotionEvent.prototype, "type", 2);
62
+ __decorateClass([
63
+ Column({
64
+ name: "matched_city_ibge_code",
65
+ type: "int",
66
+ nullable: true,
67
+ comment: "Cidade (c\xF3digo IBGE) que fez o destaque aparecer. Retrato, sem FK."
68
+ })
69
+ ], PromotionEvent.prototype, "matchedCityIbgeCode", 2);
70
+ __decorateClass([
71
+ Column({
72
+ name: "matched_source",
73
+ type: "varchar",
74
+ length: 32,
75
+ nullable: true,
76
+ comment: "Sinal que ligou o usu\xE1rio \xE0 cidade (celular, onboarding, time, follow)."
77
+ })
78
+ ], PromotionEvent.prototype, "matchedSource", 2);
79
+ __decorateClass([
80
+ Column({
81
+ type: "jsonb",
82
+ nullable: true,
83
+ comment: "Dados pr\xF3prios do tipo de evento, quando houver."
84
+ })
85
+ ], PromotionEvent.prototype, "metadata", 2);
86
+ __decorateClass([
87
+ CreateDateColumn({
88
+ name: "created_at",
89
+ type: "timestamptz",
90
+ default: () => "now()",
91
+ comment: "Data/hora do evento."
92
+ })
93
+ ], PromotionEvent.prototype, "createdAt", 2);
94
+ __decorateClass([
95
+ ManyToOne(() => Promotion, { onDelete: "RESTRICT" }),
96
+ JoinColumn({
97
+ name: "promotion_id",
98
+ foreignKeyConstraintName: "FK_promotion_events_promotion"
99
+ })
100
+ ], PromotionEvent.prototype, "promotion", 2);
101
+ __decorateClass([
102
+ ManyToOne(() => PromotionCreative, { onDelete: "NO ACTION" }),
103
+ JoinColumn({
104
+ name: "creative_id",
105
+ foreignKeyConstraintName: "FK_promotion_events_creative"
106
+ })
107
+ ], PromotionEvent.prototype, "creative", 2);
108
+ __decorateClass([
109
+ ManyToOne(() => User, { onDelete: "SET NULL" }),
110
+ JoinColumn({
111
+ name: "user_id",
112
+ foreignKeyConstraintName: "FK_promotion_events_user"
113
+ })
114
+ ], PromotionEvent.prototype, "user", 2);
115
+ PromotionEvent = __decorateClass([
116
+ Entity("promotion_events"),
117
+ Index("IDX_promotion_events_promotion_type_created", ["promotionId", "type", "createdAt"]),
118
+ Index("IDX_promotion_events_user_created", ["userId", "createdAt"]),
119
+ Index("IDX_promotion_events_creative_type", ["creativeId", "type"]),
120
+ Index("UQ_promotion_events_once_per_user", ["promotionId", "userId", "type"], {
121
+ unique: true,
122
+ where: `"type" IN ('DISMISS', 'INTEREST')`
123
+ }),
124
+ Check(
125
+ "CHK_promotion_events_type",
126
+ `"type" IN ('IMPRESSION', 'DISMISS', 'INTEREST', 'CONTACT_CLICK')`
127
+ ),
128
+ Check(
129
+ "CHK_promotion_events_matched_source",
130
+ `"matched_source" IS NULL OR "matched_source" IN ('DEVICE', 'ONBOARDING', 'TEAM_MEMBER', 'TEAM_FOLLOW', 'TOURNAMENT_FOLLOW')`
131
+ )
132
+ ], PromotionEvent);
133
+ export {
134
+ PromotionEvent
135
+ };
@@ -0,0 +1,2 @@
1
+ export { PromotionTarget } from './promotion-target.entity';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/promotions/promotion-targets/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { PromotionTarget } from "./promotion-target.entity.js";
2
+ export {
3
+ PromotionTarget
4
+ };
@@ -0,0 +1,15 @@
1
+ import { BrazilianState } from '../../common/enums/brazilian-state.enum';
2
+ import { City } from '../../facilities/cities';
3
+ import { PromotionTargetType } from '../enums/promotion-target-type.enum';
4
+ import { Promotion } from '../promotions/promotion.entity';
5
+ export declare class PromotionTarget {
6
+ id: string;
7
+ promotionId: string;
8
+ type: PromotionTargetType;
9
+ cityIbgeCode: number | null;
10
+ state: BrazilianState | null;
11
+ createdAt: Date;
12
+ promotion: Promotion;
13
+ city: City | null;
14
+ }
15
+ //# sourceMappingURL=promotion-target.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promotion-target.entity.d.ts","sourceRoot":"","sources":["../../../src/promotions/promotion-targets/promotion-target.entity.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAc3D,qBAea,eAAe;IAK1B,EAAE,EAAE,MAAM,CAAC;IAOX,WAAW,EAAE,MAAM,CAAC;IAOpB,IAAI,EAAE,mBAAmB,CAAC;IAQ1B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAQ5B,KAAK,EAAE,cAAc,GAAG,IAAI,CAAC;IAQ7B,SAAS,EAAE,IAAI,CAAC;IAShB,SAAS,EAAE,SAAS,CAAC;IAQrB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;CACnB"}