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
1 change: 1 addition & 0 deletions src/app/features/meetings/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './meeting-submissions-table.constants';
export * from './meetings-fields.constants';
export * from './meetings-table.constants';
14 changes: 14 additions & 0 deletions src/app/features/meetings/constants/meetings-fields.constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export const meetingSubmissionSortFieldMap: Record<string, string> = {
title: 'title',
authorName: 'author_name',
meetingCategory: 'meeting_category',
dateCreated: 'date_created',
downloadCount: 'download_count',
};

export const meetingSortFieldMap: Record<string, string> = {
name: 'name',
submissionsCount: 'submissions_count',
location: 'location',
startDate: 'start_date',
};
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ import { parseQueryFilterParams } from '@core/helpers/http.helper';
import { MEETING_SUBMISSIONS_TABLE_PARAMS } from '@osf/features/meetings/constants';
import { MeetingSubmission } from '@osf/features/meetings/models';
import { GetMeetingById, GetMeetingSubmissions, MeetingsSelectors } from '@osf/features/meetings/store';
import { SearchInputComponent } from '@shared/components/search-input/search-input.component';
import { SubHeaderComponent } from '@shared/components/sub-header/sub-header.component';
import { SearchInputComponent, SubHeaderComponent } from '@shared/components';
import { SortOrder } from '@shared/enums';
import { QueryParams, TableParameters } from '@shared/models';
import { SearchFilters } from '@shared/models/filters';
Expand All @@ -54,6 +53,7 @@ import { SearchFilters } from '@shared/models/filters';
})
export class MeetingDetailsComponent {
@HostBinding('class') classes = 'flex-1 flex flex-column w-full h-full';

private readonly datePipe = inject(DatePipe);
private readonly store = inject(Store);
private readonly route = inject(ActivatedRoute);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ import { MEETINGS_TABLE_PARAMS } from '@osf/features/meetings/constants';
import { Meeting } from '@osf/features/meetings/models';
import { GetAllMeetings, MeetingsSelectors } from '@osf/features/meetings/store';
import { IS_XSMALL } from '@osf/shared/utils';
import { SearchInputComponent } from '@shared/components/search-input/search-input.component';
import { SubHeaderComponent } from '@shared/components/sub-header/sub-header.component';
import { SearchInputComponent, SubHeaderComponent } from '@shared/components';
import { SortOrder } from '@shared/enums';
import { QueryParams, TableParameters } from '@shared/models';
import { SearchFilters } from '@shared/models/filters';
Expand Down
60 changes: 25 additions & 35 deletions src/app/features/meetings/services/meetings.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,29 @@ import {
import { searchPreferencesToJsonApiQueryParams } from '@osf/shared/utils';
import { SearchFilters } from '@shared/models/filters';

import { meetingSortFieldMap, meetingSubmissionSortFieldMap } from '../constants';

import { environment } from 'src/environments/environment';

@Injectable({
providedIn: 'root',
})
export class MeetingsService {
jsonApiService = inject(JsonApiService);
baseUrl = `${environment.apiDomainUrl}/_/meetings/`;

#meetingSubmissionSortFieldMap: Record<string, string> = {
title: 'title',
authorName: 'author_name',
meetingCategory: 'meeting_category',
dateCreated: 'date_created',
downloadCount: 'download_count',
};
#meetingSortFieldMap: Record<string, string> = {
name: 'name',
submissionsCount: 'submissions_count',
location: 'location',
startDate: 'start_date',
};
private readonly jsonApiService = inject(JsonApiService);
private readonly baseUrl = `${environment.apiDomainUrl}/_/meetings/`;

getAllMeetings(pageNumber: number, pageSize: number, filters: SearchFilters): Observable<MeetingsWithPaging> {
const params: Record<string, unknown> = {};
searchPreferencesToJsonApiQueryParams(params, pageNumber, pageSize, filters, this.#meetingSortFieldMap);

return this.jsonApiService.get<JsonApiResponseWithPaging<MeetingGetResponse[], null>>(this.baseUrl, params).pipe(
map((response) => {
return MeetingsMapper.fromMeetingsGetResponse(response);
})
const params: Record<string, unknown> = searchPreferencesToJsonApiQueryParams(
{},
pageNumber,
pageSize,
filters,
meetingSortFieldMap
);

return this.jsonApiService
.get<JsonApiResponseWithPaging<MeetingGetResponse[], null>>(this.baseUrl, params)
.pipe(map((response) => MeetingsMapper.fromMeetingsGetResponse(response)));
}

getMeetingSubmissions(
Expand All @@ -54,25 +45,24 @@ export class MeetingsService {
pageSize: number,
filters: SearchFilters
): Observable<MeetingSubmissionsWithPaging> {
const params: Record<string, unknown> = {};
searchPreferencesToJsonApiQueryParams(params, pageNumber, pageSize, filters, this.#meetingSubmissionSortFieldMap);
const params: Record<string, unknown> = searchPreferencesToJsonApiQueryParams(
{},
pageNumber,
pageSize,
filters,
meetingSubmissionSortFieldMap
);

return this.jsonApiService
.get<
JsonApiResponseWithPaging<MeetingSubmissionGetResponse[], null>
>(`${this.baseUrl}${meetingId}/submissions/`, params)
.pipe(
map((response) => {
return MeetingsMapper.fromMeetingSubmissionGetResponse(response);
})
);
.pipe(map((response) => MeetingsMapper.fromMeetingSubmissionGetResponse(response)));
}

getMeetingById(meetingId: string) {
return this.jsonApiService.get<JsonApiResponse<MeetingGetResponse, null>>(this.baseUrl + meetingId).pipe(
map((response) => {
return MeetingsMapper.fromMeetingGetResponse(response.data);
})
);
return this.jsonApiService
.get<JsonApiResponse<MeetingGetResponse, null>>(this.baseUrl + meetingId)
.pipe(map((response) => MeetingsMapper.fromMeetingGetResponse(response.data)));
}
}
2 changes: 1 addition & 1 deletion src/app/features/meetings/store/meetings.model.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Meeting, MeetingSubmission } from '@osf/features/meetings/models';
import { AsyncStateWithTotalCount } from '@shared/models/store/async-state-with-total-count.model';
import { AsyncStateWithTotalCount } from '@shared/models/store';

export interface MeetingsStateModel {
meetings: AsyncStateWithTotalCount<Meeting[]>;
Expand Down
1 change: 1 addition & 0 deletions src/app/shared/models/store/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export type { AsyncStateModel } from './async-state.model';
export type { AsyncStateWithTotalCount } from './async-state-with-total-count.model';
1 change: 0 additions & 1 deletion src/assets/styles/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,3 @@
@use "./overrides/breadcrumbs";
@use "./components/md-editor";
@use "./components/preprints";
@use "./components/preprints";