Task.js 613 Bytes
Newer Older
Alexander Bazo committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
/* eslint-env node */

const schema = require("@colyseus/schema"),
  Schema = schema.Schema;

var taskCounter = 0;

class Task extends Schema {

  constructor(imageUrl, taskDescription, taskSource, duration) {
    super();
    taskCounter++;
    this.imageUrl = imageUrl;
    this.taskDescription = taskDescription;
    this.taskSource = taskSource;
    this.duration = duration;
    this.position = taskCounter;
  }
}

schema.defineTypes(Task, {
  imageUrl: "string",
  taskDescription: "string",
  taskSource: "string",
  duration: "number",
  height: "number",
  position: "number",
});

module.exports = Task;