feat: 增加通知Provider和Jenkins自动同步

This commit is contained in:
湛兮
2026-06-11 21:07:54 +08:00
parent caec5a618d
commit 163f411485
14 changed files with 568 additions and 31 deletions
+5 -4
View File
@@ -3,7 +3,7 @@ import { LlmClient } from '../agent/llm.client';
import { EnvConfig } from '../config/env.schema';
import { GiteaClient } from '../integrations/gitea/gitea.client';
import { JenkinsClient } from '../integrations/jenkins/jenkins.client';
import { WeComClient } from '../notifications/wecom/wecom.client';
import { DeployNotificationService } from '../notifications/wecom/deploy-notification.service';
import { PrismaService } from '../prisma/prisma.service';
import { HealthService } from './health.service';
@@ -26,9 +26,9 @@ describe('HealthService', () => {
const gitea = {
healthSummary: jest.fn(() => ({ status: 'not_configured' as const })),
} satisfies Pick<GiteaClient, 'healthSummary'>;
const weCom = {
const notification = {
healthSummary: jest.fn(() => ({ status: 'not_configured' as const })),
} satisfies Pick<WeComClient, 'healthSummary'>;
} satisfies Pick<DeployNotificationService, 'healthSummary'>;
const llm = {
healthSummary: jest.fn(() => ({ status: 'not_configured' as const })),
} satisfies Pick<LlmClient, 'healthSummary'>;
@@ -37,7 +37,7 @@ describe('HealthService', () => {
prisma as unknown as PrismaService,
jenkins as unknown as JenkinsClient,
gitea as unknown as GiteaClient,
weCom as unknown as WeComClient,
notification as unknown as DeployNotificationService,
llm as unknown as LlmClient,
);
@@ -46,5 +46,6 @@ describe('HealthService', () => {
expect(health.status).toBe('ok');
expect(health.dependencies.database.status).toBe('not_configured');
expect(health.dependencies.jenkins.status).toBe('not_configured');
expect(health.dependencies.notification.status).toBe('not_configured');
});
});
+3 -3
View File
@@ -4,7 +4,7 @@ import { LlmClient } from '../agent/llm.client';
import { EnvConfig } from '../config/env.schema';
import { GiteaClient } from '../integrations/gitea/gitea.client';
import { JenkinsClient } from '../integrations/jenkins/jenkins.client';
import { WeComClient } from '../notifications/wecom/wecom.client';
import { DeployNotificationService } from '../notifications/wecom/deploy-notification.service';
import { PrismaService } from '../prisma/prisma.service';
type HealthStatus = 'ok' | 'not_configured' | 'unavailable';
@@ -16,7 +16,7 @@ export class HealthService {
private readonly prisma: PrismaService,
private readonly jenkins: JenkinsClient,
private readonly gitea: GiteaClient,
private readonly weCom: WeComClient,
private readonly notification: DeployNotificationService,
private readonly llm: LlmClient,
) {}
@@ -32,7 +32,7 @@ export class HealthService {
: { status: 'not_configured' as const },
jenkins: this.jenkins.healthSummary(),
gitea: this.gitea.healthSummary(),
wecom: this.weCom.healthSummary(),
notification: this.notification.healthSummary(),
llm: this.llm.healthSummary(),
};
const hasUnavailable = Object.values(dependencies).some(