diff --git a/Tella/Data/Database/GDriveDatabase.swift b/Tella/Data/Database/GDriveDatabase.swift index 1f5cbf26d..a4b258f41 100644 --- a/Tella/Data/Database/GDriveDatabase.swift +++ b/Tella/Data/Database/GDriveDatabase.swift @@ -13,7 +13,7 @@ extension TellaDataBase { func createGDriveServerTable() { let columns = [ - cddl(D.cId, D.integer, primaryKey: true, autoIncrement: true), + cddl(D.cServerId, D.integer, primaryKey: true, autoIncrement: true), cddl(D.cName, D.text), cddl(D.cRootFolder, D.text), cddl(D.cRootFolderName, D.text) @@ -50,7 +50,7 @@ extension TellaDataBase { func deleteGDriveServer(serverId: Int) { do { try statementBuilder.delete(tableName: D.tGDriveServer, - primarykeyValue: [KeyValue(key: D.cId, value: serverId)]) + primarykeyValue: [KeyValue(key: D.cServerId, value: serverId)]) try statementBuilder.deleteAll(tableNames: [D.tGDriveReport, D.tGDriveInstanceVaultFile]) } catch let error { debugLog(error) @@ -63,7 +63,7 @@ extension TellaDataBase { extension TellaDataBase { func createGDriveReportTable() { let columns = [ - cddl(D.cId, D.integer, primaryKey: true, autoIncrement: true), + cddl(D.cReportId, D.integer, primaryKey: true, autoIncrement: true), cddl(D.cTitle, D.text), cddl(D.cDescription, D.text), cddl(D.cCreatedDate, D.float), @@ -84,7 +84,7 @@ extension TellaDataBase { cddl(D.cBytesSent, D.integer), cddl(D.cCreatedDate, D.float), cddl(D.cUpdatedDate, D.float), - cddl(D.cReportInstanceId, D.integer, tableName: D.tGDriveReport, referenceKey: D.cId) + cddl(D.cReportInstanceId, D.integer, tableName: D.tGDriveReport, referenceKey: D.cReportId) ] statementBuilder.createTable(tableName: D.tGDriveInstanceVaultFile, columns: columns) @@ -118,7 +118,7 @@ extension TellaDataBase { let reportDict = report.dictionary let valuesToUpdate = reportDict.compactMap({ KeyValue(key: $0.key, value: $0.value) }) - let reportCondition = [KeyValue(key: D.cId, value: report.id)] + let reportCondition = [KeyValue(key: D.cReportId, value: report.id)] try statementBuilder.update( tableName: D.tGDriveReport, @@ -177,7 +177,7 @@ extension TellaDataBase { func getGDriveReport(id: Int) -> GDriveReport? { do{ - let reportsCondition = [KeyValue(key: D.cId, value: id)] + let reportsCondition = [KeyValue(key: D.cReportId, value: id)] let gDriveReportsDict = try statementBuilder.getSelectQuery(tableName: D.tGDriveReport, equalCondition: reportsCondition ) @@ -219,7 +219,7 @@ extension TellaDataBase { func deleteDriveReport(reportId: Int?) -> Result { do { - let reportCondition = [KeyValue(key: D.cId, value: reportId)] + let reportCondition = [KeyValue(key: D.cReportId, value: reportId)] try statementBuilder.delete(tableName: D.tGDriveReport, primarykeyValue: reportCondition) @@ -245,7 +245,7 @@ extension TellaDataBase { KeyValue(key: D.cUpdatedDate, value: Date().getDateDouble()) ] - let reportCondition = [KeyValue(key: D.cId, value: idReport)] + let reportCondition = [KeyValue(key: D.cReportId, value: idReport)] try statementBuilder.update(tableName: D.tGDriveReport, valuesToUpdate: valuesToUpdate, equalCondition: reportCondition) @@ -261,7 +261,7 @@ extension TellaDataBase { let valuesToUpdate = [KeyValue(key: D.cFolderId, value: folderId), KeyValue(key: D.cUpdatedDate, value: Date().getDateDouble()) ] - let reportCondition = [KeyValue(key: D.cId, value: idReport)] + let reportCondition = [KeyValue(key: D.cReportId, value: idReport)] try statementBuilder.update(tableName: D.tGDriveReport, valuesToUpdate: valuesToUpdate, equalCondition: reportCondition) diff --git a/Tella/Domain/Entity/CommonReport/BaseReport.swift b/Tella/Domain/Entity/CommonReport/BaseReport.swift index 0de9a564f..b1e6cc680 100644 --- a/Tella/Domain/Entity/CommonReport/BaseReport.swift +++ b/Tella/Domain/Entity/CommonReport/BaseReport.swift @@ -20,7 +20,7 @@ class BaseReport : Hashable, Codable { var serverId: Int? enum CodingKeys: String, CodingKey { - case id = "c_id" + case id = "c_report_id" case title = "c_title" case description = "c_description" case createdDate = "c_created_date" diff --git a/Tella/Domain/Entity/CommonServer/Server.swift b/Tella/Domain/Entity/CommonServer/Server.swift index 4d2c18d48..93a68115c 100644 --- a/Tella/Domain/Entity/CommonServer/Server.swift +++ b/Tella/Domain/Entity/CommonServer/Server.swift @@ -16,7 +16,7 @@ class Server: Codable, Equatable, Hashable { var allowMultiple: Bool? enum CodingKeys: String, CodingKey { - case id = "c_id" + case id = "c_server_id" case name = "c_name" }