Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions apps/events-helsinki/config/vitest/mocks/eventListMocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
EventTypeId,
DEFAULT_EVENT_SORT_OPTION,
EVENT_SEARCH_FILTERS,
HELSINKI_OCD_DIVISION_ID,
} from '@events-helsinki/components';
import AppConfig from '../../../src/domain/app/AppConfig';

Expand All @@ -27,6 +28,8 @@ export const baseVariables = {
sort: DEFAULT_EVENT_SORT_OPTION,
start: 'now',
startsAfter: undefined,
// Always filter with HELSINKI_OCD_DIVISION_ID to limit the results to city of Helsinki events.
[EVENT_SEARCH_FILTERS.DIVISIONS]: [HELSINKI_OCD_DIVISION_ID],
// Removed to experiment LIIKUNTA-512 (https://helsinkisolutionoffice.atlassian.net/browse/LIIKUNTA-512).
// superEventType: ['umbrella', 'none'],
[EVENT_SEARCH_FILTERS.ONGOING]: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import {
EVENT_SEARCH_FILTERS,
EVENT_SORT_OPTIONS,
} from '@events-helsinki/components/constants/event-constants';
HELSINKI_OCD_DIVISION_ID,
} from '@events-helsinki/components';
import type { EventFields } from '@events-helsinki/components/types/event-types';
import React from 'react';

