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