allfree-angular-frontend / src / app / models / models.ts
models.ts
Raw
export class User {
  constructor(
    public id: number,
    public firstName: string,
    public lastName: string,
    public email: string,
    public username: string,
    public password: string,
    public roles: Array<Role>,
    public articles: Array<Article>,
    public favArticles: Array<Article>
  ) {}
}
export class Test {
  public url: string;
}

// export interface User {
//   id: number;
//   firstname: string;
//   lastname: string;
//   email: string;
//   username: string;
//   password: string;
//   roles: Array<Role>;
//   articles: Array<Article>;
//   favArticles: Array<Article>;
// }

export class Role {
  public name: string;
  constructor(name: string) {
    this.name = name;
  }
}

export interface UserLogged {
  id: number;
  username: string;
  firstName: string;
  lastName: string;
  email: string;
  roles: Array<Role>;
}

export interface APIResponse<T> {
  results: Array<T>;
}

export interface Article {
  id: number;
  title: string;
  description: string;
  location: string;
  email: string;
  phone: string;
  photos: string;
}

export class Article {
  public id: number;
  public title: string;
  public description: string;
  public location: string;
  public email: string;
  public phone: string;
  public photos: string;
  public status: string;

  constructor(
    title: string,
    description: string,
    location: string,
    email: string,
    phone: string,
    photos: string
  ) {
    this.title = title;
    this.description = description;
    this.location = location;
    this.email = email;
    this.phone = phone;
    this.photos = photos;
  }
}

export class NewArticleDTO {
  constructor(public userId: number, public userArticles: Array<Article>) {}
}