feat(service): add Service entity with properties for service management

This commit is contained in:
2025-11-26 09:45:16 +01:00
parent 58403fd32e
commit 104023162a
7 changed files with 30 additions and 159 deletions

View File

@@ -13,4 +13,4 @@ export class HostsLog {
@CreateDateColumn()
created_at: Date;
}
}

View 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;
}

View File

@@ -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()