Skip to content

Commit

Permalink
fix: some model props incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
imorland committed Jan 30, 2024
1 parent 1857a44 commit ee37ee6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions js/src/forum/models/Poll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ export default class Poll extends Model {
}

options() {
return Model.hasMany<PollOption>('options');
return Model.hasMany<PollOption>('options').call(this);
}

votes() {
return Model.hasMany<PollVote>('votes');
return Model.hasMany<PollVote>('votes').call(this);
}

myVotes() {
return Model.hasMany<PollVote>('myVotes');
return Model.hasMany<PollVote>('myVotes').call(this);
}

apiEndpoint() {
Expand Down
2 changes: 1 addition & 1 deletion js/src/forum/models/PollOption.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default class PollOption extends Model {
return Model.attribute<string>('imageUrl').call(this);
}

vouteCount() {
voteCount() {
return Model.attribute<number>('voteCount').call(this);
}

Expand Down
10 changes: 5 additions & 5 deletions js/src/forum/models/PollVote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ import User from 'flarum/common/models/User';

export default class PollVote extends Model {
poll() {
return Model.hasOne<Poll>('poll');
return Model.hasOne<Poll>('poll').call(this);
}

option() {
return Model.hasOne<PollOption>('option');
return Model.hasOne<PollOption>('option').call(this);
}

user() {
return Model.hasOne<User>('user');
return Model.hasOne<User>('user').call(this);
}

pollId() {
return Model.attribute<number>('pollId');
return Model.attribute<number>('pollId').call(this);
}

optionId() {
return Model.attribute<number>('optionId');
return Model.attribute<number>('optionId').call(this);
}

apiEndpoint() {
Expand Down

0 comments on commit ee37ee6

Please sign in to comment.