Skip to content

Commit

Permalink
[#1135] AdministrationList cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
navins94 committed Feb 6, 2024
1 parent 4c590be commit cfdc454
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 35 deletions.
17 changes: 0 additions & 17 deletions app/src/database/crud/crud-users.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 [];
}
},
};
};

Expand Down
1 change: 0 additions & 1 deletion app/src/database/tables.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export const tables = [
password: 'TEXT',
active: 'TINYINT',
token: 'TEXT',
administrationList: 'TEXT', // TODO: Remove
},
},
{
Expand Down
4 changes: 0 additions & 4 deletions app/src/navigation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import {
UsersPage,
FormDataDetailsPage,
AddNewForm,
ForSelection,
AdministrationList,
AboutPage,
UpdateForm,
} from '../pages';
Expand Down Expand Up @@ -98,8 +96,6 @@ const RootNavigator = () => {
<Stack.Screen name="Users" component={UsersPage} />
<Stack.Screen name="FormDataDetails" component={FormDataDetailsPage} />
<Stack.Screen name="AddNewForm" component={AddNewForm} />
<Stack.Screen name="FormSelection" component={ForSelection} />
<Stack.Screen name="AdministrationList" component={AdministrationList} />
</>
)}
</Stack.Navigator>
Expand Down
2 changes: 0 additions & 2 deletions app/src/pages/AuthForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ const AuthForm = ({ navigation }) => {
active: 1,
token: data?.syncToken,
password: data?.passcode,
administrationList: data.administrationList,
});
UserState.update((s) => {
s.id = newUserId;
Expand Down Expand Up @@ -111,7 +110,6 @@ const AuthForm = ({ navigation }) => {
const userID = await handleActiveUser({
...data,
passcode,
administrationList: JSON.stringify(data.administrations),
});

await handleGetAllForms(data.formsUrl, userID);
Expand Down
10 changes: 1 addition & 9 deletions app/src/pages/Settings.js
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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) => {
Expand All @@ -35,10 +34,6 @@ const Settings = ({ navigation }) => {
navigation.navigate('AddNewForm', {});
};

const goToFormSelection = () => {
navigation.navigate('FormSelection');
};

return (
<BaseLayout title={trans.settingsPageTitle} rightComponent={false}>
<BaseLayout.Content>
Expand Down Expand Up @@ -101,9 +96,6 @@ const Settings = ({ navigation }) => {
initValue={activeLang}
/>
</View>
<View style={styles.buttonContainer}>
<Button title="Sync Datapoint" type="outline" onPress={goToFormSelection} />
</View>
</BaseLayout.Content>
</BaseLayout>
);
Expand Down
2 changes: 0 additions & 2 deletions app/src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,5 @@ export { default as MapViewPage } from './MapView';
export { default as UsersPage } from './Users';
export { default as FormDataDetailsPage } from './FormData/FormDataDetails';
export { default as AddNewForm } from './Settings/AddNewForm';
export { default as ForSelection } from './DataSync/ForSelection';
export { default as AdministrationList } from './DataSync/AdministrationList';
export { default as UpdateForm } from './UpdateForm/UpdateForm';
export { default as AboutPage } from './About/About';

0 comments on commit cfdc454

Please sign in to comment.