File size: 637 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { Injectable } from "@nestjs/common";
import { HealthIndicator, HealthIndicatorResult } from "@nestjs/terminus";

import { PrinterService } from "../printer/printer.service";

@Injectable()
export class BrowserHealthIndicator extends HealthIndicator {
  constructor(private readonly printerService: PrinterService) {
    super();
  }

  async isHealthy(): Promise<HealthIndicatorResult> {
    try {
      const version = await this.printerService.getVersion();

      return this.getStatus("browser", true, { version });
    } catch (error) {
      return this.getStatus("browser", false, { message: error.message });
    }
  }
}