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