|
@ -1,4 +1,4 @@ |
|
|
import {System} from '../entities/System'; |
|
|
import {SystemEntity} from '../entities/System'; |
|
|
import 'react-native-get-random-values'; |
|
|
import 'react-native-get-random-values'; |
|
|
import { v4 as uuidv4 } from 'uuid'; |
|
|
import { v4 as uuidv4 } from 'uuid'; |
|
|
|
|
|
|
|
@ -10,7 +10,7 @@ export default class SystemRepo { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
getAllSystemValues = () => { |
|
|
getAllSystemValues = () => { |
|
|
let system = this.realmDB.objects(System.name); |
|
|
let system = this.realmDB.objects(SystemEntity.name); |
|
|
let systemValues = {}; |
|
|
let systemValues = {}; |
|
|
system.forEach((row) => { |
|
|
system.forEach((row) => { |
|
|
systemValues[row.key] = row.value; |
|
|
systemValues[row.key] = row.value; |
|
@ -32,7 +32,7 @@ export default class SystemRepo { |
|
|
} |
|
|
} |
|
|
this.realmDB.write(() => { |
|
|
this.realmDB.write(() => { |
|
|
this.realmDB.create( |
|
|
this.realmDB.create( |
|
|
System.name, |
|
|
SystemEntity.name, |
|
|
{ |
|
|
{ |
|
|
id: sysID, |
|
|
id: sysID, |
|
|
key: sysKey, |
|
|
key: sysKey, |
|
@ -53,7 +53,7 @@ export default class SystemRepo { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
getSystemKeyValue = (key) => { |
|
|
getSystemKeyValue = (key) => { |
|
|
let row = this.realmDB.objects(System.name).filtered('key = $0', key); |
|
|
let row = this.realmDB.objects(SystemEntity.name).filtered('key = $0', key); |
|
|
if (row.length === 1) { |
|
|
if (row.length === 1) { |
|
|
return {id: row[0].id, value: row[0].value}; |
|
|
return {id: row[0].id, value: row[0].value}; |
|
|
} else if (row.length > 1) { |
|
|
} else if (row.length > 1) { |
|
|