feat: streamline schema definitions and enhance service logic

- Refactored package.json to consolidate Jest configuration for improved readability.
- Cleaned up launch.json by removing unnecessary whitespace for better formatting.
- Updated CronService to refine service disabling logic based on recent activity, ensuring more accurate service management.
- Enhanced MeetingRoom and WorkshopMeetingRoom schemas with consistent formatting and improved field descriptions for clarity.
- Improved error handling in MeetingRoom schema to provide clearer feedback for unauthorized access and missing resources.
- Updated pothos.generated.ts to reflect recent schema changes, ensuring type consistency across the application.

These changes enhance the overall structure and maintainability of the codebase, improving service management and user experience.
This commit is contained in:
2024-12-15 21:50:32 +07:00
parent c886d9a02f
commit 07158bef3a
7 changed files with 1417 additions and 1331 deletions

View File

@@ -161,22 +161,30 @@ export class CronService {
async taskDisableServiceWithoutSchedule() {
const services = await this.prisma.service.findMany({
where: {
NOT: {
// check if service has any schedule in the past 30 days
managedService: {
some: {
schedule: {
some: {
scheduleStart: { gte: DateTimeUtils.now().minus({ days: 30 }).toJSDate() },
status: ServiceStatus.APPROVED,
AND: [
{
managedService: {
none: {
schedule: {
some: {
scheduleStart: {
gte: DateTimeUtils.now().minus({ minutes: 10 }).toJSDate(),
},
},
},
},
},
},
// and createdAt is more than 3 days ago
createdAt: {
lt: DateTimeUtils.now().minus({ days: 3 }).toJSDate(),
{
createdAt: {
lt: DateTimeUtils.now().minus({ days: 3 }).toJSDate(),
},
},
},
],
},
include: {
managedService: true,
},
})
@@ -187,7 +195,10 @@ export class CronService {
status: ServiceStatus.INACTIVE,
},
})
Logger.log(`Service ${service.id} has been disabled`, 'CronService')
Logger.log(
`Service ${service.id} has been disabled due to inactivity. Managed Services: ${service.managedService.length}`,
'CronService',
)
}
}