2019-01-21 17:32:42 -05:00
|
|
|
import { action, field, children } from '@nozbe/watermelondb/decorators'
|
2019-01-18 12:03:17 -05:00
|
|
|
import { LiquidModel } from '../utils/models'
|
2019-01-17 14:18:09 -05:00
|
|
|
|
2019-01-16 15:50:49 -05:00
|
|
|
|
2019-01-18 16:22:20 -05:00
|
|
|
export default class Profile extends LiquidModel {
|
2019-01-16 15:50:49 -05:00
|
|
|
static table = 'profiles'
|
2019-01-21 17:32:42 -05:00
|
|
|
static associations = {
|
2019-03-19 16:41:23 -04:00
|
|
|
pledges: { type: 'has_many', foreignKey: 'profile_id' },
|
|
|
|
delegates: { type: 'has_many', foreignKey: 'profile_id' }
|
2019-01-21 17:32:42 -05:00
|
|
|
}
|
2019-01-16 15:50:49 -05:00
|
|
|
|
2019-01-17 14:18:09 -05:00
|
|
|
@field('addr') addr
|
2019-01-18 20:51:48 -05:00
|
|
|
@field('event_id') eventId
|
2019-01-17 14:18:09 -05:00
|
|
|
@field('canceled') canceled
|
|
|
|
@field('commit_time') commitTime
|
|
|
|
@field('type') type
|
|
|
|
@field('name') name
|
|
|
|
@field('url') url
|
|
|
|
@field('id_profile') idProfile
|
2019-02-05 13:41:17 -05:00
|
|
|
@field('block_number') blockNumber
|
2019-01-21 17:32:42 -05:00
|
|
|
@children('pledges') pledges
|
2019-03-19 16:41:23 -04:00
|
|
|
@children('delegates') delegates
|
2019-01-18 16:14:33 -05:00
|
|
|
|
|
|
|
@action async markAsCanceled() {
|
|
|
|
await this.update(profile => {
|
|
|
|
profile.canceled = true
|
|
|
|
})
|
|
|
|
}
|
2019-01-17 14:18:09 -05:00
|
|
|
}
|