mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
feat: archived projects query improved (#7866)
This commit is contained in:
parent
778413d4c0
commit
b042afb7dd
@ -306,6 +306,13 @@ test('should archive project', async () => {
|
|||||||
const projects = await projectService.getProjects();
|
const projects = await projectService.getProjects();
|
||||||
expect(projects.find((p) => p.id === project.id)).toBeUndefined();
|
expect(projects.find((p) => p.id === project.id)).toBeUndefined();
|
||||||
expect(projects.length).not.toBe(0);
|
expect(projects.length).not.toBe(0);
|
||||||
|
|
||||||
|
const archivedProjects = await projectService.getProjects({
|
||||||
|
archived: true,
|
||||||
|
});
|
||||||
|
expect(archivedProjects).toMatchObject([
|
||||||
|
{ id: 'test-archive', archivedAt: expect.any(Date) },
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should revive project', async () => {
|
test('should revive project', async () => {
|
||||||
|
@ -140,8 +140,8 @@ class ProjectStore implements IProjectStore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (query) {
|
if (query?.id) {
|
||||||
projects = projects.where(query);
|
projects = projects.where(`${TABLE}.id`, query.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
let selectColumns = [
|
let selectColumns = [
|
||||||
@ -156,6 +156,10 @@ class ProjectStore implements IProjectStore {
|
|||||||
'project_stats.avg_time_to_prod_current_window',
|
'project_stats.avg_time_to_prod_current_window',
|
||||||
] as (string | Raw<any>)[];
|
] as (string | Raw<any>)[];
|
||||||
|
|
||||||
|
if (this.flagResolver.isEnabled('archiveProjects')) {
|
||||||
|
selectColumns.push(`${TABLE}.archived_at`);
|
||||||
|
}
|
||||||
|
|
||||||
let groupByColumns = [
|
let groupByColumns = [
|
||||||
'projects.id',
|
'projects.id',
|
||||||
'project_settings.default_stickiness',
|
'project_settings.default_stickiness',
|
||||||
@ -219,6 +223,7 @@ class ProjectStore implements IProjectStore {
|
|||||||
memberCount: Number(row.number_of_users) || 0,
|
memberCount: Number(row.number_of_users) || 0,
|
||||||
updatedAt: row.updated_at,
|
updatedAt: row.updated_at,
|
||||||
createdAt: row.created_at,
|
createdAt: row.created_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',
|
||||||
avgTimeToProduction: row.avg_time_to_prod_current_window || 0,
|
avgTimeToProduction: row.avg_time_to_prod_current_window || 0,
|
||||||
|
@ -64,6 +64,12 @@ export const projectSchema = {
|
|||||||
description: 'When this project was last updated.',
|
description: 'When this project was last updated.',
|
||||||
example: '2023-07-28T12:12:28Z',
|
example: '2023-07-28T12:12:28Z',
|
||||||
},
|
},
|
||||||
|
archivedAt: {
|
||||||
|
type: 'string',
|
||||||
|
format: 'date-time',
|
||||||
|
description: 'When this project was archived.',
|
||||||
|
example: '2023-07-28T12:12:28Z',
|
||||||
|
},
|
||||||
favorite: {
|
favorite: {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
example: true,
|
example: true,
|
||||||
|
@ -573,6 +573,7 @@ export interface IProjectWithCount extends IProject {
|
|||||||
memberCount: number;
|
memberCount: number;
|
||||||
favorite?: boolean;
|
favorite?: boolean;
|
||||||
avgTimeToProduction: number;
|
avgTimeToProduction: number;
|
||||||
|
archivedAt?: Date;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IClientSegment {
|
export interface IClientSegment {
|
||||||
|
Loading…
Reference in New Issue
Block a user