1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-09 00:18:00 +01:00

feat: search endpoint should return archived at date (#8592)

Include archived at to search response payload.
This commit is contained in:
Jaanus Sellin 2024-10-30 12:35:47 +02:00 committed by GitHub
parent 728df6825c
commit 095a82569c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 13 additions and 5 deletions

View File

@ -121,6 +121,7 @@ class FeatureSearchStore implements IFeatureSearchStore {
'features.name as feature_name', 'features.name as feature_name',
'features.description as description', 'features.description as description',
'features.type as type', 'features.type as type',
'features.archived_at as archived_at',
'features.project as project', 'features.project as project',
'features.created_at as created_at', 'features.created_at as created_at',
'features.stale as stale', 'features.stale as stale',
@ -475,6 +476,7 @@ class FeatureSearchStore implements IFeatureSearchStore {
name: row.feature_name, name: row.feature_name,
createdAt: row.created_at, createdAt: row.created_at,
stale: row.stale, stale: row.stale,
archivedAt: row.archived_at,
impressionData: row.impression_data, impressionData: row.impression_data,
lastSeenAt: row.last_seen_at, lastSeenAt: row.last_seen_at,
dependencyType: row.dependency, dependencyType: row.dependency,

View File

@ -179,6 +179,11 @@ const filterFeaturesByEnvironmentStatus = async (
const searchFeaturesWithoutQueryParams = async (expectedCode = 200) => { const searchFeaturesWithoutQueryParams = async (expectedCode = 200) => {
return app.request.get(`/api/admin/search/features`).expect(expectedCode); return app.request.get(`/api/admin/search/features`).expect(expectedCode);
}; };
const getProjectArchive = async (projectId = 'default', expectedCode = 200) => {
return app.request
.get(`/api/admin/archive/features/${projectId}`)
.expect(expectedCode);
};
test('should search matching features by name', async () => { test('should search matching features by name', async () => {
await app.createFeature('my_feature_a'); await app.createFeature('my_feature_a');
@ -1154,6 +1159,7 @@ test('should return archived when query param set', async () => {
features: [ features: [
{ {
name: 'my_feature_a', name: 'my_feature_a',
archivedAt: null,
}, },
], ],
}); });
@ -1162,10 +1168,14 @@ test('should return archived when query param set', async () => {
query: 'my_feature', query: 'my_feature',
archived: 'IS:true', archived: 'IS:true',
}); });
const { body: archive } = await getProjectArchive();
expect(archivedFeatures).toMatchObject({ expect(archivedFeatures).toMatchObject({
features: [ features: [
{ {
name: 'my_feature_b', name: 'my_feature_b',
archivedAt: archive.features[0].archivedAt,
}, },
], ],
}); });

View File

@ -54,11 +54,6 @@ export const featureSearchResponseSchema = {
description: description:
"The type of dependency. 'parent' means that the feature is a parent feature, 'child' means that the feature is a child feature.", "The type of dependency. 'parent' means that the feature is a parent feature, 'child' means that the feature is a child feature.",
}, },
archived: {
type: 'boolean',
example: true,
description: '`true` if the feature is archived',
},
project: { project: {
type: 'string', type: 'string',
example: 'dx-squad', example: 'dx-squad',

View File

@ -261,6 +261,7 @@ export type IFeatureSearchOverview = Exclude<
> & { > & {
dependencyType: 'parent' | 'child' | null; dependencyType: 'parent' | 'child' | null;
environments: FeatureSearchEnvironmentSchema[]; environments: FeatureSearchEnvironmentSchema[];
archivedAt: string;
createdBy: { createdBy: {
id: number; id: number;
name: string; name: string;