add Profiles model to database
This commit is contained in:
parent
5b086ab1e8
commit
8c71a9a945
|
@ -18,11 +18,11 @@ export const batchAddProfiles = async profiles => {
|
|||
const { addr, canceled, commitTime, type, name, url, idProfile } = data
|
||||
profile.addr = addr
|
||||
profile.canceled = canceled
|
||||
profile.commitTime = commitTime
|
||||
profile.commitTime = Number(commitTime)
|
||||
profile.type = type
|
||||
profile.name = name
|
||||
profile.url = url
|
||||
profile.idProfile = idProfile
|
||||
profile.idProfile = Number(idProfile)
|
||||
})
|
||||
})
|
||||
console.log({batch})
|
||||
|
|
|
@ -3,6 +3,7 @@ import LokiJSAdapter from '@nozbe/watermelondb/adapters/lokijs'
|
|||
|
||||
import schema from './model/schema'
|
||||
import LpEvent from './model/lpEvents'
|
||||
import Profiles from './model/profiles'
|
||||
|
||||
const adapter = new LokiJSAdapter({
|
||||
schema,
|
||||
|
@ -11,7 +12,8 @@ const adapter = new LokiJSAdapter({
|
|||
const database = new Database({
|
||||
adapter,
|
||||
modelClasses: [
|
||||
LpEvent
|
||||
LpEvent,
|
||||
Profiles
|
||||
],
|
||||
actionsEnabled: true,
|
||||
})
|
||||
|
|
|
@ -1,20 +1,17 @@
|
|||
import { Model } from '@nozbe/watermelondb'
|
||||
import { fieldGenerator } from '../utils/db'
|
||||
import { field } from '@nozbe/watermelondb/decorators'
|
||||
|
||||
|
||||
export default class Profiles extends Model {
|
||||
constructor(...args) {
|
||||
super(...args)
|
||||
const field = fieldGenerator(this)
|
||||
field('addr')
|
||||
field('canceled')
|
||||
field('commit_time', 'commitTime')
|
||||
field('type')
|
||||
field('name')
|
||||
field('url')
|
||||
field('id_profile', 'idProfile')
|
||||
}
|
||||
|
||||
static table = 'profiles'
|
||||
|
||||
}
|
||||
@field('addr') addr
|
||||
@field('canceled') canceled
|
||||
@field('commit_time') commitTime
|
||||
@field('type') type
|
||||
@field('name') name
|
||||
@field('url') url
|
||||
@field('id_profile') idProfile
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue