mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +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(); | ||||
|     expect(projects.find((p) => p.id === project.id)).toBeUndefined(); | ||||
|     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 () => { | ||||
|  | ||||
| @ -140,8 +140,8 @@ class ProjectStore implements IProjectStore { | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         if (query) { | ||||
|             projects = projects.where(query); | ||||
|         if (query?.id) { | ||||
|             projects = projects.where(`${TABLE}.id`, query.id); | ||||
|         } | ||||
| 
 | ||||
|         let selectColumns = [ | ||||
| @ -156,6 +156,10 @@ class ProjectStore implements IProjectStore { | ||||
|             'project_stats.avg_time_to_prod_current_window', | ||||
|         ] as (string | Raw<any>)[]; | ||||
| 
 | ||||
|         if (this.flagResolver.isEnabled('archiveProjects')) { | ||||
|             selectColumns.push(`${TABLE}.archived_at`); | ||||
|         } | ||||
| 
 | ||||
|         let groupByColumns = [ | ||||
|             'projects.id', | ||||
|             'project_settings.default_stickiness', | ||||
| @ -219,6 +223,7 @@ class ProjectStore implements IProjectStore { | ||||
|             memberCount: Number(row.number_of_users) || 0, | ||||
|             updatedAt: row.updated_at, | ||||
|             createdAt: row.created_at, | ||||
|             archivedAt: row.archived_at, | ||||
|             mode: row.project_mode || 'open', | ||||
|             defaultStickiness: row.default_stickiness || 'default', | ||||
|             avgTimeToProduction: row.avg_time_to_prod_current_window || 0, | ||||
|  | ||||
| @ -64,6 +64,12 @@ export const projectSchema = { | ||||
|             description: 'When this project was last updated.', | ||||
|             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: { | ||||
|             type: 'boolean', | ||||
|             example: true, | ||||
|  | ||||
| @ -573,6 +573,7 @@ export interface IProjectWithCount extends IProject { | ||||
|     memberCount: number; | ||||
|     favorite?: boolean; | ||||
|     avgTimeToProduction: number; | ||||
|     archivedAt?: Date; | ||||
| } | ||||
| 
 | ||||
| export interface IClientSegment { | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user