mirror of
https://github.com/Raghu-Ch/angular-challenges.git
synced 2026-02-13 14:23:02 -05:00
feat(challenge7): reorganisation
This commit is contained in:
37
libs/ngrx-notification/model/src/lib/teacher.model.ts
Normal file
37
libs/ngrx-notification/model/src/lib/teacher.model.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import {
|
||||
incrementalNumber,
|
||||
rand,
|
||||
randFirstName,
|
||||
randLastName,
|
||||
} from '@ngneat/falso';
|
||||
import { Push } from './push.model';
|
||||
|
||||
export const subject = [
|
||||
'Sciences',
|
||||
'History',
|
||||
'English',
|
||||
'Maths',
|
||||
'Sport',
|
||||
] as const;
|
||||
export type Subject = typeof subject[number];
|
||||
|
||||
export interface Teacher extends Push {
|
||||
id: number;
|
||||
firstname: string;
|
||||
lastname: string;
|
||||
subject: Subject;
|
||||
}
|
||||
|
||||
const factoryTeacher = incrementalNumber();
|
||||
|
||||
export const randTeacher = (): Teacher => ({
|
||||
id: factoryTeacher(),
|
||||
firstname: randFirstName(),
|
||||
lastname: randLastName(),
|
||||
subject: rand(subject),
|
||||
type: 'teacher',
|
||||
});
|
||||
|
||||
export const isTeacher = (notif: Push): notif is Teacher => {
|
||||
return notif.type === 'teacher';
|
||||
};
|
||||
Reference in New Issue
Block a user