mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-14 00:19:16 +01:00
refactor: rename createdAtFrom/To to from/to (#7773)
Update the query parameter of the new event search API to match the query parameters of the insights API
This commit is contained in:
parent
f9665233cc
commit
76bc7bf250
@ -28,11 +28,11 @@ export type SearchEventsParams = {
|
||||
/**
|
||||
* The starting date of the creation date range in IS:yyyy-MM-dd format
|
||||
*/
|
||||
createdAtFrom?: string;
|
||||
from?: string;
|
||||
/**
|
||||
* The ending date of the creation date range in IS:yyyy-MM-dd format
|
||||
*/
|
||||
createdAtTo?: string;
|
||||
to?: string;
|
||||
/**
|
||||
* The number of features to skip when returning a page. By default it is set to 0.
|
||||
*/
|
||||
|
@ -146,11 +146,8 @@ export default class EventService {
|
||||
convertToDbParams = (params: IEventSearchParams): IQueryParam[] => {
|
||||
const queryParams: IQueryParam[] = [];
|
||||
|
||||
if (params.createdAtFrom) {
|
||||
const parsed = parseSearchOperatorValue(
|
||||
'created_at',
|
||||
params.createdAtFrom,
|
||||
);
|
||||
if (params.from) {
|
||||
const parsed = parseSearchOperatorValue('created_at', params.from);
|
||||
if (parsed) {
|
||||
queryParams.push({
|
||||
field: parsed.field,
|
||||
@ -160,11 +157,8 @@ export default class EventService {
|
||||
}
|
||||
}
|
||||
|
||||
if (params.createdAtTo) {
|
||||
const parsed = parseSearchOperatorValue(
|
||||
'created_at',
|
||||
params.createdAtTo,
|
||||
);
|
||||
if (params.to) {
|
||||
const parsed = parseSearchOperatorValue('created_at', params.to);
|
||||
if (parsed) {
|
||||
queryParams.push({
|
||||
field: parsed.field,
|
||||
|
@ -57,7 +57,7 @@ export const eventSearchQueryParameters = [
|
||||
in: 'query',
|
||||
},
|
||||
{
|
||||
name: 'createdAtFrom',
|
||||
name: 'from',
|
||||
schema: {
|
||||
type: 'string',
|
||||
example: 'IS:2024-01-01',
|
||||
@ -68,7 +68,7 @@ export const eventSearchQueryParameters = [
|
||||
in: 'query',
|
||||
},
|
||||
{
|
||||
name: 'createdAtTo',
|
||||
name: 'to',
|
||||
schema: {
|
||||
type: 'string',
|
||||
example: 'IS:2024-01-31',
|
||||
|
@ -9,8 +9,8 @@ export interface IEventSearchParams {
|
||||
project?: string;
|
||||
query?: string;
|
||||
feature?: string;
|
||||
createdAtFrom?: string;
|
||||
createdAtTo?: string;
|
||||
from?: string;
|
||||
to?: string;
|
||||
createdBy?: string;
|
||||
type?: string;
|
||||
offset: number;
|
||||
|
@ -228,7 +228,7 @@ test('should filter events by created date range', async () => {
|
||||
const today = new Date();
|
||||
|
||||
const { body } = await searchEvents({
|
||||
createdAtFrom: `IS:${today.toISOString().split('T')[0]}`,
|
||||
from: `IS:${today.toISOString().split('T')[0]}`,
|
||||
});
|
||||
|
||||
expect(body).toMatchObject({
|
||||
|
Loading…
Reference in New Issue
Block a user