Skip to content

Commit

Permalink
feat: search endpoint should return archived at date (#8592)
Browse files Browse the repository at this point in the history
Include archived at to search response payload.
  • Loading branch information
sjaanus authored Oct 30, 2024
1 parent 728df68 commit 095a825
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/lib/features/feature-search/feature-search-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ class FeatureSearchStore implements IFeatureSearchStore {
'features.name as feature_name',
'features.description as description',
'features.type as type',
'features.archived_at as archived_at',
'features.project as project',
'features.created_at as created_at',
'features.stale as stale',
Expand Down Expand Up @@ -475,6 +476,7 @@ class FeatureSearchStore implements IFeatureSearchStore {
name: row.feature_name,
createdAt: row.created_at,
stale: row.stale,
archivedAt: row.archived_at,
impressionData: row.impression_data,
lastSeenAt: row.last_seen_at,
dependencyType: row.dependency,
Expand Down
10 changes: 10 additions & 0 deletions src/lib/features/feature-search/feature.search.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ const filterFeaturesByEnvironmentStatus = async (
const searchFeaturesWithoutQueryParams = async (expectedCode = 200) => {
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 () => {
await app.createFeature('my_feature_a');
Expand Down Expand Up @@ -1154,6 +1159,7 @@ test('should return archived when query param set', async () => {
features: [
{
name: 'my_feature_a',
archivedAt: null,
},
],
});
Expand All @@ -1162,10 +1168,14 @@ test('should return archived when query param set', async () => {
query: 'my_feature',
archived: 'IS:true',
});

const { body: archive } = await getProjectArchive();

expect(archivedFeatures).toMatchObject({
features: [
{
name: 'my_feature_b',
archivedAt: archive.features[0].archivedAt,
},
],
});
Expand Down
5 changes: 0 additions & 5 deletions src/lib/openapi/spec/feature-search-response-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ export const featureSearchResponseSchema = {
description:
"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: {
type: 'string',
example: 'dx-squad',
Expand Down
1 change: 1 addition & 0 deletions src/lib/types/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ export type IFeatureSearchOverview = Exclude<
> & {
dependencyType: 'parent' | 'child' | null;
environments: FeatureSearchEnvironmentSchema[];
archivedAt: string;
createdBy: {
id: number;
name: string;
Expand Down

0 comments on commit 095a825

Please sign in to comment.