From cfdc454cb3ffc276eb572b2f2ed12f445d589f26 Mon Sep 17 00:00:00 2001 From: navins94 Date: Tue, 6 Feb 2024 14:03:45 +0530 Subject: [PATCH] [#1135] AdministrationList cleanup --- app/src/database/crud/crud-users.js | 17 ----------------- app/src/database/tables.js | 1 - app/src/navigation/index.js | 4 ---- app/src/pages/AuthForm.js | 2 -- app/src/pages/Settings.js | 10 +--------- app/src/pages/index.js | 2 -- 6 files changed, 1 insertion(+), 35 deletions(-) diff --git a/app/src/database/crud/crud-users.js b/app/src/database/crud/crud-users.js index ec9153766..f4bdaaa51 100644 --- a/app/src/database/crud/crud-users.js +++ b/app/src/database/crud/crud-users.js @@ -45,23 +45,6 @@ const usersQuery = () => { const { rows } = await conn.tx(db, query.read('users', { password: passcode }), [passcode]); return rows; }, - getUserAdministrationListChunk: async (userId, start, end) => { - try { - const sqlQuery = 'SELECT administrationList FROM users WHERE id = ?'; - const { rows } = await conn.tx(db, sqlQuery, [userId]); - - if (!rows.length || !rows._array[0].administrationList) { - return []; - } - - const fullList = JSON.parse(rows._array[0].administrationList); - const chunk = fullList.slice(start, end); - return chunk; - } catch (error) { - console.error('Get user administration list chunk:', error); - return []; - } - }, }; }; diff --git a/app/src/database/tables.js b/app/src/database/tables.js index b1450c91b..c03084f4d 100644 --- a/app/src/database/tables.js +++ b/app/src/database/tables.js @@ -7,7 +7,6 @@ export const tables = [ password: 'TEXT', active: 'TINYINT', token: 'TEXT', - administrationList: 'TEXT', // TODO: Remove }, }, { diff --git a/app/src/navigation/index.js b/app/src/navigation/index.js index b9c53fbc3..e97b6f8bf 100644 --- a/app/src/navigation/index.js +++ b/app/src/navigation/index.js @@ -16,8 +16,6 @@ import { UsersPage, FormDataDetailsPage, AddNewForm, - ForSelection, - AdministrationList, AboutPage, UpdateForm, } from '../pages'; @@ -98,8 +96,6 @@ const RootNavigator = () => { - - )} diff --git a/app/src/pages/AuthForm.js b/app/src/pages/AuthForm.js index 16ba39b1c..6c36470d7 100644 --- a/app/src/pages/AuthForm.js +++ b/app/src/pages/AuthForm.js @@ -47,7 +47,6 @@ const AuthForm = ({ navigation }) => { active: 1, token: data?.syncToken, password: data?.passcode, - administrationList: data.administrationList, }); UserState.update((s) => { s.id = newUserId; @@ -111,7 +110,6 @@ const AuthForm = ({ navigation }) => { const userID = await handleActiveUser({ ...data, passcode, - administrationList: JSON.stringify(data.administrations), }); await handleGetAllForms(data.formsUrl, userID); diff --git a/app/src/pages/Settings.js b/app/src/pages/Settings.js index e215790ec..57b2163a1 100644 --- a/app/src/pages/Settings.js +++ b/app/src/pages/Settings.js @@ -1,6 +1,6 @@ import React, { useState } from 'react'; import { View, StyleSheet } from 'react-native'; -import { ListItem, Divider, Button } from '@rneui/themed'; +import { ListItem, Divider } from '@rneui/themed'; import { BaseLayout, LogoutButton } from '../components'; import DialogForm from './Settings/DialogForm'; @@ -13,7 +13,6 @@ const Settings = ({ navigation }) => { const activeLang = UIState.useState((s) => s.lang); const trans = i18n.text(activeLang); const nonEnglish = activeLang !== 'en'; - const activeLangText = langConfig.options.find((o) => o.value === activeLang); const authenticationType = BuildParamsState.useState((s) => s.authenticationType); const handleSaveLang = (value) => { @@ -35,10 +34,6 @@ const Settings = ({ navigation }) => { navigation.navigate('AddNewForm', {}); }; - const goToFormSelection = () => { - navigation.navigate('FormSelection'); - }; - return ( @@ -101,9 +96,6 @@ const Settings = ({ navigation }) => { initValue={activeLang} /> - -