работаем бля работаем

This commit is contained in:
2026-05-09 03:21:44 +06:00
parent f845777bac
commit 0b148c6a7d
169 changed files with 15816 additions and 1005 deletions

View File

@@ -0,0 +1,33 @@
import type { Router } from 'mediasoup/types'
import type { Channel as DbChannel } from '../../../prisma/generated-client/client.ts'
import { Channel } from './Channel.ts'
export class ChannelManager {
private channels = new Map<string, Channel>()
private mediasoupRouter: Router
constructor(mediasoupRouter: Router) {
this.mediasoupRouter = mediasoupRouter
}
async create(newChannel: Channel | DbChannel) {
if (newChannel instanceof Channel) {
this.channels.set(newChannel.id, newChannel)
}
else {
this.channels.set(newChannel.id, await Channel.create(newChannel.id, newChannel.persistent, this.mediasoupRouter))
}
}
get(id: string) {
return this.channels.get(id)
}
delete(id: string) {
this.channels.delete(id)
}
get all() {
return Array.from(this.channels.values())
}
}