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([
|
||||
{ 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 () => {
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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',
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user