From a2d4151cc320b2a329483959e19c5070557b297f Mon Sep 17 00:00:00 2001 From: Polianin Nikita Date: Wed, 18 Dec 2024 06:57:27 +0300 Subject: [PATCH] refactor: clean code --- src/api/api.service.ts | 8 ++--- src/api/v1/authApiService.ts | 2 +- src/api/v1/schedule.service.ts | 6 ++-- .../data-spinner/data-spinner.component.html | 2 +- .../data-spinner/data-spinner.component.ts | 2 -- .../common/footer/footer.component.html | 4 +-- .../common/header/header.component.ts | 7 ++-- .../loading-indicator.component.ts | 3 +- .../schedule/table/table.component.ts | 2 -- .../schedule/tabs/group/group.component.html | 2 +- .../lecture-hall/lecture-hall.component.html | 3 +- .../lecture-hall/lecture-hall.component.ts | 2 -- .../schedule/tabs/other/other.component.html | 7 ++-- .../schedule/tabs/tabs.component.ts | 4 +-- src/directives/has-role.directive.ts | 7 ++-- src/index.html | 6 ++-- src/main.ts | 6 ++-- src/pages/login/login.component.css | 2 +- src/pages/login/login.component.html | 2 +- .../schedule/confirm-dialog.component.ts | 5 +-- .../requests/v1/configuration/cacheRequest.ts | 6 ++-- .../v1/configuration/databaseRequest.ts | 12 +++---- .../requests/v1/configuration/emailRequest.ts | 12 +++---- .../v1/configuration/loggingRequest.ts | 6 ++-- .../scheduleConfigurationRequest.ts | 4 +-- src/shared/requests/v1/createUserRequest.ts | 6 ++-- src/shared/requests/v1/loginRequest.ts | 4 +-- src/shared/requests/v1/scheduleRequest.ts | 10 +++--- .../requests/v1/twoFactorAuthRequest.ts | 4 +-- .../v1/availableProvidersResponse.ts | 6 ++-- .../responses/v1/campusBasicInfoResponse.ts | 6 ++-- .../responses/v1/campusDetailsResponse.ts | 8 ++--- .../v1/configuration/cacheResponse.ts | 8 ++--- .../v1/configuration/databaseResponse.ts | 16 ++++----- src/shared/responses/v1/disciplineResponse.ts | 4 +-- src/shared/responses/v1/errorResponse.ts | 4 +-- src/shared/responses/v1/facultyResponse.ts | 4 +-- .../responses/v1/groupDetailsResponse.ts | 10 +++--- src/shared/responses/v1/groupResponse.ts | 8 ++--- .../v1/lectureHallDetailsResponse.ts | 10 +++--- .../responses/v1/lectureHallResponse.ts | 6 ++-- src/shared/responses/v1/professorResponse.ts | 6 ++-- src/shared/responses/v1/scheduleResponse.ts | 34 +++++++++--------- src/shared/structs/PasswordPolicy.ts | 10 +++--- src/shared/structs/TimeOnly.ts | 6 ++-- src/shared/structs/pairPeriodTime.ts | 4 +-- src/styles.css | 35 +++++++++++++++++++ 47 files changed, 181 insertions(+), 150 deletions(-) diff --git a/src/api/api.service.ts b/src/api/api.service.ts index 02d2031..fe1084e 100644 --- a/src/api/api.service.ts +++ b/src/api/api.service.ts @@ -15,7 +15,7 @@ import {Router} from "@angular/router"; import {Injectable} from "@angular/core"; import {RequestBuilder, RequestData} from "@api/RequestBuilder"; import {ToastrService} from "ngx-toastr"; -import {AuthRoles} from "@model/AuthRoles"; +import {AuthRoles} from "@model/authRoles"; export enum AvailableVersion { v1 @@ -69,7 +69,7 @@ export default abstract class ApiService { }).pipe( catchError(error => { if (!secondTry && error.status === 401) - return this.handle401Error().pipe( + return this.handle401Error(error).pipe( switchMap(() => this.sendHttpRequest(method, request, true)) ); else { @@ -88,7 +88,7 @@ export default abstract class ApiService { }); } - private handle401Error(): Observable { + private handle401Error(error: any): Observable { if (ApiService.isRefreshingToken.value) return ApiService.refreshTokenSubject.asObservable(); @@ -103,7 +103,7 @@ export default abstract class ApiService { ApiService.isRefreshingToken.next(false); ApiService.refreshTokenSubject.error(err); ApiService.refreshTokenSubject = new ReplaySubject(1); - throw err; + throw error; }) ); } diff --git a/src/api/v1/authApiService.ts b/src/api/v1/authApiService.ts index 6dcfcc1..c6ed596 100644 --- a/src/api/v1/authApiService.ts +++ b/src/api/v1/authApiService.ts @@ -19,7 +19,7 @@ export default class AuthApiService extends ApiService { return this.post(request); } - public reLogin(){ + public reLogin() { let request = this.createRequestBuilder() .setEndpoint('ReLogin') .setWithCredentials() diff --git a/src/api/v1/schedule.service.ts b/src/api/v1/schedule.service.ts index ba35a54..0075bb9 100644 --- a/src/api/v1/schedule.service.ts +++ b/src/api/v1/schedule.service.ts @@ -1,7 +1,7 @@ import {Injectable} from "@angular/core"; import ApiService, {AvailableVersion} from "@api/api.service"; -import {DateOnly} from "@model/DateOnly"; -import {PeriodTimes} from "@model/pairPeriodTime"; +import {DateOnly} from "@model/dateOnly"; +import {PairPeriodTime} from "@model/pairPeriodTime"; import {ScheduleRequest} from "@api/v1/scheduleRequest"; import {ScheduleResponse} from "@api/v1/scheduleResponse"; import {map} from "rxjs"; @@ -16,7 +16,7 @@ export class ScheduleService extends ApiService { } public pairPeriod() { - return this.get('PairPeriod'); + return this.get('PairPeriod'); } public postSchedule(data: ScheduleRequest) { diff --git a/src/components/common/data-spinner/data-spinner.component.html b/src/components/common/data-spinner/data-spinner.component.html index 392a2d6..1b07825 100644 --- a/src/components/common/data-spinner/data-spinner.component.html +++ b/src/components/common/data-spinner/data-spinner.component.html @@ -1 +1 @@ - + diff --git a/src/components/common/data-spinner/data-spinner.component.ts b/src/components/common/data-spinner/data-spinner.component.ts index af08444..c8becb2 100644 --- a/src/components/common/data-spinner/data-spinner.component.ts +++ b/src/components/common/data-spinner/data-spinner.component.ts @@ -1,13 +1,11 @@ import {Component, Input} from '@angular/core'; import {MatProgressSpinner} from "@angular/material/progress-spinner"; -import {NgStyle} from "@angular/common"; @Component({ selector: 'app-data-spinner', standalone: true, imports: [ MatProgressSpinner, - NgStyle ], templateUrl: './data-spinner.component.html' }) diff --git a/src/components/common/footer/footer.component.html b/src/components/common/footer/footer.component.html index 57233ec..810c13e 100644 --- a/src/components/common/footer/footer.component.html +++ b/src/components/common/footer/footer.component.html @@ -22,8 +22,8 @@
diff --git a/src/components/common/header/header.component.ts b/src/components/common/header/header.component.ts index 4059354..50f2e24 100644 --- a/src/components/common/header/header.component.ts +++ b/src/components/common/header/header.component.ts @@ -1,16 +1,13 @@ -import { Component } from '@angular/core'; +import {Component} from '@angular/core'; import {MatToolbar} from "@angular/material/toolbar"; -import {MatAnchor, MatButton} from "@angular/material/button"; import {HasRoleDirective} from "@/directives/has-role.directive"; -import {AuthRoles} from "@model/AuthRoles"; +import {AuthRoles} from "@model/authRoles"; @Component({ selector: 'app-header', standalone: true, imports: [ MatToolbar, - MatButton, - MatAnchor, HasRoleDirective ], templateUrl: './header.component.html', diff --git a/src/components/common/loading-indicator/loading-indicator.component.ts b/src/components/common/loading-indicator/loading-indicator.component.ts index 7d78091..0d7e19e 100644 --- a/src/components/common/loading-indicator/loading-indicator.component.ts +++ b/src/components/common/loading-indicator/loading-indicator.component.ts @@ -1,14 +1,13 @@ import {Component, EventEmitter, Input, Output} from '@angular/core'; import {DataSpinnerComponent} from "@component/common/data-spinner/data-spinner.component"; import {MatIcon} from "@angular/material/icon"; -import {MatButton, MatFabButton} from "@angular/material/button"; +import {MatFabButton} from "@angular/material/button"; @Component({ selector: 'app-loading-indicator', standalone: true, imports: [ DataSpinnerComponent, - MatButton, MatIcon, MatFabButton ], diff --git a/src/components/schedule/table/table.component.ts b/src/components/schedule/table/table.component.ts index 7a75bc0..830dca7 100644 --- a/src/components/schedule/table/table.component.ts +++ b/src/components/schedule/table/table.component.ts @@ -3,7 +3,6 @@ import {MatTableDataSource, MatTableModule} from "@angular/material/table"; import {MatIcon} from "@angular/material/icon"; import {DatePipe} from "@angular/common"; import {addDays} from "@progress/kendo-date-math"; -import {MatDivider} from "@angular/material/divider"; import {DataSpinnerComponent} from "@component/common/data-spinner/data-spinner.component"; import {ScheduleResponse} from "@api/v1/scheduleResponse"; @@ -23,7 +22,6 @@ interface Dictionary { MatTableModule, MatIcon, DatePipe, - MatDivider, DataSpinnerComponent ], templateUrl: './table.component.html', diff --git a/src/components/schedule/tabs/group/group.component.html b/src/components/schedule/tabs/group/group.component.html index b5b0c93..02a7f0a 100644 --- a/src/components/schedule/tabs/group/group.component.html +++ b/src/components/schedule/tabs/group/group.component.html @@ -90,7 +90,7 @@ } @if (((filteredGroupsSpecialist && filteredGroupsSpecialist.length > 0 && filteredGroupsBehaviour && filteredGroupsBehaviour.length > 0) || - ((!filteredGroupsSpecialist || filteredGroupsSpecialist.length === 0) && filteredGroupsBehaviour && filteredGroupsBehaviour.length > 0)) && + ((!filteredGroupsSpecialist || filteredGroupsSpecialist.length === 0) && filteredGroupsBehaviour && filteredGroupsBehaviour.length > 0)) && filteredGroupsMagistracy && filteredGroupsMagistracy.length > 0) {

diff --git a/src/components/schedule/tabs/lecture-hall/lecture-hall.component.html b/src/components/schedule/tabs/lecture-hall/lecture-hall.component.html index a12a6c9..6cc5502 100644 --- a/src/components/schedule/tabs/lecture-hall/lecture-hall.component.html +++ b/src/components/schedule/tabs/lecture-hall/lecture-hall.component.html @@ -23,7 +23,8 @@ Кабинет - + @for (lectureHall of lectureHallsFiltered; track $index) { {{ lectureHall.name }} diff --git a/src/components/schedule/tabs/lecture-hall/lecture-hall.component.ts b/src/components/schedule/tabs/lecture-hall/lecture-hall.component.ts index 82ff2cb..e12d72d 100644 --- a/src/components/schedule/tabs/lecture-hall/lecture-hall.component.ts +++ b/src/components/schedule/tabs/lecture-hall/lecture-hall.component.ts @@ -1,5 +1,4 @@ import {Component, EventEmitter, ViewChild} from '@angular/core'; -import {AsyncPipe} from "@angular/common"; import {MatAccordion, MatExpansionModule, MatExpansionPanel} from "@angular/material/expansion"; import {MatChipListbox, MatChipsModule} from "@angular/material/chips"; import {catchError} from "rxjs"; @@ -22,7 +21,6 @@ enum Enclosure { imports: [ MatChipsModule, MatExpansionModule, - AsyncPipe, ReactiveFormsModule, MatAccordion, LoadingIndicatorComponent diff --git a/src/components/schedule/tabs/other/other.component.html b/src/components/schedule/tabs/other/other.component.html index 606245e..fa281d0 100644 --- a/src/components/schedule/tabs/other/other.component.html +++ b/src/components/schedule/tabs/other/other.component.html @@ -1,11 +1,14 @@ - +
- + diff --git a/src/components/schedule/tabs/tabs.component.ts b/src/components/schedule/tabs/tabs.component.ts index c62f224..0da9716 100644 --- a/src/components/schedule/tabs/tabs.component.ts +++ b/src/components/schedule/tabs/tabs.component.ts @@ -4,7 +4,6 @@ import {MatTab, MatTabGroup} from "@angular/material/tabs"; import {Observable} from "rxjs"; import {FormsModule, ReactiveFormsModule} from "@angular/forms"; import {MatButton} from "@angular/material/button"; -import {DataSpinnerComponent} from "@component/common/data-spinner/data-spinner.component"; import {GroupComponent} from "@component/schedule/tabs/group/group.component"; import {ProfessorComponent} from "@component/schedule/tabs/professor/professor.component"; import {LectureHallComponent} from "@component/schedule/tabs/lecture-hall/lecture-hall.component"; @@ -15,7 +14,7 @@ import {DisciplineService} from "@api/v1/discipline.service"; import {LectureHallService} from "@api/v1/lectureHall.service"; import {GroupService} from "@api/v1/group.service"; import {ProfessorService} from "@api/v1/professor.service"; -import {AuthRoles} from "@model/AuthRoles"; +import {AuthRoles} from "@model/authRoles"; import {HasRoleDirective} from "@/directives/has-role.directive"; import {TabSelectType, TabStorageService} from "@service/tab-storage.service"; import {ScheduleRequest} from "@api/v1/scheduleRequest"; @@ -36,7 +35,6 @@ export enum TabsSelect { MatTab, ReactiveFormsModule, MatButton, - DataSpinnerComponent, GroupComponent, ProfessorComponent, LectureHallComponent, diff --git a/src/directives/has-role.directive.ts b/src/directives/has-role.directive.ts index 2080b60..5b11c81 100644 --- a/src/directives/has-role.directive.ts +++ b/src/directives/has-role.directive.ts @@ -1,6 +1,6 @@ import {Directive, Input, TemplateRef, ViewContainerRef} from '@angular/core'; import AuthApiService from "@api/v1/authApiService"; -import {AuthRoles} from "@model/AuthRoles"; +import {AuthRoles} from "@model/authRoles"; import {catchError, of} from "rxjs"; @Directive({ @@ -13,7 +13,8 @@ export class HasRoleDirective { private templateRef: TemplateRef, private viewContainer: ViewContainerRef, private authService: AuthApiService - ) {} + ) { + } @Input() set appHasRole(role: AuthRoles) { this.viewContainer.clear(); @@ -29,6 +30,6 @@ export class HasRoleDirective { this.viewContainer.createEmbeddedView(this.templateRef); else this.viewContainer.clear(); - }) + }); } } diff --git a/src/index.html b/src/index.html index 1240ea2..f491147 100644 --- a/src/index.html +++ b/src/index.html @@ -8,10 +8,12 @@ - + - + diff --git a/src/main.ts b/src/main.ts index 35b00f3..e4260ef 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,6 @@ -import { bootstrapApplication } from '@angular/platform-browser'; -import { appConfig } from './app/app.config'; -import { AppComponent } from './app/app.component'; +import {bootstrapApplication} from '@angular/platform-browser'; +import {appConfig} from './app/app.config'; +import {AppComponent} from './app/app.component'; bootstrapApplication(AppComponent, appConfig) .catch((err) => console.error(err)); diff --git a/src/pages/login/login.component.css b/src/pages/login/login.component.css index 67db831..7923e9d 100644 --- a/src/pages/login/login.component.css +++ b/src/pages/login/login.component.css @@ -17,7 +17,7 @@ .formLogin form { display: flex; - flex-direction:column; + flex-direction: column; } .formLoginButton { diff --git a/src/pages/login/login.component.html b/src/pages/login/login.component.html index 86def24..3b2bb16 100644 --- a/src/pages/login/login.component.html +++ b/src/pages/login/login.component.html @@ -57,7 +57,7 @@ - {{errorText}} + {{ errorText }}
diff --git a/src/pages/schedule/confirm-dialog.component.ts b/src/pages/schedule/confirm-dialog.component.ts index 8a46065..d4097e7 100644 --- a/src/pages/schedule/confirm-dialog.component.ts +++ b/src/pages/schedule/confirm-dialog.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import {Component} from '@angular/core'; import {MatDialogActions, MatDialogContent, MatDialogRef, MatDialogTitle} from '@angular/material/dialog'; import {MatButton} from "@angular/material/button"; @@ -15,7 +15,8 @@ import {MatButton} from "@angular/material/button"; }) export class ConfirmDialogComponent { - constructor(public dialogRef: MatDialogRef) { } + constructor(public dialogRef: MatDialogRef) { + } protected onConfirm(): void { this.dialogRef.close(true); diff --git a/src/shared/requests/v1/configuration/cacheRequest.ts b/src/shared/requests/v1/configuration/cacheRequest.ts index 2ae0a24..43f0d23 100644 --- a/src/shared/requests/v1/configuration/cacheRequest.ts +++ b/src/shared/requests/v1/configuration/cacheRequest.ts @@ -1,5 +1,5 @@ export interface CacheRequest { - server: string; - port: number; - password?: string; + server: string; + port: number; + password?: string; } diff --git a/src/shared/requests/v1/configuration/databaseRequest.ts b/src/shared/requests/v1/configuration/databaseRequest.ts index 1fe1ec1..41ad846 100644 --- a/src/shared/requests/v1/configuration/databaseRequest.ts +++ b/src/shared/requests/v1/configuration/databaseRequest.ts @@ -1,8 +1,8 @@ export interface DatabaseRequest { - server: string; - port: number; - database: string; - user: string; - ssl: boolean; - password?: string; + server: string; + port: number; + database: string; + user: string; + ssl: boolean; + password?: string; } diff --git a/src/shared/requests/v1/configuration/emailRequest.ts b/src/shared/requests/v1/configuration/emailRequest.ts index 7846d90..b837a12 100644 --- a/src/shared/requests/v1/configuration/emailRequest.ts +++ b/src/shared/requests/v1/configuration/emailRequest.ts @@ -1,8 +1,8 @@ export interface EmailRequest { - server: string; - from: string; - password: string; - port: number; - ssl: boolean; - user: string; + server: string; + from: string; + password: string; + port: number; + ssl: boolean; + user: string; } diff --git a/src/shared/requests/v1/configuration/loggingRequest.ts b/src/shared/requests/v1/configuration/loggingRequest.ts index e075ee8..4ce7669 100644 --- a/src/shared/requests/v1/configuration/loggingRequest.ts +++ b/src/shared/requests/v1/configuration/loggingRequest.ts @@ -1,5 +1,5 @@ export interface LoggingRequest { - enableLogToFile: boolean; - logFileName?: string; - logFilePath?: string; + enableLogToFile: boolean; + logFileName?: string; + logFilePath?: string; } diff --git a/src/shared/requests/v1/configuration/scheduleConfigurationRequest.ts b/src/shared/requests/v1/configuration/scheduleConfigurationRequest.ts index 0682da4..9637698 100644 --- a/src/shared/requests/v1/configuration/scheduleConfigurationRequest.ts +++ b/src/shared/requests/v1/configuration/scheduleConfigurationRequest.ts @@ -1,4 +1,4 @@ export interface ScheduleConfigurationRequest { - cronUpdateSchedule?: string; - startTerm: string; + cronUpdateSchedule?: string; + startTerm: string; } diff --git a/src/shared/requests/v1/createUserRequest.ts b/src/shared/requests/v1/createUserRequest.ts index 12c9f7c..581261b 100644 --- a/src/shared/requests/v1/createUserRequest.ts +++ b/src/shared/requests/v1/createUserRequest.ts @@ -1,5 +1,5 @@ export interface CreateUserRequest { - email: string; - username: string; - password: string; + email: string; + username: string; + password: string; } diff --git a/src/shared/requests/v1/loginRequest.ts b/src/shared/requests/v1/loginRequest.ts index eb97118..c7aa400 100644 --- a/src/shared/requests/v1/loginRequest.ts +++ b/src/shared/requests/v1/loginRequest.ts @@ -1,4 +1,4 @@ export interface LoginRequest { - username: string; - password: string; + username: string; + password: string; } diff --git a/src/shared/requests/v1/scheduleRequest.ts b/src/shared/requests/v1/scheduleRequest.ts index 741f70e..d7808a4 100644 --- a/src/shared/requests/v1/scheduleRequest.ts +++ b/src/shared/requests/v1/scheduleRequest.ts @@ -1,7 +1,7 @@ export interface ScheduleRequest { - groups?: Array; - isEven?: boolean; - disciplines?: Array; - professors?: Array; - lectureHalls?: Array; + groups?: Array; + isEven?: boolean; + disciplines?: Array; + professors?: Array; + lectureHalls?: Array; } diff --git a/src/shared/requests/v1/twoFactorAuthRequest.ts b/src/shared/requests/v1/twoFactorAuthRequest.ts index 2b9a150..1f350ea 100644 --- a/src/shared/requests/v1/twoFactorAuthRequest.ts +++ b/src/shared/requests/v1/twoFactorAuthRequest.ts @@ -1,6 +1,6 @@ import {TwoFactorAuthentication} from "@model/twoFactorAuthentication"; export interface TwoFactorAuthRequest { - code: string; - method: TwoFactorAuthentication; + code: string; + method: TwoFactorAuthentication; } diff --git a/src/shared/responses/v1/availableProvidersResponse.ts b/src/shared/responses/v1/availableProvidersResponse.ts index aa738a7..01e0d39 100644 --- a/src/shared/responses/v1/availableProvidersResponse.ts +++ b/src/shared/responses/v1/availableProvidersResponse.ts @@ -1,7 +1,7 @@ import {OAuthProvider} from "@model/oAuthProvider"; export interface AvailableOAuthProvidersResponse { - providerName: string; - provider: OAuthProvider; - redirect: string; + providerName: string; + provider: OAuthProvider; + redirect: string; } diff --git a/src/shared/responses/v1/campusBasicInfoResponse.ts b/src/shared/responses/v1/campusBasicInfoResponse.ts index f7734c3..9d3e9e6 100644 --- a/src/shared/responses/v1/campusBasicInfoResponse.ts +++ b/src/shared/responses/v1/campusBasicInfoResponse.ts @@ -1,5 +1,5 @@ export interface CampusBasicInfoResponse { - id: number; - codeName: string; - fullName?: string; + id: number; + codeName: string; + fullName?: string; } diff --git a/src/shared/responses/v1/campusDetailsResponse.ts b/src/shared/responses/v1/campusDetailsResponse.ts index cd9af12..264bf97 100644 --- a/src/shared/responses/v1/campusDetailsResponse.ts +++ b/src/shared/responses/v1/campusDetailsResponse.ts @@ -1,6 +1,6 @@ export interface CampusDetailsResponse { - id: number; - codeName: string; - fullName?: string; - address?: string; + id: number; + codeName: string; + fullName?: string; + address?: string; } diff --git a/src/shared/responses/v1/configuration/cacheResponse.ts b/src/shared/responses/v1/configuration/cacheResponse.ts index c564a79..7958728 100644 --- a/src/shared/responses/v1/configuration/cacheResponse.ts +++ b/src/shared/responses/v1/configuration/cacheResponse.ts @@ -1,8 +1,8 @@ import {CacheType} from "@model/cacheType"; export interface CacheResponse { - type: CacheType; - server?: string; - port: number; - password?: string; + type: CacheType; + server?: string; + port: number; + password?: string; } diff --git a/src/shared/responses/v1/configuration/databaseResponse.ts b/src/shared/responses/v1/configuration/databaseResponse.ts index 7bdd4b1..e3e133c 100644 --- a/src/shared/responses/v1/configuration/databaseResponse.ts +++ b/src/shared/responses/v1/configuration/databaseResponse.ts @@ -1,12 +1,12 @@ import {DatabaseType} from "@model/databaseType"; export interface DatabaseResponse { - type: DatabaseType; - server?: string; - port: number; - database?: string; - user?: string; - ssl: boolean; - password?: string; - pathToDatabase?: string; + type: DatabaseType; + server?: string; + port: number; + database?: string; + user?: string; + ssl: boolean; + password?: string; + pathToDatabase?: string; } diff --git a/src/shared/responses/v1/disciplineResponse.ts b/src/shared/responses/v1/disciplineResponse.ts index e84be6b..b0bb79e 100644 --- a/src/shared/responses/v1/disciplineResponse.ts +++ b/src/shared/responses/v1/disciplineResponse.ts @@ -1,4 +1,4 @@ export interface DisciplineResponse { - id: number; - name: string; + id: number; + name: string; } diff --git a/src/shared/responses/v1/errorResponse.ts b/src/shared/responses/v1/errorResponse.ts index 64f24ff..25b9b52 100644 --- a/src/shared/responses/v1/errorResponse.ts +++ b/src/shared/responses/v1/errorResponse.ts @@ -1,4 +1,4 @@ export interface ErrorResponse { - error: string; - code: number; + error: string; + code: number; } diff --git a/src/shared/responses/v1/facultyResponse.ts b/src/shared/responses/v1/facultyResponse.ts index 33970ef..710965d 100644 --- a/src/shared/responses/v1/facultyResponse.ts +++ b/src/shared/responses/v1/facultyResponse.ts @@ -1,4 +1,4 @@ export interface FacultyResponse { - id: number; - name: string; + id: number; + name: string; } diff --git a/src/shared/responses/v1/groupDetailsResponse.ts b/src/shared/responses/v1/groupDetailsResponse.ts index c65397a..13594fe 100644 --- a/src/shared/responses/v1/groupDetailsResponse.ts +++ b/src/shared/responses/v1/groupDetailsResponse.ts @@ -1,7 +1,7 @@ export interface GroupDetailsResponse { - id: number; - name: string; - courseNumber: number; - facultyId?: number; - facultyName?: string; + id: number; + name: string; + courseNumber: number; + facultyId?: number; + facultyName?: string; } diff --git a/src/shared/responses/v1/groupResponse.ts b/src/shared/responses/v1/groupResponse.ts index 1f87bc9..c6de863 100644 --- a/src/shared/responses/v1/groupResponse.ts +++ b/src/shared/responses/v1/groupResponse.ts @@ -1,6 +1,6 @@ export interface GroupResponse { - id: number; - name: string; - courseNumber: number; - facultyId?: number; + id: number; + name: string; + courseNumber: number; + facultyId?: number; } diff --git a/src/shared/responses/v1/lectureHallDetailsResponse.ts b/src/shared/responses/v1/lectureHallDetailsResponse.ts index f731fcf..6f3ec74 100644 --- a/src/shared/responses/v1/lectureHallDetailsResponse.ts +++ b/src/shared/responses/v1/lectureHallDetailsResponse.ts @@ -1,7 +1,7 @@ export interface LectureHallDetailsResponse { - id: number; - name: string; - campusId: number; - campusName?: string; - campusCode?: string; + id: number; + name: string; + campusId: number; + campusName?: string; + campusCode?: string; } diff --git a/src/shared/responses/v1/lectureHallResponse.ts b/src/shared/responses/v1/lectureHallResponse.ts index d951d85..5df1df3 100644 --- a/src/shared/responses/v1/lectureHallResponse.ts +++ b/src/shared/responses/v1/lectureHallResponse.ts @@ -1,5 +1,5 @@ export interface LectureHallResponse { - id: number; - name: string; - campusId: number; + id: number; + name: string; + campusId: number; } diff --git a/src/shared/responses/v1/professorResponse.ts b/src/shared/responses/v1/professorResponse.ts index 50ad14d..cb19f8b 100644 --- a/src/shared/responses/v1/professorResponse.ts +++ b/src/shared/responses/v1/professorResponse.ts @@ -1,5 +1,5 @@ export interface ProfessorResponse { - id: number; - name: string; - altName?: string; + id: number; + name: string; + altName?: string; } diff --git a/src/shared/responses/v1/scheduleResponse.ts b/src/shared/responses/v1/scheduleResponse.ts index 23dea16..fa4a6ef 100644 --- a/src/shared/responses/v1/scheduleResponse.ts +++ b/src/shared/responses/v1/scheduleResponse.ts @@ -1,21 +1,21 @@ import {DayOfWeek} from "@model/dayOfWeek"; export interface ScheduleResponse { - dayOfWeek: DayOfWeek; - pairNumber: number; - isEven: boolean; - discipline: string; - disciplineId: number; - isExcludedWeeks?: boolean; - weeks?: Array; - typeOfOccupations: Array; - group: string; - groupId: number; - lectureHalls: Array; - lectureHallsId: Array; - professors: Array; - professorsId: Array; - campus: Array; - campusId: Array; - linkToMeet: Array; + dayOfWeek: DayOfWeek; + pairNumber: number; + isEven: boolean; + discipline: string; + disciplineId: number; + isExcludedWeeks?: boolean; + weeks?: Array; + typeOfOccupations: Array; + group: string; + groupId: number; + lectureHalls: Array; + lectureHallsId: Array; + professors: Array; + professorsId: Array; + campus: Array; + campusId: Array; + linkToMeet: Array; } diff --git a/src/shared/structs/PasswordPolicy.ts b/src/shared/structs/PasswordPolicy.ts index ced1f89..9af3a04 100644 --- a/src/shared/structs/PasswordPolicy.ts +++ b/src/shared/structs/PasswordPolicy.ts @@ -1,7 +1,7 @@ export interface PasswordPolicy { - minimumLength: number; - requireLetter: boolean; - requireLettersDifferentCase: boolean; - requireDigit: boolean; - requireSpecialCharacter: boolean; + minimumLength: number; + requireLetter: boolean; + requireLettersDifferentCase: boolean; + requireDigit: boolean; + requireSpecialCharacter: boolean; } diff --git a/src/shared/structs/TimeOnly.ts b/src/shared/structs/TimeOnly.ts index e97d823..938a453 100644 --- a/src/shared/structs/TimeOnly.ts +++ b/src/shared/structs/TimeOnly.ts @@ -9,10 +9,10 @@ export class TimeOnly { if (hourOrTime instanceof Date) { this._ticks = hourOrTime.getTime(); } else if (typeof hourOrTime === 'number' && minute !== undefined && second !== undefined) { - this._ticks = new Date(2000, 0, 1, hourOrTime, minute, second, 0).getTime() + this._ticks = new Date(2000, 0, 1, hourOrTime, minute, second, 0).getTime(); } else if (typeof hourOrTime === 'string') { const [h, m, s] = hourOrTime.split(':').map(Number); - this._ticks = new Date(2000, 0, 1, h, m, s, 0).getTime() + this._ticks = new Date(2000, 0, 1, h, m, s, 0).getTime(); } else { throw new Error('Invalid constructor arguments'); } @@ -35,7 +35,7 @@ export class TimeOnly { } toTimeWithoutSeconds(): string { - return `${String(this.hour).padStart(2, '0')}:${String(this.minute).padStart(2, '0')}` + return `${String(this.hour).padStart(2, '0')}:${String(this.minute).padStart(2, '0')}`; } toString(): string { diff --git a/src/shared/structs/pairPeriodTime.ts b/src/shared/structs/pairPeriodTime.ts index 378933d..a27c831 100644 --- a/src/shared/structs/pairPeriodTime.ts +++ b/src/shared/structs/pairPeriodTime.ts @@ -1,4 +1,4 @@ export interface PairPeriodTime { - start: string; - end: string; + start: string; + end: string; } diff --git a/src/styles.css b/src/styles.css index b428377..f327bdf 100644 --- a/src/styles.css +++ b/src/styles.css @@ -17,38 +17,46 @@ body { left: 50%; transform: translate(-50%, -50%); } + .toast-top-center { top: 0; right: 0; width: 100%; } + .toast-bottom-center { bottom: 0; right: 0; width: 100%; } + .toast-top-full-width { top: 0; right: 0; width: 100%; } + .toast-bottom-full-width { bottom: 0; right: 0; width: 100%; } + .toast-top-left { top: 12px; left: 12px; } + .toast-top-right { top: 12px; right: 12px; } + .toast-bottom-right { right: 12px; bottom: 12px; } + .toast-bottom-left { bottom: 12px; left: 12px; @@ -58,17 +66,21 @@ body { .toast-title { font-weight: bold; } + .toast-message { word-wrap: break-word; } + .toast-message a, .toast-message label { color: #FFFFFF; } + .toast-message a:hover { color: #CCCCCC; text-decoration: none; } + .toast-close-button { position: relative; right: -0.3em; @@ -80,6 +92,7 @@ body { text-shadow: 0 1px 0 #ffffff; /* opacity: 0.8; */ } + .toast-close-button:hover, .toast-close-button:focus { color: #000000; @@ -87,6 +100,7 @@ body { cursor: pointer; opacity: 0.4; } + /*Additional properties for button version iOS requires the button element instead of an anchor tag. If you want the anchor version, it requires `href="#"`.*/ @@ -96,14 +110,17 @@ button.toast-close-button { background: transparent; border: 0; } + .toast-container { pointer-events: none; position: fixed; z-index: 999999; } + .toast-container * { box-sizing: border-box; } + .toast-container .ngx-toastr { position: relative; overflow: hidden; @@ -117,55 +134,68 @@ button.toast-close-button { box-shadow: 0 0 12px #999999; color: #FFFFFF; } + .toast-container .ngx-toastr:hover { box-shadow: 0 0 12px #000000; opacity: 1; cursor: pointer; } + /* https://github.com/FortAwesome/Font-Awesome-Pro/blob/master/advanced-options/raw-svg/regular/info-circle.svg */ .toast-info { background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHZpZXdCb3g9JzAgMCA1MTIgNTEyJyB3aWR0aD0nNTEyJyBoZWlnaHQ9JzUxMic+PHBhdGggZmlsbD0ncmdiKDI1NSwyNTUsMjU1KScgZD0nTTI1NiA4QzExOS4wNDMgOCA4IDExOS4wODMgOCAyNTZjMCAxMzYuOTk3IDExMS4wNDMgMjQ4IDI0OCAyNDhzMjQ4LTExMS4wMDMgMjQ4LTI0OEM1MDQgMTE5LjA4MyAzOTIuOTU3IDggMjU2IDh6bTAgMTEwYzIzLjE5NiAwIDQyIDE4LjgwNCA0MiA0MnMtMTguODA0IDQyLTQyIDQyLTQyLTE4LjgwNC00Mi00MiAxOC44MDQtNDIgNDItNDJ6bTU2IDI1NGMwIDYuNjI3LTUuMzczIDEyLTEyIDEyaC04OGMtNi42MjcgMC0xMi01LjM3My0xMi0xMnYtMjRjMC02LjYyNyA1LjM3My0xMiAxMi0xMmgxMnYtNjRoLTEyYy02LjYyNyAwLTEyLTUuMzczLTEyLTEydi0yNGMwLTYuNjI3IDUuMzczLTEyIDEyLTEyaDY0YzYuNjI3IDAgMTIgNS4zNzMgMTIgMTJ2MTAwaDEyYzYuNjI3IDAgMTIgNS4zNzMgMTIgMTJ2MjR6Jy8+PC9zdmc+"); } + /* https://github.com/FortAwesome/Font-Awesome-Pro/blob/master/advanced-options/raw-svg/regular/times-circle.svg */ .toast-error { background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHZpZXdCb3g9JzAgMCA1MTIgNTEyJyB3aWR0aD0nNTEyJyBoZWlnaHQ9JzUxMic+PHBhdGggZmlsbD0ncmdiKDI1NSwyNTUsMjU1KScgZD0nTTI1NiA4QzExOSA4IDggMTE5IDggMjU2czExMSAyNDggMjQ4IDI0OCAyNDgtMTExIDI0OC0yNDhTMzkzIDggMjU2IDh6bTEyMS42IDMxMy4xYzQuNyA0LjcgNC43IDEyLjMgMCAxN0wzMzggMzc3LjZjLTQuNyA0LjctMTIuMyA0LjctMTcgMEwyNTYgMzEybC02NS4xIDY1LjZjLTQuNyA0LjctMTIuMyA0LjctMTcgMEwxMzQuNCAzMzhjLTQuNy00LjctNC43LTEyLjMgMC0xN2w2NS42LTY1LTY1LjYtNjUuMWMtNC43LTQuNy00LjctMTIuMyAwLTE3bDM5LjYtMzkuNmM0LjctNC43IDEyLjMtNC43IDE3IDBsNjUgNjUuNyA2NS4xLTY1LjZjNC43LTQuNyAxMi4zLTQuNyAxNyAwbDM5LjYgMzkuNmM0LjcgNC43IDQuNyAxMi4zIDAgMTdMMzEyIDI1Nmw2NS42IDY1LjF6Jy8+PC9zdmc+"); } + /* https://github.com/FortAwesome/Font-Awesome-Pro/blob/master/advanced-options/raw-svg/regular/check.svg */ .toast-success { background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHZpZXdCb3g9JzAgMCA1MTIgNTEyJyB3aWR0aD0nNTEyJyBoZWlnaHQ9JzUxMic+PHBhdGggZmlsbD0ncmdiKDI1NSwyNTUsMjU1KScgZD0nTTE3My44OTggNDM5LjQwNGwtMTY2LjQtMTY2LjRjLTkuOTk3LTkuOTk3LTkuOTk3LTI2LjIwNiAwLTM2LjIwNGwzNi4yMDMtMzYuMjA0YzkuOTk3LTkuOTk4IDI2LjIwNy05Ljk5OCAzNi4yMDQgMEwxOTIgMzEyLjY5IDQzMi4wOTUgNzIuNTk2YzkuOTk3LTkuOTk3IDI2LjIwNy05Ljk5NyAzNi4yMDQgMGwzNi4yMDMgMzYuMjA0YzkuOTk3IDkuOTk3IDkuOTk3IDI2LjIwNiAwIDM2LjIwNGwtMjk0LjQgMjk0LjQwMWMtOS45OTggOS45OTctMjYuMjA3IDkuOTk3LTM2LjIwNC0uMDAxeicvPjwvc3ZnPg=="); } + /* https://github.com/FortAwesome/Font-Awesome-Pro/blob/master/advanced-options/raw-svg/regular/exclamation-triangle.svg */ .toast-warning { background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHZpZXdCb3g9JzAgMCA1NzYgNTEyJyB3aWR0aD0nNTc2JyBoZWlnaHQ9JzUxMic+PHBhdGggZmlsbD0ncmdiKDI1NSwyNTUsMjU1KScgZD0nTTU2OS41MTcgNDQwLjAxM0M1ODcuOTc1IDQ3Mi4wMDcgNTY0LjgwNiA1MTIgNTI3Ljk0IDUxMkg0OC4wNTRjLTM2LjkzNyAwLTU5Ljk5OS00MC4wNTUtNDEuNTc3LTcxLjk4N0wyNDYuNDIzIDIzLjk4NWMxOC40NjctMzIuMDA5IDY0LjcyLTMxLjk1MSA4My4xNTQgMGwyMzkuOTQgNDE2LjAyOHpNMjg4IDM1NGMtMjUuNDA1IDAtNDYgMjAuNTk1LTQ2IDQ2czIwLjU5NSA0NiA0NiA0NiA0Ni0yMC41OTUgNDYtNDYtMjAuNTk1LTQ2LTQ2LTQ2em0tNDMuNjczLTE2NS4zNDZsNy40MTggMTM2Yy4zNDcgNi4zNjQgNS42MDkgMTEuMzQ2IDExLjk4MiAxMS4zNDZoNDguNTQ2YzYuMzczIDAgMTEuNjM1LTQuOTgyIDExLjk4Mi0xMS4zNDZsNy40MTgtMTM2Yy4zNzUtNi44NzQtNS4wOTgtMTIuNjU0LTExLjk4Mi0xMi42NTRoLTYzLjM4M2MtNi44ODQgMC0xMi4zNTYgNS43OC0xMS45ODEgMTIuNjU0eicvPjwvc3ZnPg=="); } + .toast-container.toast-top-center .ngx-toastr, .toast-container.toast-bottom-center .ngx-toastr { width: 300px; margin-left: auto; margin-right: auto; } + .toast-container.toast-top-full-width .ngx-toastr, .toast-container.toast-bottom-full-width .ngx-toastr { width: 96%; margin-left: auto; margin-right: auto; } + .ngx-toastr { background-color: #030303; pointer-events: auto; } + .toast-success { background-color: #51A351; } + .toast-error { background-color: #BD362F; } + .toast-info { background-color: #2F96B4; } + .toast-warning { background-color: #F89406; } + .toast-progress { position: absolute; left: 0; @@ -174,27 +204,32 @@ button.toast-close-button { background-color: #000000; opacity: 0.4; } + /* Responsive Design */ @media all and (max-width: 240px) { .toast-container .ngx-toastr.div { padding: 8px 8px 8px 50px; width: 11em; } + .toast-container .toast-close-button { right: -0.2em; top: -0.2em; } } + @media all and (min-width: 241px) and (max-width: 480px) { .toast-container .ngx-toastr.div { padding: 8px 8px 8px 50px; width: 18em; } + .toast-container .toast-close-button { right: -0.2em; top: -0.2em; } } + @media all and (min-width: 481px) and (max-width: 768px) { .toast-container .ngx-toastr.div { padding: 15px 15px 15px 50px;