Browse Source

Model changes to support unsubscribe in api emails.js

master
Zed A. Shaw 2 weeks ago
parent
commit
c386484264
  1. 11
      lib/models.js

11
lib/models.js

@ -81,6 +81,17 @@ export class User extends Model.from_table('user') {
async payments() {
return await this.many_to_many(Payment, "user_payment");
}
async emails(setting) {
// don't change it if it's already set this way
if(this.unsubscribe !== setting) {
return await User.update({id: this.id}, {
unsubscribe: setting, unsubscribed_on: Date.now()
});
} else {
return 1;
}
}
}
export class Module extends Model.from_table('module') {

Loading…
Cancel
Save