1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

add lastupdate to health report

This commit is contained in:
Youssef 2021-11-30 14:05:44 +01:00
parent 991a4a8634
commit 10c1b56e38
4 changed files with 16 additions and 2 deletions

View File

@ -11,7 +11,14 @@ import {
} from '../types/stores/project-store';
import { DEFAULT_ENV } from '../util/constants';
const COLUMNS = ['id', 'name', 'description', 'created_at', 'health'];
const COLUMNS = [
'id',
'name',
'description',
'created_at',
'health',
'last_update',
];
const TABLE = 'projects';
class ProjectStore implements IProjectStore {
@ -30,6 +37,7 @@ class ProjectStore implements IProjectStore {
id: data.id,
name: data.name,
description: data.description,
lastUpdate: data.lastUpdate,
};
}
@ -74,7 +82,7 @@ class ProjectStore implements IProjectStore {
async updateHealth(healthUpdate: IProjectHealthUpdate): Promise<void> {
await this.db(TABLE)
.where({ id: healthUpdate.id })
.update({ health: healthUpdate.health });
.update({ health: healthUpdate.health, last_update: new Date() });
}
async create(project: IProjectInsert): Promise<IProject> {
@ -197,6 +205,7 @@ class ProjectStore implements IProjectStore {
description: row.description,
createdAt: row.created_at,
health: row.health || 100,
lastUpdate: row.last_update || new Date(),
};
}
}

View File

@ -72,6 +72,7 @@ export default class ProjectHealthService {
name: project.name,
description: project.description,
health: project.health,
lastUpdate: project.lastUpdate,
environments,
features,
members,

View File

@ -143,6 +143,7 @@ export interface IProjectOverview {
members: number;
version: number;
health: number;
lastUpdate?: Date;
}
export interface IProjectHealthReport extends IProjectOverview {
@ -309,6 +310,7 @@ export interface IProject {
description: string;
health?: number;
createdAt?: Date;
lastUpdate?: Date;
}
export interface IProjectWithCount extends IProject {

View File

@ -1,3 +1,4 @@
import { DateFileAppender } from 'log4js';
import { IProject } from '../model';
import { Store } from './store';
@ -5,6 +6,7 @@ export interface IProjectInsert {
id: string;
name: string;
description: string;
lastUpdate?: Date;
}
export interface IProjectArchived {