Add constructors and accessors to models

This commit is contained in:
Phillip Kühne 2020-03-26 02:43:51 +01:00
parent 869166f818
commit c0c6fb8b06
4 changed files with 41 additions and 5 deletions

View File

@ -1,4 +1,10 @@
export class Artist {
constructor(id: number, name: string) {
this.id = id;
this.name = name;
}
id: number;
name: string;
}

View File

@ -1,4 +1,16 @@
export class Genre {
id: number;
name: string;
constructor(id: number, name: string) {
this.id = id;
this._name = name;
}
public get name() : string {
return this._name;
}
id: number;
_name: string;
}

View File

@ -1,4 +1,10 @@
export class Language {
constructor(id: number, name: string) {
this.id = id;
this.name = name;
}
id: number;
name: string;
}

View File

@ -3,12 +3,24 @@ import { Language } from './language.model';
import { Artist } from './artist.model';
export class Song {
explicit: boolean;
duet: boolean;
constructor(title: string, artist: Artist, karafun_id: number, duet: boolean, explicit: boolean, id: number, genres: Array<Genre>, languages: Array<Language>) {
this.title=title;
this.artist=artist;
this.karafun_id=karafun_id;
this.duet=duet;
this.explicit=explicit;
this.id=id;
this.genres=genres;
this.languages=languages;
}
title: string;
id: number;
artist: Artist;
karafun_id: number;
duet: boolean;
explicit: boolean;
id: number;
genres: Array<Genre>;
languages: Array<Language>;
artist: Artist;
}