Chalarangelo/30-seconds-of-code

View on GitHub
src/models/language.js

Summary

Maintainability
A
0 mins
Test Coverage
import Model from '#src/core/model.js';
import Snippet from '#src/models/snippet.js';

export default class Language extends Model {
  static {
    Model.prepare(this, ['id']);
  }

  constructor(data) {
    super(data);
    this.id = data.id;
    this.long = data.long;
    this.short = data.short;
    this.name = data.name;
  }

  get snippets() {
    return Snippet.where({ languageId: this.id });
  }
}