@asumano/worklip-typeorm-db 1.1.103 → 1.1.105

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.
@@ -10,5 +10,6 @@ export declare class AssociateNotification {
10
10
  params: Record<string, unknown> | null;
11
11
  url: string | null;
12
12
  read_at: Date | null;
13
+ deleted_at: Date | null;
13
14
  created: Date;
14
15
  }
@@ -60,6 +60,10 @@ __decorate([
60
60
  (0, typeorm_1.Column)({ type: "datetime", nullable: true, default: null, comment: "Cuándo lo leyó. NULL = sin leer." }),
61
61
  __metadata("design:type", Object)
62
62
  ], AssociateNotification.prototype, "read_at", void 0);
63
+ __decorate([
64
+ (0, typeorm_1.Column)({ type: "datetime", nullable: true, default: null, comment: "Cuándo lo eliminó. NULL = visible." }),
65
+ __metadata("design:type", Object)
66
+ ], AssociateNotification.prototype, "deleted_at", void 0);
63
67
  __decorate([
64
68
  (0, typeorm_1.Column)({ type: "datetime", comment: "Fecha de creación del registro.", default: () => "CURRENT_TIMESTAMP" }),
65
69
  __metadata("design:type", Date)
@@ -16,6 +16,8 @@ export declare class BillingUsageSnapshot {
16
16
  * Reemplazó a `voice_note_seconds`, que se fue con las notas de voz al dejar de cobrarse.
17
17
  */
18
18
  visits_count: number;
19
+ voice_notes: number;
20
+ text_improvements: number;
19
21
  users_count: number;
20
22
  workshops_count: number;
21
23
  created: Date;
@@ -78,6 +78,14 @@ __decorate([
78
78
  }),
79
79
  __metadata("design:type", Number)
80
80
  ], BillingUsageSnapshot.prototype, "visits_count", void 0);
81
+ __decorate([
82
+ (0, typeorm_1.Column)({ type: "int", default: 0, comment: "Notas de voz con IA que usó la empresa en el ciclo." }),
83
+ __metadata("design:type", Number)
84
+ ], BillingUsageSnapshot.prototype, "voice_notes", void 0);
85
+ __decorate([
86
+ (0, typeorm_1.Column)({ type: "int", default: 0, comment: "Mejoras de texto con IA que usó la empresa en el ciclo." }),
87
+ __metadata("design:type", Number)
88
+ ], BillingUsageSnapshot.prototype, "text_improvements", void 0);
81
89
  __decorate([
82
90
  (0, typeorm_1.Column)({
83
91
  type: "int",
@@ -0,0 +1,10 @@
1
+ import { Company } from "./Company";
2
+ import { Associate } from "./Associate";
3
+ export declare class CompanyAiUsage {
4
+ id: number;
5
+ company: Company;
6
+ associate: Associate | null;
7
+ resource_type: number;
8
+ quantity: number;
9
+ created: Date;
10
+ }
@@ -0,0 +1,56 @@
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.CompanyAiUsage = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const Company_1 = require("./Company");
15
+ const Associate_1 = require("./Associate");
16
+ // DOC: CUPOS DE IA (sql/79): una fila por uso cobrado (nota de voz o mejora de texto). El contador
17
+ // rápido vive en Redis; esta tabla es la fuente de verdad para reconstruirlo y para el consumo.
18
+ let CompanyAiUsage = class CompanyAiUsage {
19
+ };
20
+ exports.CompanyAiUsage = CompanyAiUsage;
21
+ __decorate([
22
+ (0, typeorm_1.PrimaryGeneratedColumn)({ type: "int", comment: "Número de identificación (ID) único de cada registro." }),
23
+ __metadata("design:type", Number)
24
+ ], CompanyAiUsage.prototype, "id", void 0);
25
+ __decorate([
26
+ (0, typeorm_1.ManyToOne)(() => Company_1.Company, { onDelete: "CASCADE", onUpdate: "NO ACTION" }),
27
+ (0, typeorm_1.JoinColumn)({ name: "company" }),
28
+ __metadata("design:type", Company_1.Company)
29
+ ], CompanyAiUsage.prototype, "company", void 0);
30
+ __decorate([
31
+ (0, typeorm_1.ManyToOne)(() => Associate_1.Associate, { onDelete: "SET NULL", onUpdate: "NO ACTION", nullable: true }),
32
+ (0, typeorm_1.JoinColumn)({ name: "associate" }),
33
+ __metadata("design:type", Object)
34
+ ], CompanyAiUsage.prototype, "associate", void 0);
35
+ __decorate([
36
+ (0, typeorm_1.Column)({
37
+ type: "int",
38
+ comment: "Recurso (mismos números que subscription_addon.addon_type):\r\n10: Notas de voz con IA.\r\n11: Mejoras de texto con IA.",
39
+ }),
40
+ __metadata("design:type", Number)
41
+ ], CompanyAiUsage.prototype, "resource_type", void 0);
42
+ __decorate([
43
+ (0, typeorm_1.Column)({ type: "int", default: 1, comment: "Cuántas unidades gastó este uso (textos corregidos en una sola llamada)." }),
44
+ __metadata("design:type", Number)
45
+ ], CompanyAiUsage.prototype, "quantity", void 0);
46
+ __decorate([
47
+ (0, typeorm_1.Column)({ type: "datetime", default: () => "CURRENT_TIMESTAMP", comment: "Fecha de creación del registro." }),
48
+ __metadata("design:type", Date)
49
+ ], CompanyAiUsage.prototype, "created", void 0);
50
+ exports.CompanyAiUsage = CompanyAiUsage = __decorate([
51
+ (0, typeorm_1.Entity)({
52
+ comment: "Usos de IA que cuentan contra el cupo del plan: notas de voz y mejoras de texto.",
53
+ name: "company_ai_usage",
54
+ }),
55
+ (0, typeorm_1.Index)("IDX_company_ai_usage_company", ["company", "resource_type", "created"])
56
+ ], CompanyAiUsage);
@@ -14,7 +14,7 @@ const typeorm_1 = require("typeorm");
14
14
  const Company_1 = require("./Company");
15
15
  const Master_1 = require("./Master");
16
16
  // DOC: Ajuste manual del cupo de un recurso (sql/69): pilotos y casos especiales sin vender un paquete.
17
- // Uno por empresa y recurso; hoy solo se usa con el 9 (análisis con IA).
17
+ // Uno por empresa y recurso; se usa con el 9, 10 y 11 (análisis, notas de voz y mejoras de texto con IA).
18
18
  let CompanyQuotaAdjustment = class CompanyQuotaAdjustment {
19
19
  };
20
20
  exports.CompanyQuotaAdjustment = CompanyQuotaAdjustment;
@@ -30,7 +30,7 @@ __decorate([
30
30
  __decorate([
31
31
  (0, typeorm_1.Column)({
32
32
  type: "int",
33
- comment: "Recurso que se ajusta (mismos números que subscription_addon.addon_type):\r\n9: Análisis con IA.",
33
+ comment: "Recurso que se ajusta (mismos números que subscription_addon.addon_type):\r\n9: Análisis con IA.\r\n10: Notas de voz con IA.\r\n11: Mejoras de texto con IA.",
34
34
  }),
35
35
  __metadata("design:type", Number)
36
36
  ], CompanyQuotaAdjustment.prototype, "resource_type", void 0);
@@ -6,5 +6,6 @@ export declare class MasterNotification {
6
6
  params: Record<string, unknown> | null;
7
7
  url: string | null;
8
8
  read_at: Date | null;
9
+ deleted_at: Date | null;
9
10
  created: Date;
10
11
  }
@@ -47,6 +47,10 @@ __decorate([
47
47
  (0, typeorm_1.Column)({ type: "datetime", nullable: true, default: null, comment: "Cuándo lo leyó. NULL = sin leer." }),
48
48
  __metadata("design:type", Object)
49
49
  ], MasterNotification.prototype, "read_at", void 0);
50
+ __decorate([
51
+ (0, typeorm_1.Column)({ type: "datetime", nullable: true, default: null, comment: "Cuándo lo eliminó. NULL = visible." }),
52
+ __metadata("design:type", Object)
53
+ ], MasterNotification.prototype, "deleted_at", void 0);
50
54
  __decorate([
51
55
  (0, typeorm_1.Column)({ type: "datetime", comment: "Fecha de creación del registro.", default: () => "CURRENT_TIMESTAMP" }),
52
56
  __metadata("design:type", Date)
@@ -43,7 +43,7 @@ __decorate([
43
43
  __decorate([
44
44
  (0, typeorm_1.Column)({
45
45
  type: "int",
46
- comment: "Tipo de complemento de suscripción:\r\n1. STORAGE_GB.\r\n2. WHATSAPP_MESSAGES.\r\n3. EMAIL_MESSAGES.\r\n4. USERS.\r\n5. WORKSHOPS.\r\n6. RETIRADO (eran minutos de notas de voz; NO reutilizar: hay filas vendidas con este valor).\r\n7. VISITS.\r\n8. CHATBOT_MESSAGES (respuestas del bot; NO es el 2, que son las notificaciones por plantilla).\r\n9. AI_ANALYSES (análisis con IA del Historial inteligente).",
46
+ comment: "Tipo de complemento de suscripción:\r\n1. STORAGE_GB.\r\n2. WHATSAPP_MESSAGES.\r\n3. EMAIL_MESSAGES.\r\n4. USERS.\r\n5. WORKSHOPS.\r\n6. RETIRADO (eran minutos de notas de voz; NO reutilizar: hay filas vendidas con este valor).\r\n7. VISITS.\r\n8. CHATBOT_MESSAGES (respuestas del bot; NO es el 2, que son las notificaciones por plantilla).\r\n9. AI_ANALYSES (análisis con IA del Historial inteligente).\r\n10. VOICE_NOTES (notas de voz con IA).\r\n11. TEXT_IMPROVEMENTS (mejoras de texto con IA).",
47
47
  }),
48
48
  __metadata("design:type", Number)
49
49
  ], SubscriptionAddon.prototype, "addon_type", void 0);
@@ -51,7 +51,7 @@ __decorate([
51
51
  __decorate([
52
52
  (0, typeorm_1.Column)({
53
53
  type: "int",
54
- comment: "Tipo de recurso:\r\n1. STORAGE_GB.\r\n2. WHATSAPP_MESSAGES.\r\n3. EMAIL_MESSAGES.\r\n4. USERS.\r\n5. WORKSHOPS.\r\n6. RETIRADO (eran minutos de notas de voz; NO reutilizar).\r\n7. VISITS.\r\n8. CHATBOT_MESSAGES (respuestas del bot; NO es el 2, que son las notificaciones por plantilla).\r\n9. AI_ANALYSES (análisis con IA del Historial inteligente).",
54
+ comment: "Tipo de recurso:\r\n1. STORAGE_GB.\r\n2. WHATSAPP_MESSAGES.\r\n3. EMAIL_MESSAGES.\r\n4. USERS.\r\n5. WORKSHOPS.\r\n6. RETIRADO (eran minutos de notas de voz; NO reutilizar).\r\n7. VISITS.\r\n8. CHATBOT_MESSAGES (respuestas del bot; NO es el 2, que son las notificaciones por plantilla).\r\n9. AI_ANALYSES (análisis con IA del Historial inteligente).\r\n10. VOICE_NOTES (notas de voz con IA).\r\n11. TEXT_IMPROVEMENTS (mejoras de texto con IA).",
55
55
  }),
56
56
  __metadata("design:type", Number)
57
57
  ], SubscriptionAddonTemplate.prototype, "addon_type", void 0);
@@ -26,6 +26,8 @@ export declare class SubscriptionPlan {
26
26
  * transcripción pasó a un servicio propio, donde el costo es el del VPS y no por petición.
27
27
  */
28
28
  included_visits: number;
29
+ included_voice_notes: number;
30
+ included_text_improvements: number;
29
31
  max_workshops: number;
30
32
  max_users: number;
31
33
  retention_days: number | null;
@@ -94,6 +94,22 @@ __decorate([
94
94
  }),
95
95
  __metadata("design:type", Number)
96
96
  ], SubscriptionPlan.prototype, "included_visits", void 0);
97
+ __decorate([
98
+ (0, typeorm_1.Column)({
99
+ default: 0,
100
+ type: "int",
101
+ comment: "Notas de voz con IA incluidas por ciclo de facturación. Cada nota cuenta 1.",
102
+ }),
103
+ __metadata("design:type", Number)
104
+ ], SubscriptionPlan.prototype, "included_voice_notes", void 0);
105
+ __decorate([
106
+ (0, typeorm_1.Column)({
107
+ default: 0,
108
+ type: "int",
109
+ comment: "Mejoras de texto con IA incluidas por ciclo de facturación. Cada texto corregido cuenta 1.",
110
+ }),
111
+ __metadata("design:type", Number)
112
+ ], SubscriptionPlan.prototype, "included_text_improvements", void 0);
97
113
  __decorate([
98
114
  (0, typeorm_1.Column)({
99
115
  default: 1,
@@ -34,7 +34,7 @@ __decorate([
34
34
  __decorate([
35
35
  (0, typeorm_1.Column)({
36
36
  type: "int",
37
- comment: "Tipo de recurso:\r\n1. STORAGE_GB.\r\n2. WHATSAPP_MESSAGES.\r\n3. EMAIL_MESSAGES.\r\n4. USERS.\r\n5. WORKSHOPS.\r\n6. RETIRADO (eran segundos de notas de voz; NO reutilizar).\r\n7. VISITS.\r\n8. CHATBOT_MESSAGES (respuestas del bot; NO es el 2, que son las notificaciones por plantilla).\r\n9. AI_ANALYSES (análisis con IA del Historial inteligente).",
37
+ comment: "Tipo de recurso:\r\n1. STORAGE_GB.\r\n2. WHATSAPP_MESSAGES.\r\n3. EMAIL_MESSAGES.\r\n4. USERS.\r\n5. WORKSHOPS.\r\n6. RETIRADO (eran segundos de notas de voz; NO reutilizar).\r\n7. VISITS.\r\n8. CHATBOT_MESSAGES (respuestas del bot; NO es el 2, que son las notificaciones por plantilla).\r\n9. AI_ANALYSES (análisis con IA del Historial inteligente).\r\n10. VOICE_NOTES (notas de voz con IA).\r\n11. TEXT_IMPROVEMENTS (mejoras de texto con IA).",
38
38
  }),
39
39
  __metadata("design:type", Number)
40
40
  ], UsageAlert.prototype, "resource_type", void 0);
@@ -126,3 +126,4 @@ export { VisitSearchPerson } from "./entities/VisitSearchPerson";
126
126
  export { VisitAiAnalysis } from "./entities/VisitAiAnalysis";
127
127
  export { VisitSearchHistory } from "./entities/VisitSearchHistory";
128
128
  export { CompanyQuotaAdjustment } from "./entities/CompanyQuotaAdjustment";
129
+ export { CompanyAiUsage } from "./entities/CompanyAiUsage";
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AssociateSection = exports.AssociatePermission = exports.AssociateRole = exports.AssociatePlatform = exports.ClientSubscription = exports.ClientPlanLimit = exports.ClientPlan = exports.ClientDocumentDispute = exports.ReviewTaskEvent = exports.ReviewTask = exports.MasterNotification = exports.ClientSession = exports.ClientNotification = exports.ClientIdentity = exports.PypRuleVote = exports.PypRule = exports.VehicleVerification = exports.ClientVehicleInvite = exports.ClientVehicle = exports.CompanyVehicle = exports.CompanyClient = exports.Appointment = exports.DocumentType = exports.ReminderType = exports.Reminder = exports.ServiceOrderHistory = exports.ServiceOrder = exports.TemplateSection = exports.SectionItem = exports.Section = exports.Template = exports.Workshop = exports.GlobalTemplateSection = exports.GlobalSectionItem = exports.GlobalSection = exports.GlobalTemplate = exports.AssociateNotification = exports.AssociateSession = exports.MasterSession = exports.Associate = exports.Client = exports.Master = exports.VehicleReport = exports.Vehicle = exports.Brand = exports.Company = exports.City = exports.Region = exports.WhatsappLine = exports.Country = void 0;
4
4
  exports.MetricEvent = exports.StageMetric = exports.AssociateDailyStats = exports.WorkshopDailyStats = exports.WorkboardEvent = exports.ServiceOrderStage = exports.WorkboardStatus = exports.CompanyDiscount = exports.DiscountCode = exports.WorkshopDisplay = exports.WorkshopInsurer = exports.WorkshopOfferedService = exports.Insurer = exports.OfferedService = exports.ServiceOrderPart = exports.ServiceOrderObservation = exports.VisitResult = exports.ReminderTypeCompanyType = exports.PlanCompanyType = exports.WorkshopCompanyType = exports.CompanyCompanyType = exports.CompanyType = exports.PlanFeature = exports.CompanyFeature = exports.Feature = exports.UsageAlert = exports.SubscriptionAddonTemplate = exports.PaymentTransaction = exports.BillingInvoice = exports.EmailSuppression = exports.EmailLog = exports.WhatsappLog = exports.ServiceOrderApproval = exports.MediaFile = exports.BillingUsageSnapshot = exports.PaymentMethod = exports.SubscriptionAddon = exports.CompanySubscription = exports.SubscriptionPlan = exports.CountryHoliday = exports.CompanyVehicleType = exports.BrandVehicleType = exports.CompanyBrand = exports.VehicleType = exports.MasterSection = exports.MasterPermission = exports.MasterRole = exports.MasterPlatform = exports.MasterPasswordReset = exports.AssociatePasswordReset = void 0;
5
- exports.CompanyQuotaAdjustment = exports.VisitSearchHistory = exports.VisitAiAnalysis = exports.VisitSearchPerson = exports.VisitItemSearch = exports.GlobalSectionItems = exports.GlobalSections = exports.GlobalTemplates = exports.SubscriptionAddonTemplates = exports.SubscriptionPlans = exports.Masters = exports.Companies = exports.WorkshopsByAssociate = exports.Workshops = exports.SectionItems = exports.Sections = exports.Templates = exports.Reminders = exports.Vehicles = exports.Clients = exports.ServicesOrderLite = exports.ServicesOrder = exports.Associates = exports.AssociateSectionFeature = exports.AttendanceMark = exports.WorkshopReader = exports.AssociateTag = exports.WorkshopTag = void 0;
5
+ exports.CompanyAiUsage = exports.CompanyQuotaAdjustment = exports.VisitSearchHistory = exports.VisitAiAnalysis = exports.VisitSearchPerson = exports.VisitItemSearch = exports.GlobalSectionItems = exports.GlobalSections = exports.GlobalTemplates = exports.SubscriptionAddonTemplates = exports.SubscriptionPlans = exports.Masters = exports.Companies = exports.WorkshopsByAssociate = exports.Workshops = exports.SectionItems = exports.Sections = exports.Templates = exports.Reminders = exports.Vehicles = exports.Clients = exports.ServicesOrderLite = exports.ServicesOrder = exports.Associates = exports.AssociateSectionFeature = exports.AttendanceMark = exports.WorkshopReader = exports.AssociateTag = exports.WorkshopTag = void 0;
6
6
  var Country_1 = require("./entities/Country");
7
7
  Object.defineProperty(exports, "Country", { enumerable: true, get: function () { return Country_1.Country; } });
8
8
  var WhatsappLine_1 = require("./entities/WhatsappLine");
@@ -286,3 +286,5 @@ var VisitSearchHistory_1 = require("./entities/VisitSearchHistory");
286
286
  Object.defineProperty(exports, "VisitSearchHistory", { enumerable: true, get: function () { return VisitSearchHistory_1.VisitSearchHistory; } });
287
287
  var CompanyQuotaAdjustment_1 = require("./entities/CompanyQuotaAdjustment");
288
288
  Object.defineProperty(exports, "CompanyQuotaAdjustment", { enumerable: true, get: function () { return CompanyQuotaAdjustment_1.CompanyQuotaAdjustment; } });
289
+ var CompanyAiUsage_1 = require("./entities/CompanyAiUsage");
290
+ Object.defineProperty(exports, "CompanyAiUsage", { enumerable: true, get: function () { return CompanyAiUsage_1.CompanyAiUsage; } });
@@ -8,6 +8,8 @@ export declare class SubscriptionPlans {
8
8
  included_whatsapp_messages: number;
9
9
  included_emails: number;
10
10
  included_visits: number;
11
+ included_voice_notes: number;
12
+ included_text_improvements: number;
11
13
  max_workshops: number;
12
14
  max_users: number;
13
15
  retention_days: number | null;
@@ -50,6 +50,14 @@ __decorate([
50
50
  (0, typeorm_1.ViewColumn)(),
51
51
  __metadata("design:type", Number)
52
52
  ], SubscriptionPlans.prototype, "included_visits", void 0);
53
+ __decorate([
54
+ (0, typeorm_1.ViewColumn)(),
55
+ __metadata("design:type", Number)
56
+ ], SubscriptionPlans.prototype, "included_voice_notes", void 0);
57
+ __decorate([
58
+ (0, typeorm_1.ViewColumn)(),
59
+ __metadata("design:type", Number)
60
+ ], SubscriptionPlans.prototype, "included_text_improvements", void 0);
53
61
  __decorate([
54
62
  (0, typeorm_1.ViewColumn)(),
55
63
  __metadata("design:type", Number)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asumano/worklip-typeorm-db",
3
- "version": "1.1.103",
3
+ "version": "1.1.105",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },