All files / src/models article.ts

100% Statements 4/4
42.85% Branches 3/7
100% Functions 1/1
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24                                4x   4x 4x 4x      
import { Model } from './model';
import { Game } from './game';
import { Namespace } from './namespace';
 
export class Article extends Model {
  public body: string;
  public caption: string;
  public game: Game;
  public gameId: string;
  public namespace: Namespace;
  public namespaceId: string;
  public publishedAt: Date;
  public title: string;
  public type: string;
 
  constructor(params: Partial<Article> = {}) {
    super(params);
 
    this.game = this.game ? new Game(this.game) : null;
    this.namespace = this.namespace ? new Namespace(this.namespace) : null;
    this.publishedAt = params.publishedAt ? new Date(params.publishedAt) : null;
  }
}