liquid-funding/app/model/profile.js

30 lines
784 B
JavaScript
Raw Normal View History

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'
static associations = {
pledges: { type: 'has_many', foreignKey: 'profile_id' },
delegates: { type: 'has_many', foreignKey: 'profile_id' }
}
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
@children('pledges') pledges
@children('delegates') delegates
@action async markAsCanceled() {
await this.update(profile => {
profile.canceled = true
})
}
2019-01-17 14:18:09 -05:00
}