From f61d9924b8cc5f7e043fc0081c90d508381c7d81 Mon Sep 17 00:00:00 2001 From: Tim Glasgow Date: Sat, 30 Jul 2022 14:42:09 -0500 Subject: [PATCH] Entity renaming --- squarenotsquare/src/realm/entities/Score.js | 2 +- squarenotsquare/src/realm/entities/System.js | 2 +- squarenotsquare/src/realm/entities/User.js | 2 +- squarenotsquare/src/realm/migrations/MigrateV1.js | 4 ++-- squarenotsquare/src/realm/repos/ScoreRepo.js | 2 +- squarenotsquare/src/realm/repos/SystemRepo.js | 8 ++++---- squarenotsquare/src/realm/repos/UserRepo.js | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/squarenotsquare/src/realm/entities/Score.js b/squarenotsquare/src/realm/entities/Score.js index 2c1c055..81425c2 100644 --- a/squarenotsquare/src/realm/entities/Score.js +++ b/squarenotsquare/src/realm/entities/Score.js @@ -1,4 +1,4 @@ -export const Score = { +export const ScoreEntity = { name: 'Score', primaryKey: 'id', properties: { diff --git a/squarenotsquare/src/realm/entities/System.js b/squarenotsquare/src/realm/entities/System.js index 27139d0..48b8773 100644 --- a/squarenotsquare/src/realm/entities/System.js +++ b/squarenotsquare/src/realm/entities/System.js @@ -1,4 +1,4 @@ -export const System = { +export const SystemEntity = { name: 'System', primaryKey: 'id', properties: { diff --git a/squarenotsquare/src/realm/entities/User.js b/squarenotsquare/src/realm/entities/User.js index 003c325..8393ea7 100644 --- a/squarenotsquare/src/realm/entities/User.js +++ b/squarenotsquare/src/realm/entities/User.js @@ -1,4 +1,4 @@ -export const User = { +export const UserEntity = { name: 'User', primaryKey: 'id', properties: { diff --git a/squarenotsquare/src/realm/migrations/MigrateV1.js b/squarenotsquare/src/realm/migrations/MigrateV1.js index a88bc4d..f48dabe 100644 --- a/squarenotsquare/src/realm/migrations/MigrateV1.js +++ b/squarenotsquare/src/realm/migrations/MigrateV1.js @@ -1,10 +1,10 @@ -import {System} from '../entities/System'; +import {SystemEntity} from '../entities/System'; import 'react-native-get-random-values'; import { v4 as uuidv4 } from 'uuid'; export function migratev1(oldRealm, newRealm) { if (oldRealm.schemaVersion === 0) { - newRealm.create(System.name, { + newRealm.create(SystemEntity.name, { id: uuidv4(), key: 'username', value: 'changeme' diff --git a/squarenotsquare/src/realm/repos/ScoreRepo.js b/squarenotsquare/src/realm/repos/ScoreRepo.js index 1932cea..51c89c7 100644 --- a/squarenotsquare/src/realm/repos/ScoreRepo.js +++ b/squarenotsquare/src/realm/repos/ScoreRepo.js @@ -1,4 +1,4 @@ -import {Score} from '../entities/Score'; +import {ScoreEntity} from '../entities/Score'; import 'react-native-get-random-values'; import { v4 as uuidv4 } from 'uuid'; diff --git a/squarenotsquare/src/realm/repos/SystemRepo.js b/squarenotsquare/src/realm/repos/SystemRepo.js index c20a1ff..2c065af 100644 --- a/squarenotsquare/src/realm/repos/SystemRepo.js +++ b/squarenotsquare/src/realm/repos/SystemRepo.js @@ -1,4 +1,4 @@ -import {System} from '../entities/System'; +import {SystemEntity} from '../entities/System'; import 'react-native-get-random-values'; import { v4 as uuidv4 } from 'uuid'; @@ -10,7 +10,7 @@ export default class SystemRepo { } getAllSystemValues = () => { - let system = this.realmDB.objects(System.name); + let system = this.realmDB.objects(SystemEntity.name); let systemValues = {}; system.forEach((row) => { systemValues[row.key] = row.value; @@ -32,7 +32,7 @@ export default class SystemRepo { } this.realmDB.write(() => { this.realmDB.create( - System.name, + SystemEntity.name, { id: sysID, key: sysKey, @@ -53,7 +53,7 @@ export default class SystemRepo { }; 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) { return {id: row[0].id, value: row[0].value}; } else if (row.length > 1) { diff --git a/squarenotsquare/src/realm/repos/UserRepo.js b/squarenotsquare/src/realm/repos/UserRepo.js index dcef5e8..c7b5598 100644 --- a/squarenotsquare/src/realm/repos/UserRepo.js +++ b/squarenotsquare/src/realm/repos/UserRepo.js @@ -1,4 +1,4 @@ -import {User} from '../entities/User'; +import {UserEntity} from '../entities/User'; import 'react-native-get-random-values'; import { v4 as uuidv4 } from 'uuid';