fix: enforce application limits and signature format

This commit is contained in:
hectorzhao
2026-07-22 16:29:22 +08:00
parent cd085d2712
commit a09036c67b
20 changed files with 479 additions and 79 deletions
+24 -9
View File
@@ -366,7 +366,7 @@ model SmsApplication {
interfaceType String @default("cmpp20")
cmppMaxConnections Int @default(1)
cmppWindowSize Int @default(16)
dailyLimit Int?
dailyLimit Int @default(100000)
customerUnitPrice BigInt @default(0)
queuePriority String @default("normal")
maxPhonesPerTask Int @default(1000000)
@@ -399,6 +399,7 @@ model SmsApplication {
openApiRequests OpenApiRequest[]
httpWebhookEndpoints HttpWebhookEndpoint[]
httpWebhookEvents HttpWebhookEvent[]
dailyUsages SmsApplicationDailyUsage[]
@@index([tenantId, status])
}
@@ -419,20 +420,20 @@ model SmsApplicationHttpConfig {
id String @id @default(cuid())
applicationId String @unique
enabled Boolean @default(false)
sendEnabled Boolean @default(false)
messageQueryEnabled Boolean @default(false)
receiptWebhookEnabled Boolean @default(false)
uplinkWebhookEnabled Boolean @default(false)
uplinkQueryEnabled Boolean @default(false)
credentialSelfServiceEnabled Boolean @default(false)
sendEnabled Boolean @default(true)
messageQueryEnabled Boolean @default(true)
receiptWebhookEnabled Boolean @default(true)
uplinkWebhookEnabled Boolean @default(true)
uplinkQueryEnabled Boolean @default(true)
credentialSelfServiceEnabled Boolean @default(true)
qpsLimit Int @default(10)
timestampToleranceSeconds Int @default(300)
maxCredentialCount Int @default(2)
uplinkRetentionDays Int @default(90)
maxQueryRangeDays Int @default(31)
maxPageSize Int @default(100)
receiptDeliveryMode String @default("cmpp")
uplinkDeliveryMode String @default("cmpp")
receiptDeliveryMode String @default("http")
uplinkDeliveryMode String @default("http")
webhookRetryEnabled Boolean @default(true)
webhookMaxAttempts Int @default(7)
webhookTimeoutSeconds Int @default(10)
@@ -445,6 +446,20 @@ model SmsApplicationHttpConfig {
application SmsApplication @relation(fields: [applicationId], references: [id], onDelete: Cascade)
}
model SmsApplicationDailyUsage {
id String @id @default(cuid())
applicationId String
usageDate DateTime @db.Date
usedCount Int @default(0)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
application SmsApplication @relation(fields: [applicationId], references: [id], onDelete: Cascade)
@@unique([applicationId, usageDate])
@@index([usageDate])
}
model SmsApplicationHttpIpAllowlist {
id String @id @default(cuid())
applicationId String