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:
parent
413df42555
commit
30cbde573b
@ -314,6 +314,9 @@ test('should archive project', async () => {
|
|||||||
expect(archivedProjects).toMatchObject([
|
expect(archivedProjects).toMatchObject([
|
||||||
{ id: 'test-archive', archivedAt: expect.any(Date) },
|
{ 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 () => {
|
test('should revive project', async () => {
|
||||||
|
@ -1513,6 +1513,9 @@ export default class ProjectService {
|
|||||||
health: project.health || 0,
|
health: project.health || 0,
|
||||||
favorite: favorite,
|
favorite: favorite,
|
||||||
updatedAt: project.updatedAt,
|
updatedAt: project.updatedAt,
|
||||||
|
...(this.flagResolver.isEnabled('archiveProjects')
|
||||||
|
? { archivedAt: project.archivedAt }
|
||||||
|
: {}),
|
||||||
createdAt: project.createdAt,
|
createdAt: project.createdAt,
|
||||||
environments,
|
environments,
|
||||||
featureTypeCounts,
|
featureTypeCounts,
|
||||||
|
@ -247,8 +247,13 @@ class ProjectStore implements IProjectStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async get(id: string): Promise<IProject> {
|
async get(id: string): Promise<IProject> {
|
||||||
|
let extraColumns: string[] = [];
|
||||||
|
if (this.flagResolver.isEnabled('archiveProjects')) {
|
||||||
|
extraColumns = ['archived_at'];
|
||||||
|
}
|
||||||
|
|
||||||
return this.db
|
return this.db
|
||||||
.first([...COLUMNS, ...SETTINGS_COLUMNS])
|
.first([...COLUMNS, ...SETTINGS_COLUMNS, ...extraColumns])
|
||||||
.from(TABLE)
|
.from(TABLE)
|
||||||
.leftJoin(
|
.leftJoin(
|
||||||
SETTINGS_TABLE,
|
SETTINGS_TABLE,
|
||||||
@ -791,6 +796,7 @@ class ProjectStore implements IProjectStore {
|
|||||||
createdAt: row.created_at,
|
createdAt: row.created_at,
|
||||||
health: row.health ?? 100,
|
health: row.health ?? 100,
|
||||||
updatedAt: row.updated_at || new Date(),
|
updatedAt: row.updated_at || new Date(),
|
||||||
|
...(row.archived_at ? { archivedAt: row.archived_at } : {}),
|
||||||
mode: row.project_mode || 'open',
|
mode: row.project_mode || 'open',
|
||||||
defaultStickiness: row.default_stickiness || 'default',
|
defaultStickiness: row.default_stickiness || 'default',
|
||||||
featureLimit: row.feature_limit,
|
featureLimit: row.feature_limit,
|
||||||
|
@ -115,6 +115,13 @@ export const projectOverviewSchema = {
|
|||||||
example: '2023-02-10T08:36:35.262Z',
|
example: '2023-02-10T08:36:35.262Z',
|
||||||
description: 'When the project was last updated.',
|
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: {
|
createdAt: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
format: 'date-time',
|
format: 'date-time',
|
||||||
|
@ -305,6 +305,7 @@ export interface IProjectOverview {
|
|||||||
health: number;
|
health: number;
|
||||||
favorite?: boolean;
|
favorite?: boolean;
|
||||||
updatedAt?: Date;
|
updatedAt?: Date;
|
||||||
|
archivedAt?: Date;
|
||||||
createdAt: Date | undefined;
|
createdAt: Date | undefined;
|
||||||
stats?: IProjectStats;
|
stats?: IProjectStats;
|
||||||
mode: ProjectMode;
|
mode: ProjectMode;
|
||||||
@ -525,6 +526,7 @@ export interface IProject {
|
|||||||
health?: number;
|
health?: number;
|
||||||
createdAt?: Date;
|
createdAt?: Date;
|
||||||
updatedAt?: Date;
|
updatedAt?: Date;
|
||||||
|
archivedAt?: Date;
|
||||||
changeRequestsEnabled?: boolean;
|
changeRequestsEnabled?: boolean;
|
||||||
mode: ProjectMode;
|
mode: ProjectMode;
|
||||||
defaultStickiness: string;
|
defaultStickiness: string;
|
||||||
|
Loading…
Reference in New Issue
Block a user