refactor: change the internal interface to the model interface

This commit is contained in:
Polianin Nikita 2024-02-17 12:16:11 +03:00
parent 94ca6c66ea
commit 8879c7f530

View File

@ -5,12 +5,7 @@ import {MatAutocompleteModule, MatAutocompleteSelectedEvent} from "@angular/mate
import {AsyncPipe} from "@angular/common"; import {AsyncPipe} from "@angular/common";
import {DataSpinnerComponent} from "@component/data-spinner/data-spinner.component"; import {DataSpinnerComponent} from "@component/data-spinner/data-spinner.component";
import {map, Observable, startWith} from "rxjs"; import {map, Observable, startWith} from "rxjs";
import {ProfessorResponse} from "@model/professorResponse";
export interface Professors {
id: number,
name: string
}
@Component({ @Component({
selector: 'app-schedule-tabs-professor', selector: 'app-schedule-tabs-professor',
@ -28,9 +23,9 @@ export interface Professors {
}) })
export class ScheduleTabsProfessorComponent implements OnInit { export class ScheduleTabsProfessorComponent implements OnInit {
protected teacherControl = new FormControl(); protected teacherControl = new FormControl();
protected filteredTeachers!: Observable<Professors[]>; protected filteredTeachers!: Observable<ProfessorResponse[]>;
@Input() teachers: Professors[] = []; @Input() teachers: ProfessorResponse[] = [];
@Output() professorSelected = new EventEmitter<number>(); @Output() professorSelected = new EventEmitter<number>();
ngOnInit(): void { ngOnInit(): void {
@ -40,7 +35,7 @@ export class ScheduleTabsProfessorComponent implements OnInit {
); );
} }
private _filterTeachers(value: string | number): Professors[] { private _filterTeachers(value: string | number): ProfessorResponse[] {
if (typeof value === 'string') { if (typeof value === 'string') {
if (value === '') return []; if (value === '') return [];
const filterValue = value.toLowerCase(); const filterValue = value.toLowerCase();