Expand Down Expand Up @@ -32,6 +33,10 @@ const useSimilarEventsQueryVariables = (event: EventFields) => {
pageSize: 100,
params: new URLSearchParams(searchParams),
sortOrder: EVENT_SORT_OPTIONS.END_TIME,
// Always filter with HELSINKI_OCD_DIVISION_ID to limit the results to city of Helsinki events.
// NOTE: This is not needed if using any `*Ongoing` -filter as
// they automatically limit the results to city of Helsinki events.
[EVENT_SEARCH_FILTERS.DIVISIONS]: [HELSINKI_OCD_DIVISION_ID],
// Don't use superEventType when experimenting:
// LIIKUNTA-512 (https://helsinkisolutionoffice.atlassian.net/browse/LIIKUNTA-512)
// superEventType: ['umbrella', 'none']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import {
isEventSortOption,
EventList,
useClearClosedEventsFromApolloCache,
HELSINKI_OCD_DIVISION_ID,
EVENT_SEARCH_FILTERS,
} from '@events-helsinki/components';
import { useRouter } from 'next/router';
import queryString from 'query-string';
Expand Down Expand Up @@ -45,6 +47,10 @@ const useSearchQuery = () => {
sortOrder: isEventSortOption(sortParam)
? sortParam
: DEFAULT_EVENT_SORT_OPTION,
// Always filter with HELSINKI_OCD_DIVISION_ID to limit the results to city of Helsinki events.
// NOTE: This is not needed if using any `*Ongoing` -filter as
// they automatically limit the results to city of Helsinki events.
[EVENT_SEARCH_FILTERS.DIVISIONS]: [HELSINKI_OCD_DIVISION_ID],
// Don't use superEventType when experimenting
// LIIKUNTA-512 (https://helsinkisolutionoffice.atlassian.net/browse/LIIKUNTA-512)
// superEventType: ['umbrella', 'none']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ export const getEventSearchVariables = ({
superEventType,
superEvent,
place,
division,
}: {
include: string[];
language?: AppLanguage;
Expand All @@ -150,6 +151,7 @@ export const getEventSearchVariables = ({
superEventType?: string[];
superEvent?: string;
place?: string;
division?: string[];
}): QueryEventListArgs => {
const {
categories,
Expand Down Expand Up @@ -212,6 +214,7 @@ export const getEventSearchVariables = ({
return {
[EVENT_SEARCH_FILTERS.TEXT]: !isEmpty(text) ? text?.join(',') : undefined, // NOTE: only *OngoingAnd supports Array.
[EVENT_SEARCH_FILTERS.ONGOING]: true,
[EVENT_SEARCH_FILTERS.DIVISIONS]: division,
end,
include,
publisherAncestor,
Expand Down
3 changes: 3 additions & 0 deletions apps/hobbies-helsinki/config/vitest/mocks/eventListMocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
EVENT_SEARCH_FILTERS,
EventListDocument,
EventTypeId,
HELSINKI_OCD_DIVISION_ID,
} from '@events-helsinki/components';
import AppConfig from '../../../src/domain/app/AppConfig';

Expand All @@ -29,6 +30,8 @@ export const baseVariables = {
sort: 'end_time',
start: 'now',
startsAfter: undefined,
// Always filter with HELSINKI_OCD_DIVISION_ID to limit the results to city of Helsinki events.
[EVENT_SEARCH_FILTERS.DIVISIONS]: [HELSINKI_OCD_DIVISION_ID],
// Removed to experiment:
// LIIKUNTA-512 (https://helsinkisolutionoffice.atlassian.net/browse/LIIKUNTA-512).
// superEventType: ['umbrella', 'none'],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {
EVENT_SEARCH_FILTERS,
EVENT_SORT_OPTIONS,
} from '@events-helsinki/components/constants/event-constants';
import type { EventFields } from '@events-helsinki/components/types/event-types';
HELSINKI_OCD_DIVISION_ID,
} from '@events-helsinki/components';
import type { EventFields } from '@events-helsinki/components';
import React from 'react';
import {
getEventCategories,
Expand Down Expand Up @@ -34,6 +35,8 @@ const useSimilarEventsQueryVariables = (event: EventFields) => {
pageSize: 100,
params: new URLSearchParams(searchParams),
sortOrder: EVENT_SORT_OPTIONS.END_TIME,
// Always filter with HELSINKI_OCD_DIVISION_ID to limit the results to city of Helsinki events.
[EVENT_SEARCH_FILTERS.DIVISIONS]: [HELSINKI_OCD_DIVISION_ID],
// Don't use superEventType when experimenting:
// LIIKUNTA-512 (https://helsinkisolutionoffice.atlassian.net/browse/LIIKUNTA-512)
// superEventType: ['umbrella', 'none']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {
EVENT_SORT_OPTIONS,
EventList,
useClearClosedEventsFromApolloCache,
HELSINKI_OCD_DIVISION_ID,
EVENT_SEARCH_FILTERS,
} from '@events-helsinki/components';
import { useRouter } from 'next/router';
import queryString from 'query-string';
Expand Down Expand Up @@ -41,6 +43,10 @@ const useSearchQuery = () => {
params: searchParams,
place: params.place,
sortOrder: EVENT_SORT_OPTIONS.END_TIME,
// Always filter with HELSINKI_OCD_DIVISION_ID to limit the results to city of Helsinki events.
// NOTE: This is not needed if using any `*Ongoing` -filter as
// they automatically limit the results to city of Helsinki events.
[EVENT_SEARCH_FILTERS.DIVISIONS]: [HELSINKI_OCD_DIVISION_ID],
// Don't use superEventType when experimenting:
// LIIKUNTA-512 (https://helsinkisolutionoffice.atlassian.net/browse/LIIKUNTA-512)
// superEventType: ['umbrella', 'none']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ export const getEventSearchVariables = ({
superEventType,
superEvent,
place,
division,
}: {
include: string[];
language?: AppLanguage;
Expand All @@ -190,6 +191,7 @@ export const getEventSearchVariables = ({
superEventType?: string[];
superEvent?: string;
place?: string;
division?: string[];
}): QueryEventListArgs => {
const {
categories,
Expand Down Expand Up @@ -259,6 +261,7 @@ export const getEventSearchVariables = ({
return {
[EVENT_SEARCH_FILTERS.TEXT]: !isEmpty(text) ? text?.join(',') : undefined, // NOTE: only *OngoingAnd supports Array.
[EVENT_SEARCH_FILTERS.ONGOING]: true,
[EVENT_SEARCH_FILTERS.DIVISIONS]: division,
end,
include,
publisherAncestor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ import type {
EventType,
QueryEventListArgs,
} from '@events-helsinki/components';
import { EventListDocument, EventTypeId } from '@events-helsinki/components';
import {
EVENT_SEARCH_FILTERS,
EventListDocument,
EventTypeId,
HELSINKI_OCD_DIVISION_ID,
} from '@events-helsinki/components';

export const baseVariables = {
end: '',
Expand All @@ -21,6 +26,8 @@ export const baseVariables = {
publisherAncestor: null,
sort: 'end_time',
start: 'now',
// Always filter with HELSINKI_OCD_DIVISION_ID to limit the results to city of Helsinki events.
[EVENT_SEARCH_FILTERS.DIVISIONS]: [HELSINKI_OCD_DIVISION_ID],
// Removed to experiment LIIKUNTA-512 (https://helsinkisolutionoffice.atlassian.net/browse/LIIKUNTA-512).
// superEventType: ['umbrella', 'none'],
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { EVENT_SORT_OPTIONS } from '@events-helsinki/components/constants/event-constants';
import { EventTypeId } from '@events-helsinki/components/types';
import {
EVENT_SORT_OPTIONS,
EventTypeId,
HELSINKI_OCD_DIVISION_ID,
} from '@events-helsinki/components';
import type { EventFields } from '@events-helsinki/components/types/event-types';
import React from 'react';
import { EVENT_SEARCH_FILTERS } from '../search/eventSearch/constants';
Expand Down Expand Up @@ -31,6 +34,8 @@ const useSimilarEventsQueryVariables = (event: EventFields) => {
pageSize: 100,
params: new URLSearchParams(searchParams),
sortOrder: EVENT_SORT_OPTIONS.END_TIME,
// Always filter with HELSINKI_OCD_DIVISION_ID to limit the results to city of Helsinki events.
[EVENT_SEARCH_FILTERS.DIVISIONS]: [HELSINKI_OCD_DIVISION_ID],
// Don't use superEventType when experimenting:
// LIIKUNTA-512 (https://helsinkisolutionoffice.atlassian.net/browse/LIIKUNTA-512)
// superEventType: ['umbrella', 'none']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class EventSearchAdapter implements CombinedSearchAdapter<EventSearchParams> {
publisherAncestor: EventSearchParams['publisherAncestor'];
page: EventSearchParams['page'];
pageSize: EventSearchParams['pageSize'];
division: EventSearchParams['division'];

/**
* Map the combined search form fields to the event search query variables.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import {
EventTypeId,
UnifiedSearchLanguage,
} from '@events-helsinki/components/types';
EVENT_SEARCH_FILTERS,
HELSINKI_OCD_DIVISION_ID,
} from '@events-helsinki/components';
import mockRouter from 'next-router-mock';
import qs from 'query-string';
import type {
Expand Down Expand Up @@ -161,6 +163,10 @@ describe('CombinedSearchFormAdapter', () => {
publisher: null,
publisherAncestor: null,
include: ['keywords', 'location'],
// Always filter with HELSINKI_OCD_DIVISION_ID to limit the results to city of Helsinki events.
// NOTE: This is not needed if using any `*Ongoing` -filter as
// they automatically limit the results to city of Helsinki events.
[EVENT_SEARCH_FILTERS.DIVISIONS]: [HELSINKI_OCD_DIVISION_ID],
// Removed to experiment:
// LIIKUNTA-512 (https://helsinkisolutionoffice.atlassian.net/browse/LIIKUNTA-512).
// superEventType: ['umbrella', 'none'],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { EventTypeId, TARGET_GROUPS } from '@events-helsinki/components';
import {
EVENT_SEARCH_FILTERS,
EventTypeId,
HELSINKI_OCD_DIVISION_ID,
TARGET_GROUPS,
} from '@events-helsinki/components';
import type { CombinedSearchAdapterInput } from '../../types';
import EventSearchAdapter from '../EventSearchAdapter';

Expand Down Expand Up @@ -69,6 +74,10 @@ describe('EventSearchAdapter', () => {
publisher: null,
publisherAncestor: 'ahjo:00001',
include: ['keywords', 'location'],
// Always filter with HELSINKI_OCD_DIVISION_ID to limit the results to city of Helsinki events.
// NOTE: This is not needed if using any `*Ongoing` -filter as
// they automatically limit the results to city of Helsinki events.
[EVENT_SEARCH_FILTERS.DIVISIONS]: [HELSINKI_OCD_DIVISION_ID],
// Removed to experiment LIIKUNTA-512 (https://helsinkisolutionoffice.atlassian.net/browse/LIIKUNTA-512).
// superEventType: ['umbrella', 'none'],
// Added for courses in LIIKUNTA-512 (https://helsinkisolutionoffice.atlassian.net/browse/LIIKUNTA-512).
Expand Down
Loading
Loading