1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

feat: return archived at in project overview (#7888)

This commit is contained in:
Mateusz Kwasniewski 2024-08-15 14:15:06 +02:00 committed by GitHub
parent 413df42555
commit 30cbde573b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 22 additions and 1 deletions

View File

@ -314,6 +314,9 @@ test('should archive project', async () => {
expect(archivedProjects).toMatchObject([
{ id: 'test-archive', archivedAt: expect.any(Date) },
]);
const archivedProject = await projectService.getProject(project.id);
expect(archivedProject).toMatchObject({ archivedAt: expect.any(Date) });
});
test('should revive project', async () => {

View File

@ -1513,6 +1513,9 @@ export default class ProjectService {
health: project.health || 0,
favorite: favorite,
updatedAt: project.updatedAt,
...(this.flagResolver.isEnabled('archiveProjects')
? { archivedAt: project.archivedAt }
: {}),
createdAt: project.createdAt,
environments,
featureTypeCounts,

View File

@ -247,8 +247,13 @@ class ProjectStore implements IProjectStore {
}
async get(id: string): Promise<IProject> {
let extraColumns: string[] = [];
if (this.flagResolver.isEnabled('archiveProjects')) {
extraColumns = ['archived_at'];
}
return this.db
.first([...COLUMNS, ...SETTINGS_COLUMNS])
.first([...COLUMNS, ...SETTINGS_COLUMNS, ...extraColumns])
.from(TABLE)
.leftJoin(
SETTINGS_TABLE,
@ -791,6 +796,7 @@ class ProjectStore implements IProjectStore {
createdAt: row.created_at,
health: row.health ?? 100,
updatedAt: row.updated_at || new Date(),
...(row.archived_at ? { archivedAt: row.archived_at } : {}),
mode: row.project_mode || 'open',
defaultStickiness: row.default_stickiness || 'default',
featureLimit: row.feature_limit,

View File

@ -115,6 +115,13 @@ export const projectOverviewSchema = {
example: '2023-02-10T08:36:35.262Z',
description: 'When the project was last updated.',
},
archivedAt: {
type: 'string',
format: 'date-time',
nullable: true,
example: '2023-02-10T08:36:35.262Z',
description: 'When the project was archived.',
},
createdAt: {
type: 'string',
format: 'date-time',

View File

@ -305,6 +305,7 @@ export interface IProjectOverview {
health: number;
favorite?: boolean;
updatedAt?: Date;
archivedAt?: Date;
createdAt: Date | undefined;
stats?: IProjectStats;
mode: ProjectMode;
@ -525,6 +526,7 @@ export interface IProject {
health?: number;
createdAt?: Date;
updatedAt?: Date;
archivedAt?: Date;
changeRequestsEnabled?: boolean;
mode: ProjectMode;
defaultStickiness: string;