feat: integrate LiveKit services into Collaboration and Meeting Room modules
- Added LiveKitModule to CollaborationSession and MeetingRoom modules for enhanced real-time collaboration features. - Updated CollaborationSessionSchema to include LiveKit services for managing participant access and room permissions. - Implemented a new cron job in CronService to disable services without schedules for over 30 days, improving service management. - Enhanced GraphQL schema generation with improved filtering logic for better performance and readability. - Refactored LiveKit services to streamline access token creation and room management functionalities.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { Injectable, Logger } from '@nestjs/common'
|
||||
import { Cron } from '@nestjs/schedule'
|
||||
import { CronExpression } from '@nestjs/schedule'
|
||||
import { OrderStatus, PaymentStatus, ScheduleDateStatus, ScheduleStatus } from '@prisma/client'
|
||||
import { OrderStatus, PaymentStatus, ScheduleDateStatus, ScheduleStatus, ServiceStatus } from '@prisma/client'
|
||||
import { DateTimeUtils } from 'src/common/utils/datetime.utils'
|
||||
import { NotificationService } from 'src/Notification/notification.service'
|
||||
import { PrismaService } from 'src/Prisma/prisma.service'
|
||||
@@ -189,4 +189,34 @@ export class CronService {
|
||||
}
|
||||
}
|
||||
}
|
||||
// cron every day to disable service without any schedule in the past 30 days
|
||||
@Cron(CronExpression.EVERY_DAY_AT_1AM)
|
||||
async taskDisableServiceWithoutSchedule() {
|
||||
Logger.log('Disabling service without any schedule', 'taskDisableServiceWithoutSchedule')
|
||||
const services = await this.prisma.managedService.findMany({
|
||||
where: {
|
||||
NOT: {
|
||||
schedule: {
|
||||
some: {
|
||||
scheduleStart: { gte: DateTimeUtils.now().minus({ days: 30 }).toJSDate() },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
for (const service of services) {
|
||||
await this.prisma.managedService.update({
|
||||
where: { id: service.id },
|
||||
data: {
|
||||
service: {
|
||||
update: {
|
||||
status: ServiceStatus.INACTIVE,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
Logger.log(`Service ${service.id} has been disabled`, 'taskDisableServiceWithoutSchedule')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user