Phase7
This commit is contained in:
@@ -19,12 +19,16 @@ import { SessionGuard } from '../auth/guards/session.guard';
|
||||
import { ZodValidationPipe } from '../common/pipes/zod-validation.pipe';
|
||||
|
||||
import { ServersService } from './servers.service';
|
||||
import { IdleService } from './idle/idle.service';
|
||||
|
||||
@ApiTags('servers')
|
||||
@Controller('servers')
|
||||
@UseGuards(SessionGuard)
|
||||
export class ServersController {
|
||||
constructor(private readonly serversService: ServersService) {}
|
||||
constructor(
|
||||
private readonly serversService: ServersService,
|
||||
private readonly idleService: IdleService,
|
||||
) {}
|
||||
|
||||
@Post()
|
||||
@HttpCode(HttpStatus.CREATED)
|
||||
@@ -104,4 +108,23 @@ export class ServersController {
|
||||
) {
|
||||
return this.serversService.cancelQueuedStart(user.id, id);
|
||||
}
|
||||
|
||||
@Get(':id/idle')
|
||||
@ApiOperation({ summary: 'Get idle shutdown status' })
|
||||
idleStatus(
|
||||
@CurrentUser() user: { id: string },
|
||||
@Param('id', ParseUUIDPipe) id: string,
|
||||
) {
|
||||
return this.idleService.getIdleStatus(user.id, id);
|
||||
}
|
||||
|
||||
@Post(':id/idle/extend')
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@ApiOperation({ summary: 'Extend idle shutdown countdown by 5 minutes' })
|
||||
extendIdle(
|
||||
@CurrentUser() user: { id: string },
|
||||
@Param('id', ParseUUIDPipe) id: string,
|
||||
) {
|
||||
return this.idleService.extendIdleCountdown(user.id, id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user