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
9 changes: 5 additions & 4 deletions src/app/core/services/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,31 @@ import { JsonApiResponse, User, UserGetResponse, UserMapper, UserSettings, UserS

import { JsonApiService } from './json-api.service';

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

@Injectable({
providedIn: 'root',
})
export class UserService {
baseUrl = 'https://api.staging4.osf.io/v2/';
jsonApiService = inject(JsonApiService);

getCurrentUser(): Observable<User> {
return this.jsonApiService
.get<JsonApiResponse<UserGetResponse, null>>(this.baseUrl + 'users/me/')
.get<JsonApiResponse<UserGetResponse, null>>(`${environment.apiUrl}/users/me/`)
.pipe(map((user) => UserMapper.fromUserGetResponse(user.data)));
}

getCurrentUserSettings(): Observable<UserSettings> {
return this.jsonApiService
.get<JsonApiResponse<UserSettingsGetResponse, null>>(this.baseUrl + 'users/me/settings/')
.get<JsonApiResponse<UserSettingsGetResponse, null>>(`${environment.apiUrl}/users/me/settings/`)
.pipe(map((response) => UserMapper.fromUserSettingsGetResponse(response.data)));
}

updateUserSettings(userId: string, userSettings: UserSettings): Observable<UserSettings> {
const request = UserMapper.toUpdateUserSettingsRequest(userId, userSettings);

return this.jsonApiService
.patch<UserSettingsGetResponse>(this.baseUrl + `users/${userId}/settings/`, request)
.patch<UserSettingsGetResponse>(`${environment.apiUrl}/users/${userId}/settings/`, request)
.pipe(map((response) => UserMapper.fromUserSettingsGetResponse(response)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@ import { environment } from 'src/environments/environment';
providedIn: 'root',
})
export class InstitutionsService {
#baseUrl = 'https://api.staging4.osf.io/v2/';
#jsonApiService = inject(JsonApiService);

getUserInstitutions(): Observable<Institution[]> {
const url = this.#baseUrl + 'users/me/institutions/';
// const url = this.#baseUrl + 'users/26c59/institutions/';
const url = `${environment.apiUrl}/users/me/institutions/`;

return this.#jsonApiService
.get<JsonApiResponse<UserInstitutionGetResponse[], null>>(url)
.pipe(map((response) => response.data.map((item) => InstitutionsMapper.fromResponse(item))));
Expand Down
2 changes: 1 addition & 1 deletion src/app/features/meetings/models/meetings.models.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// domain models
import { NumberOrNull, StringOrNull } from '@core/helpers/types.helper';
import { NumberOrNull, StringOrNull } from '@core/helpers';

export interface Meeting {
id: string;
Expand Down
4 changes: 2 additions & 2 deletions src/app/features/meetings/pages/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './meetings-details';
export * from './meetings-landing';
export { MeetingDetailsComponent } from './meeting-details/meeting-details.component';
export { MeetingsLandingComponent } from './meetings-landing/meetings-landing.component';
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
</tr>
</ng-template>
<ng-template #body let-item>
@if (item !== 1) {
@if (item?.id) {
<tr class="cursor-pointer" [routerLink]="['/my-projects', item.id, 'overview']">
<td>{{ item.title }}</td>
<td>{{ item.authorName }}</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class MeetingDetailsComponent {
meetingSubmissions = select(MeetingsSelectors.getAllMeetingSubmissions);
totalMeetingSubmissionsCount = select(MeetingsSelectors.getMeetingSubmissionsTotalCount);
isMeetingSubmissionsLoading = select(MeetingsSelectors.isMeetingSubmissionsLoading);
skeletonData: number[] = Array.from({ length: 10 }, () => 1);
skeletonData: MeetingSubmission[] = Array.from({ length: 10 }, () => ({}) as MeetingSubmission);

pageDescription = computed(() => {
const meeting = this.meeting();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
</tr>
</ng-template>
<ng-template #body let-item>
@if (item !== 1) {
@if (item?.id) {
<tr class="cursor-pointer" (click)="navigateToMeeting(item)">
<td>{{ item.name }}</td>
<td>{{ item.submissionsCount }}</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class MeetingsLandingComponent {
meetings = select(MeetingsSelectors.getAllMeetings);
totalMeetingsCount = select(MeetingsSelectors.getMeetingsTotalCount);
isMeetingsLoading = select(MeetingsSelectors.isMeetingsLoading);
skeletonData: number[] = Array.from({ length: 10 }, () => 1);
skeletonData: Meeting[] = Array.from({ length: 10 }, () => ({}) as Meeting);

constructor() {
this.setupTotalRecordsEffect();
Expand Down
9 changes: 6 additions & 3 deletions src/app/features/meetings/services/meetings.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,18 @@ import {
MeetingSubmissionsWithPaging,
MeetingsWithPaging,
} from '@osf/features/meetings/models';
import { searchPreferencesToJsonApiQueryParams } from '@shared/helpers/search-pref-to-json-api-query-params.helper';
import { SearchFilters } from '@shared/models/filters/search-filters.model';
import { searchPreferencesToJsonApiQueryParams } from '@osf/shared/utils';
import { SearchFilters } from '@shared/models/filters';

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

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

#meetingSubmissionSortFieldMap: Record<string, string> = {
title: 'title',
authorName: 'author_name',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ import { environment } from 'src/environments/environment';
providedIn: 'root',
})
export class AnalyticsService {
#baseUrl = 'https://api.staging4.osf.io/_/metrics/query/node_analytics';

#jsonApiService = inject(JsonApiService);

getMetrics(projectId: string, dateRange: string): Observable<AnalyticsMetricsModel> {
const baseUrl = `${environment.apiDomainUrl}/_/metrics/query/node_analytics`;

return this.#jsonApiService
.get<JsonApiResponse<AnalyticsMetricsGetResponse, null>>(`${this.#baseUrl}/${projectId}/${dateRange}`)
.get<JsonApiResponse<AnalyticsMetricsGetResponse, null>>(`${baseUrl}/${projectId}/${dateRange}`)
.pipe(map((response) => AnalyticsMetricsMapper.fromResponse(response.data)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ import { JsonApiService } from '@osf/core/services';
import { DeveloperAppMapper } from '../mappers';
import { DeveloperApp, DeveloperAppCreateUpdate, DeveloperAppGetResponse } from '../models';

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

@Injectable({
providedIn: 'root',
})
export class DeveloperApplicationsService {
jsonApiService = inject(JsonApiService);
baseUrl = 'https://api.staging4.osf.io/v2/applications/';
baseUrl = `${environment.apiUrl}/applications/`;

getApplications(): Observable<DeveloperApp[]> {
return this.jsonApiService.get<JsonApiResponse<DeveloperAppGetResponse[], null>>(this.baseUrl).pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ import { SubscriptionFrequency } from '../enums';
import { NotificationSubscriptionMapper } from '../mappers';
import { NotificationSubscription, NotificationSubscriptionGetResponse } from '../models';

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

@Injectable({
providedIn: 'root',
})
export class NotificationSubscriptionService {
jsonApiService = inject(JsonApiService);
baseUrl = 'https://api.staging4.osf.io/v2/subscriptions/';
baseUrl = `${environment.apiUrl}/subscriptions/`;

getAllGlobalNotificationSubscriptions(): Observable<NotificationSubscription[]> {
const params: Record<string, string> = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ import { JsonApiService } from '@osf/core/services';

import { ProfileSettingsStateModel, ProfileSettingsUpdate } from '../store';

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

@Injectable({
providedIn: 'root',
})
export class ProfileSettingsApiService {
readonly #baseUrl = 'https://api.staging4.osf.io/v2/';
readonly #jsonApiService = inject(JsonApiService);

patchUserSettings(userId: string, key: keyof ProfileSettingsStateModel, data: ProfileSettingsUpdate) {
const patchedData = { [key]: data };
return this.#jsonApiService.patch<JsonApiResponse<UserGetResponse, null>>(`${this.#baseUrl}users/${userId}/`, {
return this.#jsonApiService.patch<JsonApiResponse<UserGetResponse, null>>(`${environment.apiUrl}users/${userId}/`, {
data: { type: 'users', id: userId, attributes: patchedData },
});
}
Expand Down
1 change: 1 addition & 0 deletions src/app/shared/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export * from './add-filters-params.helper';
export * from './breakpoints.tokens';
export * from './custom-form-validators.helper';
export * from './get-resource-types.helper';
export * from './search-pref-to-json-api-query-params.helper';
1 change: 1 addition & 0 deletions src/environments/environment.development.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export const environment = {
production: false,
apiUrl: 'https://api.staging4.osf.io/v2',
apiDomainUrl: 'https://api.staging4.osf.io',
shareDomainUrl: 'https://staging-share.osf.io/trove',
addonsApiUrl: 'https://addons.staging4.osf.io/v1',
};
1 change: 1 addition & 0 deletions src/environments/environment.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export const environment = {
production: false,
apiUrl: 'https://api.staging4.osf.io/v2',
apiDomainUrl: 'https://api.staging4.osf.io',
shareDomainUrl: 'https://staging-share.osf.io/trove',
addonsApiUrl: 'https://addons.staging4.osf.io/v1',
};