mirror of
https://github.com/thedrewen/protojx-manager.git
synced 2026-03-21 09:48:56 +01:00
feat(service): add Service entity with properties for service management
This commit is contained in:
@@ -13,4 +13,4 @@ export class HostsLog {
|
||||
|
||||
@CreateDateColumn()
|
||||
created_at: Date;
|
||||
}
|
||||
}
|
||||
25
src/entity/service.entity.ts
Normal file
25
src/entity/service.entity.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";
|
||||
|
||||
@Entity({name: 'services'})
|
||||
export class Service {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number;
|
||||
|
||||
@Column()
|
||||
name: string;
|
||||
|
||||
@Column()
|
||||
host: string;
|
||||
|
||||
@Column()
|
||||
alive: boolean;
|
||||
|
||||
@Column()
|
||||
ping_type: string;
|
||||
|
||||
@Column()
|
||||
type: string;
|
||||
|
||||
@Column()
|
||||
notify: boolean;
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import { Follow } from "../entity/follow.entity";
|
||||
import { Guild } from "../entity/guild.entity";
|
||||
import dayjs, { Dayjs } from "dayjs";
|
||||
import { Canvas } from "canvas";
|
||||
import { Service } from "../entity/service.entity";
|
||||
|
||||
type Nofity = {time: Date, name : string, alive : boolean, type : InfraType, host: string};
|
||||
|
||||
@@ -134,12 +135,14 @@ export class StatusService {
|
||||
private hostsLogRepo: Repository<HostsLog>;
|
||||
private followRepo: Repository<Follow>;
|
||||
private guildRepo: Repository<Guild>;
|
||||
private serviceRepo: Repository<Service>;
|
||||
|
||||
constructor() {
|
||||
|
||||
this.hostsLogRepo = AppDataSource.getRepository(HostsLog);
|
||||
this.followRepo = AppDataSource.getRepository(Follow);
|
||||
this.guildRepo = AppDataSource.getRepository(Guild);
|
||||
this.serviceRepo = AppDataSource.getRepository(Service);
|
||||
|
||||
setTimeout(async () => {
|
||||
await this.fetch()
|
||||
|
||||
Reference in New Issue
Block a user