Re add model
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
01de765939
commit
9dc8a5be16
@ -0,0 +1,15 @@
|
||||
export default class Artist {
|
||||
private id: string;
|
||||
private name: string;
|
||||
private _url: string;
|
||||
|
||||
constructor(id: string, name: string, url: string) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this._url = url;
|
||||
}
|
||||
|
||||
get url(): string {
|
||||
return this.url;
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
export default class Music {
|
||||
private _id: string;
|
||||
private _title: string;
|
||||
private _bio: string;
|
||||
private _image: string;
|
||||
private _trackPreviewUrl: string;
|
||||
|
||||
constructor(id: string, title: string, bio: string, image: string, trackPreviewUrl: string) {
|
||||
this._title = title;
|
||||
this._bio = bio;
|
||||
this._image = image;
|
||||
this._id = id;
|
||||
this._trackPreviewUrl = trackPreviewUrl;
|
||||
}
|
||||
|
||||
get id(): string {
|
||||
return this._id;
|
||||
}
|
||||
|
||||
set id(value: string) {
|
||||
this._id = value;
|
||||
}
|
||||
|
||||
get title(): string {
|
||||
return this._title;
|
||||
}
|
||||
|
||||
set title(value: string) {
|
||||
this._title = value;
|
||||
}
|
||||
|
||||
get bio(): string {
|
||||
return this._bio;
|
||||
}
|
||||
|
||||
set bio(value: string) {
|
||||
this._bio = value;
|
||||
}
|
||||
|
||||
get image(): string {
|
||||
return this._image;
|
||||
}
|
||||
|
||||
set image(value: string) {
|
||||
this._image = value;
|
||||
}
|
||||
|
||||
get trackPreviewUrl(): string {
|
||||
return this._trackPreviewUrl;
|
||||
}
|
||||
|
||||
set trackPreviewUrl(value: string) {
|
||||
this._trackPreviewUrl = value;
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
import Music from "./Music";
|
||||
|
||||
export class Spot {
|
||||
private _userId: string;
|
||||
private _music: Music;
|
||||
|
||||
constructor(userId: string, music: Music) {
|
||||
this._userId = userId;
|
||||
this._music = music;
|
||||
}
|
||||
|
||||
get userSpotifyId(): string {
|
||||
return this._userId;
|
||||
}
|
||||
|
||||
set userSpotifyId(value: string) {
|
||||
this._userId = value;
|
||||
}
|
||||
|
||||
get music(): Music {
|
||||
return this._music;
|
||||
}
|
||||
|
||||
set music(value: Music) {
|
||||
this._music = value;
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
export class User {
|
||||
private _idFlad: string;
|
||||
private _idSpotify: string;
|
||||
private _email: string;
|
||||
private _createdAt: Date;
|
||||
private _name: string;
|
||||
public image: string;
|
||||
|
||||
constructor(idFlad: string, idSpotify: string, email: string, createdAt: Date, name: string, image: string) {
|
||||
this._name = name;
|
||||
this._idFlad = idFlad;
|
||||
this._idSpotify = idSpotify;
|
||||
this._createdAt = createdAt;
|
||||
this._email = email;
|
||||
this.image = image;
|
||||
}
|
||||
|
||||
get idFlad(): string {
|
||||
return this._idFlad;
|
||||
}
|
||||
get idSpotify(): string {
|
||||
return this._idSpotify;
|
||||
}
|
||||
get email(): string {
|
||||
return this._email;
|
||||
}
|
||||
get createAt(): Date {
|
||||
return this._createdAt;
|
||||
}
|
||||
get name(): string {
|
||||
return this._name;
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
import Music from "../Music";
|
||||
|
||||
export default class MusicMapper {
|
||||
static toModel(music: any): Music {
|
||||
return new Music(
|
||||
music.id,
|
||||
music.name,
|
||||
music.artists[0].name,
|
||||
music.album.images[0].url,
|
||||
music.preview_url
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
import { User } from "../User";
|
||||
|
||||
export class UserMapper {
|
||||
|
||||
public static toModel(user: any): User {
|
||||
return new User(user.idFlad, user.idSpotify, user.email, user.createdAt, user.name, user.imageUrl);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue