diff --git a/src/lib/db/project-store.ts b/src/lib/db/project-store.ts index 8d6efc3b43..2dbe02564b 100644 --- a/src/lib/db/project-store.ts +++ b/src/lib/db/project-store.ts @@ -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 { 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 { @@ -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(), }; } } diff --git a/src/lib/services/project-health-service.ts b/src/lib/services/project-health-service.ts index 24651affb5..a2b1cf379c 100644 --- a/src/lib/services/project-health-service.ts +++ b/src/lib/services/project-health-service.ts @@ -72,6 +72,7 @@ export default class ProjectHealthService { name: project.name, description: project.description, health: project.health, + lastUpdate: project.lastUpdate, environments, features, members, diff --git a/src/lib/types/model.ts b/src/lib/types/model.ts index 495beb746d..50c8fe5d3e 100644 --- a/src/lib/types/model.ts +++ b/src/lib/types/model.ts @@ -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 { diff --git a/src/lib/types/stores/project-store.ts b/src/lib/types/stores/project-store.ts index adcff6168e..6ca53d4a97 100644 --- a/src/lib/types/stores/project-store.ts +++ b/src/lib/types/stores/project-store.ts @@ -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 {