diff --git a/src/common/data/sql/db_m_001.ts b/src/common/data/sql/db_m_001.ts deleted file mode 100644 index a5a5a6c..0000000 --- a/src/common/data/sql/db_m_001.ts +++ /dev/null @@ -1 +0,0 @@ -export const ALTER_TABLE_EVENT_TYPE_GEOMETRY = 'ALTER TABLE main.event_type ADD COLUMN geometry_type TEXT'; diff --git a/src/common/data/sql/db_m_002.ts b/src/common/data/sql/db_m_002.ts deleted file mode 100644 index 13a52d3..0000000 --- a/src/common/data/sql/db_m_002.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const ALTER_TABLE_ACCOUNT_USER_REPORTED_BY = 'ALTER TABLE main.accounts_user ADD COLUMN reported_by_id TEXT'; -export const ALTER_TABLE_ACCOUNT_USER_CONTENT_TYPE = 'ALTER TABLE main.accounts_user ADD COLUMN content_type TEXT'; diff --git a/src/common/data/sql/db_m_003.ts b/src/common/data/sql/db_m_003.ts deleted file mode 100644 index 607a081..0000000 --- a/src/common/data/sql/db_m_003.ts +++ /dev/null @@ -1 +0,0 @@ -export const ALTER_TABLE_EVENTS_GEOMETRY = 'ALTER TABLE main.events ADD COLUMN geometry TEXT'; diff --git a/src/common/data/sql/db_m_004.ts b/src/common/data/sql/db_m_004.ts deleted file mode 100644 index 061d71b..0000000 --- a/src/common/data/sql/db_m_004.ts +++ /dev/null @@ -1,20 +0,0 @@ -export const DROP_TABLE_EVENT_TYPE_TEMP = 'DROP TABLE IF EXISTS event_type_temp'; - -export const TABLE_EVENT_TYPE_TEMP = `CREATE TABLE IF NOT EXISTS event_type_temp( - id INTEGER PRIMARY KEY AUTOINCREMENT, - remote_id TEXT UNIQUE, - account_id INTEGER, - value TEXT, - display TEXT, - schema TEXT, - category_id TEXT, - default_priority INTEGER, - icon TEXT, - icon_svg TEXT, - geometry_type TEXT)`; - -export const INSERT_TABLE_EVENT_TYPE_TEMP = 'INSERT INTO event_type_temp (id, remote_id, account_id, value, display, schema, category_id, default_priority, icon, icon_svg, geometry_type) SELECT id, remote_id, account_id, value, display, schema, category_id, default_priority, icon, icon_svg, geometry_type FROM event_type;'; - -export const DROP_TABLE_EVENT_TYPE = 'DROP TABLE IF EXISTS event_type'; - -export const ALTER_TABLE_EVENT_TYPE = 'ALTER TABLE event_type_temp RENAME TO event_type'; diff --git a/src/common/data/sql/db_m_005.ts b/src/common/data/sql/db_m_005.ts deleted file mode 100644 index a742dc8..0000000 --- a/src/common/data/sql/db_m_005.ts +++ /dev/null @@ -1,15 +0,0 @@ -export const DROP_TABLE_EVENT_CATEGORY_TEMP = 'DROP TABLE IF EXISTS event_category_temp'; - -export const TABLE_EVENT_CATEGORY_TEMP = `CREATE TABLE IF NOT EXISTS event_category_temp( - id INTEGER PRIMARY KEY AUTOINCREMENT, - remote_id TEXT UNIQUE, - account_id INTEGER, - value TEXT, - display TEXT, - ordernum INTEGER)`; - -export const INSERT_TABLE_EVENT_CATEGORY_TEMP = 'INSERT INTO event_category_temp (id, remote_id, account_id, value, display, ordernum) SELECT id, remote_id, account_id, value, display, ordernum FROM event_category;'; - -export const DROP_TABLE_EVENT_CATEGORY = 'DROP TABLE IF EXISTS event_category'; - -export const ALTER_TABLE_EVENT_CATEGORY = 'ALTER TABLE event_category_temp RENAME TO event_category'; diff --git a/src/common/data/sql/db_m_006.ts b/src/common/data/sql/db_m_006.ts deleted file mode 100644 index effaef2..0000000 --- a/src/common/data/sql/db_m_006.ts +++ /dev/null @@ -1,6 +0,0 @@ -export const M_TABLE_SYNC_STATES = `CREATE TABLE IF NOT EXISTS sync_states( - id INTEGER PRIMARY KEY AUTOINCREMENT, - account_id INTEGER, - resource TEXT, - scope TEXT, - state TEXT)`; diff --git a/src/common/data/sql/db_m_007.ts b/src/common/data/sql/db_m_007.ts deleted file mode 100644 index 97cbadc..0000000 --- a/src/common/data/sql/db_m_007.ts +++ /dev/null @@ -1,10 +0,0 @@ -export const M_TABLE_PATROL_TYPES = `CREATE TABLE IF NOT EXISTS patrol_types ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - remote_id TEXT, - account_id INTEGER, - value TEXT, - display TEXT, - icon TEXT, - icon_svg TEXT, - default_priority INTEGER, - is_active INTEGER)`; diff --git a/src/common/data/sql/db_m_008.ts b/src/common/data/sql/db_m_008.ts deleted file mode 100644 index 24ed97f..0000000 --- a/src/common/data/sql/db_m_008.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const DROP_INDEX_PATROL_TYPES_IDX = 'DROP INDEX IF EXISTS patrol_types_id_idx'; -export const ADD_INDEX_PATROL_TYPES_IDX = 'CREATE UNIQUE INDEX IF NOT EXISTS patrol_types_id_idx ON patrol_types (remote_id)'; diff --git a/src/common/data/sql/db_m_009.ts b/src/common/data/sql/db_m_009.ts deleted file mode 100644 index 6845356..0000000 --- a/src/common/data/sql/db_m_009.ts +++ /dev/null @@ -1 +0,0 @@ -export const DROP_TABLE_CHOICES = 'DROP TABLE IF EXISTS choices'; diff --git a/src/common/data/sql/db_m_010.ts b/src/common/data/sql/db_m_010.ts deleted file mode 100644 index c3146f5..0000000 --- a/src/common/data/sql/db_m_010.ts +++ /dev/null @@ -1,19 +0,0 @@ -export const M_TABLE_PATROLS = `CREATE TABLE IF NOT EXISTS patrols ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - remote_id TEXT, - title TEXT, - priority TEXT, - state TEXT, - created_at REAL, - updated_at REAL)`; -export const M_TABLE_PATROL_SEGMENTS = `CREATE TABLE IF NOT EXISTS patrol_segments ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - remote_id TEXT, - patrol_id INTEGER, - patrol_type_id INTEGER, - start_latitude REAL, - start_longitude REAL, - stop_latitude REAL, - stop_longitude REAL, - start_time REAL, - end_time REAL)`; diff --git a/src/common/data/sql/db_m_011.ts b/src/common/data/sql/db_m_011.ts deleted file mode 100644 index a093114..0000000 --- a/src/common/data/sql/db_m_011.ts +++ /dev/null @@ -1 +0,0 @@ -export const ALTER_TABLE_ACCOUNT_USER_SUBJECT_ID = 'ALTER TABLE main.accounts_user ADD COLUMN subject_id TEXT'; diff --git a/src/common/data/sql/db_m_012.ts b/src/common/data/sql/db_m_012.ts deleted file mode 100644 index b274757..0000000 --- a/src/common/data/sql/db_m_012.ts +++ /dev/null @@ -1 +0,0 @@ -export const ALTER_TABLE_ACCOUNT_USER_ACCEPTED_EULA = 'ALTER TABLE main.accounts_user ADD COLUMN accepted_eula INTEGER'; diff --git a/src/common/data/sql/db_m_013.ts b/src/common/data/sql/db_m_013.ts deleted file mode 100644 index 004b712..0000000 --- a/src/common/data/sql/db_m_013.ts +++ /dev/null @@ -1,8 +0,0 @@ -export const M_TABLE_USER_PROFILES = `CREATE TABLE IF NOT EXISTS user_profiles ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - remote_id TEXT, - account_id INTEGER, - username TEXT, - reported_by_id TEXT, - content_type TEXT, - subject_id TEXT)`; diff --git a/src/common/data/sql/db_m_014.ts b/src/common/data/sql/db_m_014.ts deleted file mode 100644 index 0335cff..0000000 --- a/src/common/data/sql/db_m_014.ts +++ /dev/null @@ -1 +0,0 @@ -export const ALTER_TABLE_EVENTS_PATROL_SEGMENT_ID = 'ALTER TABLE main.events ADD COLUMN patrol_segment_id INTEGER'; diff --git a/src/common/data/sql/db_m_015.ts b/src/common/data/sql/db_m_015.ts deleted file mode 100644 index 0931f65..0000000 --- a/src/common/data/sql/db_m_015.ts +++ /dev/null @@ -1 +0,0 @@ -export const ALTER_TABLE_USER_PROFILE_PIN = 'ALTER TABLE main.user_profiles ADD COLUMN pin TEXT'; diff --git a/src/common/data/sql/db_m_016.ts b/src/common/data/sql/db_m_016.ts deleted file mode 100644 index 0753fc9..0000000 --- a/src/common/data/sql/db_m_016.ts +++ /dev/null @@ -1,5 +0,0 @@ -export const ALTER_TABLE_EVENT_CATEGORY_PROFILE_ID = 'ALTER TABLE main.event_category ADD COLUMN profile_id TEXT'; -export const ALTER_TABLE_EVENT_TYPE_PROFILE_ID = 'ALTER TABLE main.event_type ADD COLUMN profile_id TEXT'; -export const ALTER_TABLE_EVENTS_PROFILE_ID = 'ALTER TABLE main.events ADD COLUMN profile_id TEXT'; -export const ALTER_TABLE_ATTACHMENTS_PROFILE_ID = 'ALTER TABLE main.attachments ADD COLUMN profile_id TEXT'; -export const ALTER_TABLE_PATROL_TYPES_PROFILE_ID = 'ALTER TABLE main.patrol_types ADD COLUMN profile_id TEXT'; diff --git a/src/common/data/sql/db_m_017.ts b/src/common/data/sql/db_m_017.ts deleted file mode 100644 index fc0f0ba..0000000 --- a/src/common/data/sql/db_m_017.ts +++ /dev/null @@ -1 +0,0 @@ -export const ALTER_TABLE_ACCOUNTS_USER_PIN = 'ALTER TABLE main.accounts_user ADD COLUMN pin TEXT'; diff --git a/src/common/data/sql/db_m_018.ts b/src/common/data/sql/db_m_018.ts deleted file mode 100644 index 6666feb..0000000 --- a/src/common/data/sql/db_m_018.ts +++ /dev/null @@ -1,6 +0,0 @@ -export const M_TABLE_USER_SUBJECTS = `CREATE TABLE IF NOT EXISTS user_subjects ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - remote_id TEXT, - account_id INTEGER, - name TEXT, - content_type TEXT)`; diff --git a/src/common/data/sql/db_m_019.ts b/src/common/data/sql/db_m_019.ts deleted file mode 100644 index 5d0675c..0000000 --- a/src/common/data/sql/db_m_019.ts +++ /dev/null @@ -1 +0,0 @@ -export const ALTER_TABLE_PATROL_TYPE_ORDERNUM = 'ALTER TABLE main.patrol_types ADD COLUMN ordernum INTEGER'; diff --git a/src/common/data/sql/db_m_020.ts b/src/common/data/sql/db_m_020.ts deleted file mode 100644 index ad9caa5..0000000 --- a/src/common/data/sql/db_m_020.ts +++ /dev/null @@ -1,38 +0,0 @@ -// accounts_user -export const DROP_TABLE_ACCOUNTS_USER_TEMP = 'DROP TABLE IF EXISTS accounts_user_temp'; - -export const TABLE_ACCOUNTS_USER_TEMP = `CREATE TABLE IF NOT EXISTS accounts_user_temp( - id INTEGER PRIMARY KEY AUTOINCREMENT, - remote_id TEXT, - username TEXT, - first_name TEXT, - last_name TEXT, - email TEXT, - content_type TEXT, - subject_id TEXT, - accepted_eula INTEGER, - pin TEXT)`; - -export const INSERT_TABLE_ACCOUNTS_USER_TEMP = 'INSERT INTO accounts_user_temp (id, remote_id, username, first_name, last_name, email, content_type, subject_id, accepted_eula, pin) SELECT id, remote_id, username, first_name, last_name, email, content_type, subject_id, accepted_eula, pin FROM accounts_user;'; - -export const DROP_TABLE_ACCOUNTS_USER = 'DROP TABLE IF EXISTS accounts_user'; - -export const ALTER_TABLE_ACCOUNTS_USER = 'ALTER TABLE accounts_user_temp RENAME TO accounts_user'; - -// user_profiles -export const DROP_TABLE_USER_PROFILES_TEMP = 'DROP TABLE IF EXISTS user_profiles_temp'; - -export const TABLE_USER_PROFILES_TEMP = `CREATE TABLE IF NOT EXISTS user_profiles_temp( - id INTEGER PRIMARY KEY AUTOINCREMENT, - remote_id TEXT, - account_id INTEGER, - username TEXT, - content_type TEXT, - subject_id TEXT, - pin TEXT)`; - -export const INSERT_TABLE_USER_PROFILES_TEMP = 'INSERT INTO user_profiles_temp (id, remote_id, account_id, username, content_type, subject_id, pin) SELECT id, remote_id, account_id, username, content_type, subject_id, pin FROM user_profiles;'; - -export const DROP_TABLE_USER_PROFILES = 'DROP TABLE IF EXISTS user_profiles'; - -export const ALTER_TABLE_USER_PROFILES = 'ALTER TABLE user_profiles_temp RENAME TO user_profiles'; diff --git a/src/common/data/sql/db_m_021.ts b/src/common/data/sql/db_m_021.ts deleted file mode 100644 index 44eaa78..0000000 --- a/src/common/data/sql/db_m_021.ts +++ /dev/null @@ -1,5 +0,0 @@ -export const DROP_INDEX_ACCOUNTS_USER_IDX = 'DROP INDEX IF EXISTS accounts_context_id_idx'; -export const ADD_INDEX_ACCOUNTS_USER_IDX = 'CREATE UNIQUE INDEX IF NOT EXISTS accounts_context_id_idx ON accounts_user (remote_id)'; - -export const DROP_INDEX_USER_PROFILES_IDX = 'DROP INDEX IF EXISTS user_profiles_id_idx'; -export const ADD_INDEX_USER_PROFILES_IDX = 'CREATE UNIQUE INDEX IF NOT EXISTS user_profiles_id_idx ON user_profiles (remote_id)'; diff --git a/src/common/data/sql/db_m_022.ts b/src/common/data/sql/db_m_022.ts deleted file mode 100644 index bd80f1a..0000000 --- a/src/common/data/sql/db_m_022.ts +++ /dev/null @@ -1 +0,0 @@ -export const ALTER_TABLE_EVENTS_STATE = 'ALTER TABLE main.events ADD COLUMN state TEXT'; diff --git a/src/common/data/sql/db_m_023.ts b/src/common/data/sql/db_m_023.ts deleted file mode 100644 index 1c4947d..0000000 --- a/src/common/data/sql/db_m_023.ts +++ /dev/null @@ -1,24 +0,0 @@ -export const DROP_TABLE_EVENTS_TEMP = 'DROP TABLE IF EXISTS events_temp'; - -export const TABLE_EVENTS_TEMP = `CREATE TABLE IF NOT EXISTS events_temp( - id INTEGER PRIMARY KEY AUTOINCREMENT, - remote_id TEXT, - account_id INTEGER, - profile_id INTEGER, - event_type_id INTEGER, - title TEXT, - latitude REAL, - longitude REAL, - geometry TEXT, - event_values TEXT, - state TEXT, - is_draft INTEGER, - created_at INTEGER, - updated_at INTEGER, - patrol_segment_id INTEGER)`; - -export const INSERT_TABLE_EVENTS_TEMP = 'INSERT INTO events_temp (id, remote_id, account_id, profile_id, event_type_id, title, latitude, longitude, geometry, event_values, state, is_draft, created_at, updated_at, patrol_segment_id) SELECT id, remote_id, account_id, profile_id, event_type_id, title, latitude, longitude, geometry, event_values, state, is_draft, created_at, updated_at, patrol_segment_id FROM events;'; - -export const DROP_TABLE_EVENTS = 'DROP TABLE IF EXISTS events'; - -export const ALTER_TABLE_EVENTS = 'ALTER TABLE events_temp RENAME TO events'; diff --git a/src/common/data/sql/db_m_024.ts b/src/common/data/sql/db_m_024.ts deleted file mode 100644 index acc01f7..0000000 --- a/src/common/data/sql/db_m_024.ts +++ /dev/null @@ -1,71 +0,0 @@ -// event_type -export const TABLE_EVENT_TYPE_TEMP_M24 = `CREATE TABLE IF NOT EXISTS event_type_temp( - id INTEGER PRIMARY KEY AUTOINCREMENT, - remote_id TEXT UNIQUE, - account_id INTEGER, - profile_id INTEGER, - value TEXT, - display TEXT, - schema TEXT, - category_id TEXT, - default_priority INTEGER, - icon TEXT, - icon_svg TEXT, - geometry_type TEXT)`; - -export const INSERT_TABLE_EVENT_TYPE_TEMP_M24 = 'INSERT INTO event_type_temp (id, remote_id, account_id, profile_id, value, display, schema, category_id, default_priority, icon, icon_svg, geometry_type) SELECT id, remote_id, account_id, profile_id, value, display, schema, category_id, default_priority, icon, icon_svg, geometry_type FROM event_type;'; - -// event_category -export const TABLE_EVENT_CATEGORY_TEMP_M24 = `CREATE TABLE IF NOT EXISTS event_category_temp( - id INTEGER PRIMARY KEY AUTOINCREMENT, - remote_id TEXT UNIQUE, - account_id INTEGER, - profile_id INTEGER, - value TEXT, - display TEXT, - ordernum INTEGER)`; - -export const INSERT_TABLE_EVENT_CATEGORY_TEMP_M24 = 'INSERT INTO event_category_temp (id, remote_id, account_id, profile_id, value, display, ordernum) SELECT id, remote_id, account_id, profile_id, value, display, ordernum FROM event_category;'; - -// attachments -export const DROP_TABLE_ATTACHMENTS_TEMP = 'DROP TABLE IF EXISTS attachments_temp'; - -export const TABLE_ATTACHMENTS_TEMP = `CREATE TABLE IF NOT EXISTS attachments_temp( - id INTEGER PRIMARY KEY AUTOINCREMENT, - remote_id TEXT, - account_id INTEGER, - profile_id INTEGER, - event_id TEXT, - type TEXT, - path TEXT, - thumbnail_path TEXT, - note_text TEXT, - uploaded INTEGER)`; - -export const INSERT_TABLE_ATTACHMENTS_TEMP = 'INSERT INTO attachments_temp (id, remote_id, account_id, profile_id, event_id, type, path, thumbnail_path, note_text, uploaded) SELECT id, remote_id, account_id, profile_id, event_id, type, path, thumbnail_path, note_text, uploaded FROM attachments;'; - -export const DROP_TABLE_ATTACHMENTS = 'DROP TABLE IF EXISTS attachments'; - -export const ALTER_TABLE_ATTACHMENTS = 'ALTER TABLE attachments_temp RENAME TO attachments'; - -// patrol_types -export const DROP_TABLE_PATROL_TYPES_TEMP = 'DROP TABLE IF EXISTS patrol_types_temp'; - -export const TABLE_PATROL_TYPES_TEMP = `CREATE TABLE IF NOT EXISTS patrol_types_temp ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - remote_id TEXT, - account_id INTEGER, - profile_id INTEGER, - value TEXT, - display TEXT, - icon TEXT, - icon_svg TEXT, - default_priority INTEGER, - is_active INTEGER, - ordernum INTEGER)`; - -export const INSERT_TABLE_PATROL_TYPES_TEMP = 'INSERT INTO patrol_types_temp (id, remote_id, account_id, profile_id, value, display, icon, icon_svg, default_priority, is_active, ordernum) SELECT id, remote_id, account_id, profile_id, value, display, icon, icon_svg, default_priority, is_active, ordernum FROM patrol_types;'; - -export const DROP_TABLE_PATROL_TYPES = 'DROP TABLE IF EXISTS patrol_types'; - -export const ALTER_TABLE_PATROL_TYPES = 'ALTER TABLE patrol_types_temp RENAME TO patrol_types'; diff --git a/src/common/data/sql/db_m_025.ts b/src/common/data/sql/db_m_025.ts deleted file mode 100644 index be4259b..0000000 --- a/src/common/data/sql/db_m_025.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const ALTER_TABLE_PATROLS_ACCOUNT_ID = 'ALTER TABLE main.patrols ADD COLUMN account_id INTEGER'; -export const ALTER_TABLE_PATROLS_PROFILE_ID = 'ALTER TABLE main.patrols ADD COLUMN profile_id INTEGER'; diff --git a/src/common/data/sql/db_m_026.ts b/src/common/data/sql/db_m_026.ts deleted file mode 100644 index 86e68ca..0000000 --- a/src/common/data/sql/db_m_026.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const ALTER_TABLE_ACCOUNTS_USER_PERMISSIONS = 'ALTER TABLE main.accounts_user ADD COLUMN permissions JSON'; -export const ALTER_TABLE_USER_PROFILES_PERMISSIONS = 'ALTER TABLE main.user_profiles ADD COLUMN permissions JSON'; diff --git a/src/common/data/sql/db_m_027.ts b/src/common/data/sql/db_m_027.ts deleted file mode 100644 index e1474e1..0000000 --- a/src/common/data/sql/db_m_027.ts +++ /dev/null @@ -1,91 +0,0 @@ -// EVENT_TYPE Table - -export const DROP_TABLE_EVENT_TYPE_TEMP_M27 = 'DROP TABLE IF EXISTS event_type_temp_m27'; - -export const TABLE_EVENT_TYPE_TEMP_M27 = ` - CREATE TABLE IF NOT EXISTS event_type_temp_m27 ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - remote_id TEXT UNIQUE, - account_id INTEGER, - profile_id JSON, - value TEXT, - display TEXT, - schema TEXT, - category_id TEXT, - default_priority INTEGER, - icon TEXT, - icon_svg TEXT, - geometry_type TEXT - )`; - -export const INSERT_TABLE_EVENT_TYPE_TEMP_M27 = ` - INSERT INTO event_type_temp_m27 ( - id, - remote_id, - account_id, - profile_id, - value, - display, - schema, - category_id, - default_priority, - icon, - icon_svg, - geometry_type - ) SELECT - id, - remote_id, - account_id, - profile_id, - value, - display, - schema, - category_id, - default_priority, - icon, - icon_svg, - geometry_type - FROM event_type`; - -export const DROP_TABLE_EVENT_TYPE_M27 = 'DROP TABLE IF EXISTS event_type'; - -export const ALTER_TABLE_EVENT_TYPE_M27 = 'ALTER TABLE event_type_temp_m27 RENAME TO event_type'; - -// EVENT_CATEGORY Table - -export const DROP_TABLE_EVENT_CATEGORY_TEMP_M27 = 'DROP TABLE IF EXISTS event_category_temp_m27'; - -export const TABLE_EVENT_CATEGORY_TEMP_M27 = ` - CREATE TABLE IF NOT EXISTS event_category_temp_m27 ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - remote_id TEXT UNIQUE, - account_id INTEGER, - profile_id JSON, - value TEXT, - display TEXT, - ordernum INTEGER - ); -`; - -export const INSERT_TABLE_EVENT_CATEGORY_TEMP_M27 = ` - INSERT INTO event_category_temp_m27 ( - id, - remote_id, - account_id, - profile_id, - value, - display, - ordernum - ) SELECT - id, - remote_id, - account_id, - profile_id, - value, - display, - ordernum - FROM event_category`; - -export const DROP_TABLE_EVENT_CATEGORY_M27 = 'DROP TABLE IF EXISTS event_category'; - -export const ALTER_TABLE_EVENT_CATEGORY_M27 = 'ALTER TABLE event_category_temp_m27 RENAME TO event_category'; diff --git a/src/common/data/sql/db_m_028.ts b/src/common/data/sql/db_m_028.ts deleted file mode 100644 index fd5b361..0000000 --- a/src/common/data/sql/db_m_028.ts +++ /dev/null @@ -1 +0,0 @@ -export const DROP_TABLE_DEVICES = 'DROP TABLE IF EXISTS devices'; diff --git a/src/common/data/sql/db_m_029.ts b/src/common/data/sql/db_m_029.ts deleted file mode 100644 index bf17d2a..0000000 --- a/src/common/data/sql/db_m_029.ts +++ /dev/null @@ -1 +0,0 @@ -export const ALTER_TABLE_PATROLS_SERIAL_NUMBER = 'ALTER TABLE main.patrols ADD COLUMN serial_number INTEGER'; diff --git a/src/common/data/sql/db_m_030.ts b/src/common/data/sql/db_m_030.ts deleted file mode 100644 index ebe67d8..0000000 --- a/src/common/data/sql/db_m_030.ts +++ /dev/null @@ -1 +0,0 @@ -export const ALTER_TABLE_ACCOUNTS_USER_IS_SUPERUSER = 'ALTER TABLE main.accounts_user ADD COLUMN is_superuser INTEGER'; diff --git a/src/common/data/sql/db_m_031.ts b/src/common/data/sql/db_m_031.ts deleted file mode 100644 index 8871f2f..0000000 --- a/src/common/data/sql/db_m_031.ts +++ /dev/null @@ -1 +0,0 @@ -export const ALTER_TABLE_EVENTS_SERIAL_NUMBER = 'ALTER TABLE main.events ADD COLUMN serial_number INTEGER'; diff --git a/src/views/SettingsSection/SubjectsView/SubjectsView.styles.ts b/src/views/SettingsSection/SubjectsView/SubjectsView.styles.ts deleted file mode 100644 index c107351..0000000 --- a/src/views/SettingsSection/SubjectsView/SubjectsView.styles.ts +++ /dev/null @@ -1,24 +0,0 @@ -// External Dependencies -import { StyleSheet } from 'react-native'; - -// Internal Dependencies -import { COLORS_LIGHT } from '../../../common/constants/colors'; -import { IS_IOS } from '../../../common/constants/constants'; - -const styles = StyleSheet.create({ - content: { - flex: 1, - backgroundColor: COLORS_LIGHT.white, - }, - searchInput: { - flex: 1, - marginStart: IS_IOS ? -10 : 0, - marginEnd: IS_IOS ? 80 : 40, - fontSize: 17, - }, - searchBackIcon: { - marginRight: IS_IOS ? 0 : 16, - }, -}); - -export default styles; diff --git a/src/views/SettingsSection/SubjectsView/SubjectsView.tsx b/src/views/SettingsSection/SubjectsView/SubjectsView.tsx deleted file mode 100644 index d94d914..0000000 --- a/src/views/SettingsSection/SubjectsView/SubjectsView.tsx +++ /dev/null @@ -1,234 +0,0 @@ -// External Dependencies -import React, { - useEffect, - useRef, - useState, -} from 'react'; -import { NativeStackNavigationProp } from '@react-navigation/native-stack'; -import { cloneDeep } from 'lodash-es'; -import { useTranslation } from 'react-i18next'; -import { TextInput } from 'react-native'; -import { SafeAreaView } from 'react-native-safe-area-context'; -import { FlashList } from '@shopify/flash-list'; - -// Internal Dependencies -import { PersistedUserSubject, RootStackParamList } from '../../../common/types/types'; -import { SubjectItemCell } from './components/SubjectItemCell'; -import { COLORS_LIGHT } from '../../../common/constants/colors'; -import { customBackButton, osBackIcon } from '../../../common/components/header/header'; -import { - EmptySearchResultsView, -} from '../../../common/components/EmptySearchResults/EmptySearchResultsView'; -import { SearchButton } from '../../../common/components/SearchButton/SearchButton'; -import { getStringForKey, setStringForKey } from '../../../common/data/storage/keyValue'; -import { useRetrieveUserSubjects } from '../../../common/data/users/useRetrieveUserSubjects'; -import { getSecuredStringForKey } from '../../../common/data/storage/utils'; -import { - ACTIVE_USER_NAME_KEY, - TRACKED_BY_SUBJECT_ID_KEY, - TRACKED_BY_SUBJECT_NAME_KEY, -} from '../../../common/constants/constants'; - -// Styles -import styles from './SubjectsView.styles'; - -// Interfaces + Types -interface SubjectsViewProps { - navigation: NativeStackNavigationProp; -} - -const SubjectsView = ({ navigation }: SubjectsViewProps) => { - // Hooks - const { t } = useTranslation(); - const { retrieveUserSubjects, retrieveActiveUserAsUserSubject } = useRetrieveUserSubjects(); - - // References - const inputRef = useRef(null); - - // State - const [subjectsList, setSubjectsList] = useState([]); - const [filteredSubjectList, setFilteredSubjectList] = useState([]); - const [isSearchModeEnabled, setIsSearchModeEnabled] = useState(false); - const [subjectItem, setSubjectItem] = useState( - getStringForKey(TRACKED_BY_SUBJECT_NAME_KEY) || '', - ); - - // Helper functions - const initAppBar = () => { - const viewTitle = t('settingsView.trackedBy'); - - navigation.setOptions({ - // @ts-ignore - title: viewTitle, - headerTitle: viewTitle, - }); - - setTimeout(() => { - navigation.setOptions({ - // @ts-ignore - headerLeft: () => customBackButton(osBackIcon, () => navigation.pop()), - headerRight: () => searchIconView(), - }); - }, 10); - }; - - const updateAppBar = () => { - navigation.setOptions({ - // @ts-ignore - headerLeft: () => searchBackIconView(), - headerRight: () => null, - headerTitle: () => searchInputView(), - headerBackVisible: false, - }); - }; - - const showSearchInput = () => { - updateAppBar(); - setIsSearchModeEnabled(true); - // @ts-ignore - const { routes } = navigation.getState(); - const route = routes.find((item: any) => item.name === 'SubjectsView'); - const subjectsListTmp: PersistedUserSubject[] = route.params?.subjects; - setFilteredSubjectList(subjectsListTmp); - }; - - const backFromSearch = () => { - initAppBar(); - setIsSearchModeEnabled(false); - // Retrieve the state data from navigation params, otherwise this function can't access - // the state variables. - // @ts-ignore - const { routes } = navigation.getState(); - const route = routes.find((item: any) => item.name === 'SubjectsView'); - const subjectsListTmp: PersistedUserSubject[] = route.params?.subjects; - setSubjectsList(subjectsListTmp); - setFilteredSubjectList(subjectsListTmp); - }; - - const searchUserSubjects = (text: string) => { - // Retrieve the state data from navigation params, otherwise this function can't access - // the state variables. - // @ts-ignore - const { routes } = navigation.getState(); - const route = routes.find((item: any) => item.name === 'SubjectsView'); - const subjectsListTmp: PersistedUserSubject[] = route.params?.subjects; - setFilteredSubjectList(subjectsListTmp.filter( - (item) => item.name.toLowerCase().includes(text.toLowerCase()), - )); - }; - - const setIsSelected = (item: string) => { - setSubjectsList(subjectsList.map((subject) => { - if (subject.name === item || subject.isSelected) { - // eslint-disable-next-line no-param-reassign - subject.isSelected = subject.name === item; - return cloneDeep(subject); - } - return subject; - })); - - setFilteredSubjectList(filteredSubjectList.map((subject) => { - if (subject.name === item || subject.isSelected) { - // eslint-disable-next-line no-param-reassign - subject.isSelected = subject.name === item; - return cloneDeep(subject); - } - return subject; - })); - }; - - // Handlers - const onSubjectItemPress = (item: string, id: string) => { - if (getSecuredStringForKey(ACTIVE_USER_NAME_KEY) !== item) { - setStringForKey(TRACKED_BY_SUBJECT_ID_KEY, id); - } - setStringForKey(TRACKED_BY_SUBJECT_NAME_KEY, item); - setIsSelected(item); - setSubjectItem(item); - - navigation.pop(); - }; - - // Effects - useEffect(() => { - // App Bar - initAppBar(); - }, []); - - useEffect(() => { - if (isSearchModeEnabled && inputRef.current) { - inputRef.current.focus(); - } - }, [isSearchModeEnabled]); - - useEffect(() => { - const initUserSubjects = async () => { - const userSubjects = await retrieveUserSubjects(); - - // @ts-ignore - navigation.setParams({ - subjects: userSubjects, - }); - - // Get active user details - const activeUser = await retrieveActiveUserAsUserSubject(); - - if (activeUser) { - userSubjects.push(activeUser); - } - - setSubjectsList(userSubjects); - - userSubjects.forEach((userSubject) => { - // eslint-disable-next-line no-param-reassign - userSubject.isSelected = userSubject.name === subjectItem; - }); - - setFilteredSubjectList(userSubjects); - }; - - initUserSubjects(); - }, []); - - // Helper functions - const renderItem = ({ item }: any) => ( - onSubjectItemPress(item.name, item.remote_id.toString())} - isSubjectItemSelected={item.isSelected} - /> - ); - - // Additional Components - const searchIconView = () => (); - - const searchBackIconView = () => customBackButton(osBackIcon, backFromSearch); - - const searchInputView = () => ( - (searchUserSubjects(text))} - ref={inputRef} - placeholderTextColor={COLORS_LIGHT.G3_secondaryMediumLightGray} - /> - ); - - return ( - - {isSearchModeEnabled && filteredSubjectList.length === 0 - ? - : ( - item.remote_id.toString()} - renderItem={renderItem} - /> - )} - - ); -}; - -export { SubjectsView };