Skip to content

Commit

Permalink
Adds base model for attributes getter
Browse files Browse the repository at this point in the history
  • Loading branch information
coconutcraig committed Nov 17, 2018
1 parent ab22aca commit b7320a2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/models/answer.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { AnswerModel } from '../types/models';
import { AnswerParameters } from '../types/parameters';
import Model from './model';

export default class Answer implements AnswerModel {
export default class Answer extends Model implements AnswerModel {
protected attributes: AnswerParameters;

constructor() {
super();

this.attributes = {
question: null,
value: null,
Expand Down
11 changes: 11 additions & 0 deletions src/models/model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default class Model {
protected attributes: object;

constructor() {
this.attributes = {};
}

public getAttributes() {
return this.attributes;
}
}
5 changes: 4 additions & 1 deletion src/models/preference.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { PreferenceModel } from '../types/models';
import { PreferenceParameters } from '../types/parameters';
import Model from './model';

const NEXT_AVAILABLE = 1;
const CERTAIN_DAYS = 2;

export default class Preference implements PreferenceModel {
export default class Preference extends Model implements PreferenceModel {
protected attributes: PreferenceParameters;

constructor() {
super();

this.attributes = {
day: null,
end: null,
Expand Down

0 comments on commit b7320a2

Please sign in to comment.