Skip to content

Commit 91f8e0d

Browse files
authored
[ENG-10251] Standardize model file naming convention (#874)
- Ticket: [ENG-10251] - Feature flag: n/a ## Summary of Changes 1. Renamed all instances of `.models.ts` to `.model.ts`. 2. Updated all internal references and import paths in components, services, and pipes to reflect the new file names. 3. Updated Jest unit tests to ensure imports within `.spec.ts` files are pointing to the corrected model paths. 4. Verified that no duplicate model definitions exist under the old naming scheme. 5. Remove animations.
1 parent a2a9f35 commit 91f8e0d

177 files changed

Lines changed: 184 additions & 233 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/app/core/animations/fade.in-out.animation.ts

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/app/core/components/osf-banners/cookie-consent-banner/cookie-consent-banner.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('Component: Cookie Consent Banner', () => {
2020

2121
beforeEach(async () => {
2222
await TestBed.configureTestingModule({
23-
imports: [OSFTestingModule, CookieConsentBannerComponent, MockComponent(IconComponent)],
23+
imports: [CookieConsentBannerComponent, OSFTestingModule, MockComponent(IconComponent)],
2424
providers: [{ provide: CookieService, useValue: cookieServiceMock }],
2525
});
2626

src/app/core/components/osf-banners/cookie-consent-banner/cookie-consent-banner.component.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,20 @@ import { Message } from 'primeng/message';
77
import { isPlatformBrowser } from '@angular/common';
88
import { ChangeDetectionStrategy, Component, inject, PLATFORM_ID, signal } from '@angular/core';
99

10-
import { fadeInOutAnimation } from '@core/animations/fade.in-out.animation';
1110
import { IconComponent } from '@osf/shared/components/icon/icon.component';
1211

1312
/**
1413
* Displays a cookie consent banner until the user accepts.
1514
*
1615
* - Uses `ngx-cookie-service` to persist acceptance across sessions.
1716
* - Automatically hides the banner if consent is already recorded.
18-
* - Animates in/out using the `fadeInOutAnimation`.
1917
* - Supports translation via `TranslatePipe`.
2018
*/
2119
@Component({
2220
selector: 'osf-cookie-consent-banner',
2321
templateUrl: './cookie-consent-banner.component.html',
2422
styleUrls: ['./cookie-consent-banner.component.scss'],
2523
imports: [Button, TranslatePipe, IconComponent, Message],
26-
animations: [fadeInOutAnimation],
2724
changeDetection: ChangeDetectionStrategy.OnPush,
2825
})
2926
export class CookieConsentBannerComponent {
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
@if (maintenance() && !dismissed()) {
22
<p-message
3+
class="block p-3"
34
styleClass="w-full"
5+
icon="pi pi-info-circle"
46
[severity]="maintenance()?.severity"
57
[text]="maintenance()?.message"
68
[closable]="true"
79
(onClose)="dismiss()"
8-
class="block p-3"
9-
icon="pi pi-info-circle"
10-
@fadeInOut
1110
>
1211
</p-message>
1312
}

src/app/core/components/osf-banners/maintenance-banner/maintenance-banner.component.spec.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
import { CookieService } from 'ngx-cookie-service';
22

3-
import { MessageModule } from 'primeng/message';
4-
53
import { of } from 'rxjs';
64

75
import { HttpClient } from '@angular/common/http';
86
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
97
import { By } from '@angular/platform-browser';
10-
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
118

129
import { MaintenanceBannerComponent } from './maintenance-banner.component';
1310

11+
import { OSFTestingModule } from '@testing/osf.testing.module';
12+
1413
describe('Component: Maintenance Banner', () => {
1514
let fixture: ComponentFixture<MaintenanceBannerComponent>;
1615
let httpClient: { get: jest.Mock };
@@ -25,7 +24,7 @@ describe('Component: Maintenance Banner', () => {
2524
httpClient = { get: jest.fn() } as any;
2625

2726
await TestBed.configureTestingModule({
28-
imports: [MaintenanceBannerComponent, NoopAnimationsModule, MessageModule],
27+
imports: [MaintenanceBannerComponent, OSFTestingModule],
2928
providers: [
3029
{ provide: CookieService, useValue: cookieService },
3130
{ provide: HttpClient, useValue: httpClient },

src/app/core/components/osf-banners/maintenance-banner/maintenance-banner.component.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import { MessageModule } from 'primeng/message';
55
import { CommonModule, isPlatformBrowser } from '@angular/common';
66
import { ChangeDetectionStrategy, Component, inject, OnInit, PLATFORM_ID, signal } from '@angular/core';
77

8-
import { fadeInOutAnimation } from '@core/animations/fade.in-out.animation';
9-
108
import { MaintenanceModel } from '../models/maintenance.model';
119
import { MaintenanceService } from '../services/maintenance.service';
1210

@@ -17,8 +15,6 @@ import { MaintenanceService } from '../services/maintenance.service';
1715
* the banner. If not, it queries the maintenance status from the server and displays
1816
* the maintenance message if one is active.
1917
*
20-
* The component supports animation via `fadeInOutAnimation` and is optimized with `OnPush` change detection.
21-
*
2218
* @example
2319
* ```html
2420
* <osf-maintenance-banner />
@@ -29,7 +25,6 @@ import { MaintenanceService } from '../services/maintenance.service';
2925
imports: [CommonModule, MessageModule],
3026
templateUrl: './maintenance-banner.component.html',
3127
styleUrls: ['./maintenance-banner.component.scss'],
32-
animations: [fadeInOutAnimation],
3328
changeDetection: ChangeDetectionStrategy.OnPush,
3429
})
3530
export class MaintenanceBannerComponent implements OnInit {

src/app/core/services/user.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import { inject, Injectable } from '@angular/core';
55
import { ENVIRONMENT } from '@core/provider/environment.provider';
66
import { ProfileSettingsKey } from '@osf/shared/enums/profile-settings-key.enum';
77
import { UserMapper } from '@osf/shared/mappers/user';
8+
import { UserData, UserModel } from '@osf/shared/models/user/user.model';
89
import { JsonApiService } from '@osf/shared/services/json-api.service';
910
import { ProfileSettingsUpdate } from '@shared/models/profile-settings-update.model';
10-
import { UserData, UserModel } from '@shared/models/user/user.models';
1111
import {
1212
UserAcceptedTermsOfServiceJsonApi,
1313
UserDataJsonApi,

src/app/core/store/user/user.actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Education } from '@osf/shared/models/user/education.model';
22
import { Employment } from '@osf/shared/models/user/employment.model';
33
import { SocialModel } from '@osf/shared/models/user/social.model';
4-
import { UserModel } from '@osf/shared/models/user/user.models';
4+
import { UserModel } from '@osf/shared/models/user/user.model';
55

66
export class GetCurrentUser {
77
static readonly type = '[User] Get Current User';

src/app/core/store/user/user.model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { AsyncStateModel } from '@osf/shared/models/store/async-state.model';
2-
import { UserModel } from '@osf/shared/models/user/user.models';
2+
import { UserModel } from '@osf/shared/models/user/user.model';
33

44
export interface UserStateModel {
55
currentUser: AsyncStateModel<UserModel | null>;

src/app/core/store/user/user.selectors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Selector } from '@ngxs/store';
33
import { Education } from '@osf/shared/models/user/education.model';
44
import { Employment } from '@osf/shared/models/user/employment.model';
55
import { SocialModel } from '@osf/shared/models/user/social.model';
6-
import { UserModel } from '@osf/shared/models/user/user.models';
6+
import { UserModel } from '@osf/shared/models/user/user.model';
77

88
import { UserStateModel } from './user.model';
99
import { UserState } from './user.state';

0 commit comments

Comments
 (0)