Multi-account support and streaming fixes
- Change LinkedAccount unique constraint to (userId, serviceId, accountId) - Add linkedAccountId to StreamDestination for per-account targeting - OAuth callbacks upsert by accountId so different accounts create new rows - Delete endpoint changed to /providers/accounts/:id - getDecryptedToken resolves tokens by linkedAccountId instead of serviceId - /start transition wrapped in try-catch (enableAutoStart compatibility) - /end always attempts YouTube complete transition regardless of plan status - autoDetectEndedPlans loads tokens per-destination
This commit is contained in:
@@ -49,7 +49,7 @@ model LinkedAccount {
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@unique([userId, serviceId])
|
||||
@@unique([userId, serviceId, accountId])
|
||||
@@index([userId])
|
||||
}
|
||||
|
||||
@@ -67,19 +67,20 @@ model StreamPlan {
|
||||
}
|
||||
|
||||
model StreamDestination {
|
||||
id String @id @default(uuid())
|
||||
planId String
|
||||
plan StreamPlan @relation(fields: [planId], references: [id], onDelete: Cascade)
|
||||
serviceId String
|
||||
title String
|
||||
description String @default("")
|
||||
privacyStatus String @default("public")
|
||||
gameId String @default("")
|
||||
tags String @default("")
|
||||
rtmpUrl String @default("")
|
||||
streamKey String @default("")
|
||||
broadcastId String @default("")
|
||||
status String @default("PENDING")
|
||||
id String @id @default(uuid())
|
||||
planId String
|
||||
plan StreamPlan @relation(fields: [planId], references: [id], onDelete: Cascade)
|
||||
serviceId String
|
||||
linkedAccountId String @default("")
|
||||
title String
|
||||
description String @default("")
|
||||
privacyStatus String @default("public")
|
||||
gameId String @default("")
|
||||
tags String @default("")
|
||||
rtmpUrl String @default("")
|
||||
streamKey String @default("")
|
||||
broadcastId String @default("")
|
||||
status String @default("PENDING")
|
||||
|
||||
@@index([planId])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user