Rename UserPreference model to IUserPreference

pull/10760/head
Oliver Günther 2 years ago
parent 1bf8cb2e46
commit 99ad19fe62
No known key found for this signature in database
GPG Key ID: A3A8BDAD7C0C552C
  1. 12
      frontend/src/app/core/apiv3/endpoints/users/apiv3-user-preferences-paths.ts
  2. 4
      frontend/src/app/features/user-preferences/reminder-settings/page/reminder-settings-page.component.ts
  3. 2
      frontend/src/app/features/user-preferences/state/user-preferences.model.ts
  4. 4
      frontend/src/app/features/user-preferences/state/user-preferences.query.ts
  5. 4
      frontend/src/app/features/user-preferences/state/user-preferences.service.ts
  6. 6
      frontend/src/app/features/user-preferences/state/user-preferences.store.ts

@ -30,18 +30,18 @@ import { ApiV3ResourcePath } from 'core-app/core/apiv3/paths/apiv3-resource';
import { Observable } from 'rxjs';
import { InjectField } from 'core-app/shared/helpers/angular/inject-field.decorator';
import { HttpClient } from '@angular/common/http';
import { UserPreferencesModel } from 'core-app/features/user-preferences/state/user-preferences.model';
import { IUserPreference } from 'core-app/features/user-preferences/state/user-preferences.model';
export class ApiV3UserPreferencesPaths extends ApiV3ResourcePath<UserPreferencesModel> {
export class ApiV3UserPreferencesPaths extends ApiV3ResourcePath<IUserPreference> {
@InjectField() http:HttpClient;
/**
* Perform a request to the backend to load preferences
*/
public get():Observable<UserPreferencesModel> {
public get():Observable<IUserPreference> {
return this
.http
.get<UserPreferencesModel>(
.get<IUserPreference>(
this.path,
);
}
@ -49,10 +49,10 @@ export class ApiV3UserPreferencesPaths extends ApiV3ResourcePath<UserPreferences
/**
* Perform a request to update preferences
*/
public patch(payload:Partial<UserPreferencesModel>):Observable<UserPreferencesModel> {
public patch(payload:Partial<IUserPreference>):Observable<IUserPreference> {
return this
.http
.patch<UserPreferencesModel>(
.patch<IUserPreference>(
this.path,
payload,
{ withCredentials: true, responseType: 'json' },

@ -18,7 +18,7 @@ import {
DailyRemindersSettings,
ImmediateRemindersSettings,
PauseRemindersSettings,
UserPreferencesModel,
IUserPreference,
} from 'core-app/features/user-preferences/state/user-preferences.model';
import {
emailAlerts,
@ -125,7 +125,7 @@ export class ReminderSettingsPageComponent extends UntilDestroyedMixin implement
});
}
private buildForm(settings:UserPreferencesModel, globalSetting:INotificationSetting) {
private buildForm(settings:IUserPreference, globalSetting:INotificationSetting) {
this.form.get('immediateReminders.mentioned')?.setValue(settings.immediateReminders.mentioned);
this.form.get('dailyReminders.enabled')?.setValue(settings.dailyReminders.enabled);

@ -13,7 +13,7 @@ export interface ImmediateRemindersSettings {
mentioned:boolean;
}
export interface UserPreferencesModel {
export interface IUserPreference {
autoHidePopups:boolean;
commentSortDescending:boolean;
hideMail:boolean;

@ -7,10 +7,10 @@ import {
} from 'rxjs/operators';
import { Observable } from 'rxjs';
import { UserPreferencesStore } from 'core-app/features/user-preferences/state/user-preferences.store';
import { UserPreferencesModel } from 'core-app/features/user-preferences/state/user-preferences.model';
import { IUserPreference } from 'core-app/features/user-preferences/state/user-preferences.model';
import { INotificationSetting } from 'core-app/features/user-preferences/state/notification-setting.model';
export class UserPreferencesQuery extends Query<UserPreferencesModel> {
export class UserPreferencesQuery extends Query<IUserPreference> {
notificationSettings$ = this.select('notifications');
notificationsGroupedByProject$:Observable<{ [key:string]:INotificationSetting[] }> = this

@ -3,7 +3,7 @@ import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';
import { ToastService } from 'core-app/shared/components/toaster/toast.service';
import { ApiV3UserPreferencesPaths } from 'core-app/core/apiv3/endpoints/users/apiv3-user-preferences-paths';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { UserPreferencesModel } from 'core-app/features/user-preferences/state/user-preferences.model';
import { IUserPreference } from 'core-app/features/user-preferences/state/user-preferences.model';
import { UserPreferencesStore } from 'core-app/features/user-preferences/state/user-preferences.store';
import { UserPreferencesQuery } from 'core-app/features/user-preferences/state/user-preferences.query';
@ -33,7 +33,7 @@ export class UserPreferencesService {
);
}
update(user:string, delta:Partial<UserPreferencesModel>):void {
update(user:string, delta:Partial<IUserPreference>):void {
this.store.setLoading(true);
this
.preferenceAPI(user)

@ -31,9 +31,9 @@ import {
Store,
StoreConfig,
} from '@datorama/akita';
import { UserPreferencesModel } from 'core-app/features/user-preferences/state/user-preferences.model';
import { IUserPreference } from 'core-app/features/user-preferences/state/user-preferences.model';
function createInitialState():UserPreferencesModel {
function createInitialState():IUserPreference {
return {
autoHidePopups: true,
commentSortDescending: false,
@ -56,7 +56,7 @@ function createInitialState():UserPreferencesModel {
}
@StoreConfig({ name: 'notification-settings' })
export class UserPreferencesStore extends Store<UserPreferencesModel> {
export class UserPreferencesStore extends Store<IUserPreference> {
constructor() {
super(createInitialState());
}

Loading…
Cancel
Save