@regincap/prisma-schema 1.0.0 → 1.0.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@regincap/prisma-schema",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Shared Prisma schema and generated client for Regin Cap projects",
5
5
  "main": "generated/client/index.js",
6
6
  "types": "generated/client/index.d.ts",
@@ -4130,3 +4130,114 @@ enum LeadStatus {
4130
4130
  REJECTED
4131
4131
  CONVERTED
4132
4132
  }
4133
+
4134
+
4135
+ model JourneySmsEvent {
4136
+ id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
4137
+ tenantDomain String @map("tenant_domain") @db.VarChar(255)
4138
+ customerID Int @map("customer_id")
4139
+ leadID Int? @map("lead_id")
4140
+ eventType String @map("event_type") @db.VarChar(64)
4141
+ eventPayload Json? @map("event_payload")
4142
+ idempotencyKey String @unique @map("idempotency_key") @db.VarChar(191)
4143
+ processingStatus String @default("PENDING") @map("processing_status") @db.VarChar(32)
4144
+ createdAt DateTime @default(now()) @map("created_at") @db.DateTime(3)
4145
+ processedAt DateTime? @map("processed_at") @db.DateTime(3)
4146
+
4147
+ jobs JourneySmsJob[]
4148
+
4149
+ @@index([customerID, eventType])
4150
+ @@index([processingStatus, createdAt])
4151
+ @@map("journey_sms_event")
4152
+ }
4153
+
4154
+ model JourneySmsRule {
4155
+ id Int @id @default(autoincrement())
4156
+ tenantDomain String @default("*") @map("tenant_domain") @db.VarChar(255)
4157
+ category String @db.VarChar(64)
4158
+ stage String? @db.VarChar(64)
4159
+ triggerType String @map("trigger_type") @db.VarChar(32)
4160
+ delayMinutes Int @default(0) @map("delay_minutes")
4161
+ templateCode String @map("template_code") @db.VarChar(64)
4162
+ isActive Boolean @default(true) @map("is_active")
4163
+ priority Int @default(100)
4164
+ frequencyLimit Int? @map("frequency_limit")
4165
+ configuration Json? @map("configuration")
4166
+ createdAt DateTime @default(now()) @map("created_at") @db.DateTime(3)
4167
+ updatedAt DateTime @updatedAt @map("updated_at") @db.DateTime(3)
4168
+
4169
+ jobs JourneySmsJob[]
4170
+
4171
+ @@index([category, stage, triggerType, isActive])
4172
+ @@index([tenantDomain, isActive])
4173
+ @@map("journey_sms_rule")
4174
+ }
4175
+
4176
+ model JourneySmsTemplate {
4177
+ id Int @id @default(autoincrement())
4178
+ templateCode String @unique @map("template_code") @db.VarChar(64)
4179
+ category String @db.VarChar(64)
4180
+ language String @default("en") @db.VarChar(8)
4181
+ message String @db.Text
4182
+ dltTemplateId String? @map("dlt_template_id") @db.VarChar(64)
4183
+ isActive Boolean @default(true) @map("is_active")
4184
+ createdAt DateTime @default(now()) @map("created_at") @db.DateTime(3)
4185
+ updatedAt DateTime @updatedAt @map("updated_at") @db.DateTime(3)
4186
+
4187
+ @@index([category, isActive])
4188
+ @@map("journey_sms_template")
4189
+ }
4190
+
4191
+ model JourneySmsJob {
4192
+ id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
4193
+ tenantDomain String @map("tenant_domain") @db.VarChar(255)
4194
+ customerID Int @map("customer_id")
4195
+ leadID Int? @map("lead_id")
4196
+ eventId BigInt? @map("event_id") @db.UnsignedBigInt
4197
+ ruleId Int? @map("rule_id")
4198
+ templateCode String @map("template_code") @db.VarChar(64)
4199
+ notificationType String @map("notification_type") @db.VarChar(64)
4200
+ scheduledAt DateTime @map("scheduled_at") @db.DateTime(3)
4201
+ status String @default("PENDING") @db.VarChar(32)
4202
+ retryCount Int @default(0) @map("retry_count")
4203
+ idempotencyKey String @unique @map("idempotency_key") @db.VarChar(191)
4204
+ bullJobId String? @map("bull_job_id") @db.VarChar(128)
4205
+ lastError String? @map("last_error") @db.VarChar(512)
4206
+ createdAt DateTime @default(now()) @map("created_at") @db.DateTime(3)
4207
+ updatedAt DateTime @updatedAt @map("updated_at") @db.DateTime(3)
4208
+
4209
+ event JourneySmsEvent? @relation(fields: [eventId], references: [id], onDelete: SetNull)
4210
+ rule JourneySmsRule? @relation(fields: [ruleId], references: [id], onDelete: SetNull)
4211
+ logs JourneySmsLog[]
4212
+
4213
+ @@index([status, scheduledAt])
4214
+ @@index([customerID, notificationType, status])
4215
+ @@index([leadID, status])
4216
+ @@map("journey_sms_job")
4217
+ }
4218
+
4219
+ model JourneySmsLog {
4220
+ id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
4221
+ customerID Int @map("customer_id")
4222
+ leadID Int? @map("lead_id")
4223
+ notificationJobId BigInt? @map("notification_job_id") @db.UnsignedBigInt
4224
+ mobileNumber String @map("mobile_number") @db.VarChar(20)
4225
+ templateCode String @map("template_code") @db.VarChar(64)
4226
+ message String @db.Text
4227
+ provider String @db.VarChar(32)
4228
+ providerMessageId String? @map("provider_message_id") @db.VarChar(128)
4229
+ providerResponse Json? @map("provider_response")
4230
+ status String @db.VarChar(32)
4231
+ failureReason String? @map("failure_reason") @db.VarChar(512)
4232
+ sentAt DateTime? @map("sent_at") @db.DateTime(3)
4233
+ deliveredAt DateTime? @map("delivered_at") @db.DateTime(3)
4234
+ createdAt DateTime @default(now()) @map("created_at") @db.DateTime(3)
4235
+
4236
+ job JourneySmsJob? @relation(fields: [notificationJobId], references: [id], onDelete: SetNull)
4237
+
4238
+ @@index([customerID, templateCode, createdAt])
4239
+ @@index([providerMessageId])
4240
+ @@index([status, createdAt])
4241
+ @@map("journey_sms_log")
4242
+ }
4243
+