mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-19 00:15:43 +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
|
* 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
|
* 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.
|
* 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[] => {
|
convertToDbParams = (params: IEventSearchParams): IQueryParam[] => {
|
||||||
const queryParams: IQueryParam[] = [];
|
const queryParams: IQueryParam[] = [];
|
||||||
|
|
||||||
if (params.createdAtFrom) {
|
if (params.from) {
|
||||||
const parsed = parseSearchOperatorValue(
|
const parsed = parseSearchOperatorValue('created_at', params.from);
|
||||||
'created_at',
|
|
||||||
params.createdAtFrom,
|
|
||||||
);
|
|
||||||
if (parsed) {
|
if (parsed) {
|
||||||
queryParams.push({
|
queryParams.push({
|
||||||
field: parsed.field,
|
field: parsed.field,
|
||||||
@ -160,11 +157,8 @@ export default class EventService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params.createdAtTo) {
|
if (params.to) {
|
||||||
const parsed = parseSearchOperatorValue(
|
const parsed = parseSearchOperatorValue('created_at', params.to);
|
||||||
'created_at',
|
|
||||||
params.createdAtTo,
|
|
||||||
);
|
|
||||||
if (parsed) {
|
if (parsed) {
|
||||||
queryParams.push({
|
queryParams.push({
|
||||||
field: parsed.field,
|
field: parsed.field,
|
||||||
|
@ -57,7 +57,7 @@ export const eventSearchQueryParameters = [
|
|||||||
in: 'query',
|
in: 'query',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'createdAtFrom',
|
name: 'from',
|
||||||
schema: {
|
schema: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
example: 'IS:2024-01-01',
|
example: 'IS:2024-01-01',
|
||||||
@ -68,7 +68,7 @@ export const eventSearchQueryParameters = [
|
|||||||
in: 'query',
|
in: 'query',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'createdAtTo',
|
name: 'to',
|
||||||
schema: {
|
schema: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
example: 'IS:2024-01-31',
|
example: 'IS:2024-01-31',
|
||||||
|
@ -9,8 +9,8 @@ export interface IEventSearchParams {
|
|||||||
project?: string;
|
project?: string;
|
||||||
query?: string;
|
query?: string;
|
||||||
feature?: string;
|
feature?: string;
|
||||||
createdAtFrom?: string;
|
from?: string;
|
||||||
createdAtTo?: string;
|
to?: string;
|
||||||
createdBy?: string;
|
createdBy?: string;
|
||||||
type?: string;
|
type?: string;
|
||||||
offset: number;
|
offset: number;
|
||||||
|
@ -228,7 +228,7 @@ test('should filter events by created date range', async () => {
|
|||||||
const today = new Date();
|
const today = new Date();
|
||||||
|
|
||||||
const { body } = await searchEvents({
|
const { body } = await searchEvents({
|
||||||
createdAtFrom: `IS:${today.toISOString().split('T')[0]}`,
|
from: `IS:${today.toISOString().split('T')[0]}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(body).toMatchObject({
|
expect(body).toMatchObject({
|
||||||
|
Loading…
Reference in New Issue
Block a user