NCDatabase.swift 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. //
  2. // NCDatabase.swift
  3. // Nextcloud iOS
  4. //
  5. // Created by Marino Faggiana on 06/05/17.
  6. // Copyright © 2017 TWS. All rights reserved.
  7. //
  8. // Author Marino Faggiana <m.faggiana@twsweb.it>
  9. //
  10. // This program is free software: you can redistribute it and/or modify
  11. // it under the terms of the GNU General Public License as published by
  12. // the Free Software Foundation, either version 3 of the License, or
  13. // (at your option) any later version.
  14. //
  15. // This program is distributed in the hope that it will be useful,
  16. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. // GNU General Public License for more details.
  19. //
  20. // You should have received a copy of the GNU General Public License
  21. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. //
  23. import RealmSwift
  24. class tableAccount: Object {
  25. @objc dynamic var account = ""
  26. @objc dynamic var active: Bool = false
  27. @objc dynamic var address = ""
  28. @objc dynamic var autoUpload: Bool = false
  29. @objc dynamic var autoUploadBackground: Bool = false
  30. @objc dynamic var autoUploadCreateSubfolder: Bool = false
  31. @objc dynamic var autoUploadFileName = ""
  32. @objc dynamic var autoUploadDirectory = ""
  33. @objc dynamic var autoUploadFull: Bool = false
  34. @objc dynamic var autoUploadImage: Bool = false
  35. @objc dynamic var autoUploadVideo: Bool = false
  36. @objc dynamic var autoUploadWWAnPhoto: Bool = false
  37. @objc dynamic var autoUploadWWAnVideo: Bool = false
  38. @objc dynamic var displayName = ""
  39. @objc dynamic var email = ""
  40. @objc dynamic var enabled: Bool = false
  41. @objc dynamic var optimization = NSDate()
  42. @objc dynamic var password = ""
  43. @objc dynamic var phone = ""
  44. @objc dynamic var quota: Double = 0
  45. @objc dynamic var quotaFree: Double = 0
  46. @objc dynamic var quotaRelative: Double = 0
  47. @objc dynamic var quotaTotal: Double = 0
  48. @objc dynamic var quotaUsed: Double = 0
  49. @objc dynamic var twitter = ""
  50. @objc dynamic var url = ""
  51. @objc dynamic var user = ""
  52. @objc dynamic var userID = ""
  53. @objc dynamic var webpage = ""
  54. }
  55. class tableActivity: Object {
  56. @objc dynamic var account = ""
  57. @objc dynamic var action = "Activity"
  58. @objc dynamic var date = NSDate()
  59. @objc dynamic var file = ""
  60. @objc dynamic var fileID = ""
  61. @objc dynamic var idActivity: Double = 0
  62. @objc dynamic var link = ""
  63. @objc dynamic var note = ""
  64. @objc dynamic var selector = ""
  65. @objc dynamic var type = ""
  66. @objc dynamic var verbose: Bool = false
  67. }
  68. class tableCapabilities: Object {
  69. @objc dynamic var account = ""
  70. @objc dynamic var themingBackground = ""
  71. @objc dynamic var themingColor = ""
  72. @objc dynamic var themingLogo = ""
  73. @objc dynamic var themingName = ""
  74. @objc dynamic var themingSlogan = ""
  75. @objc dynamic var themingUrl = ""
  76. @objc dynamic var versionMajor: Int = 0
  77. @objc dynamic var versionMicro: Int = 0
  78. @objc dynamic var versionMinor: Int = 0
  79. @objc dynamic var versionString = ""
  80. @objc dynamic var endToEndEncryption: Bool = false
  81. @objc dynamic var endToEndEncryptionVersion = ""
  82. }
  83. class tableCertificates: Object {
  84. @objc dynamic var certificateLocation = ""
  85. }
  86. class tableDirectory: Object {
  87. @objc dynamic var account = ""
  88. @objc dynamic var dateReadDirectory: NSDate? = nil
  89. @objc dynamic var directoryID = ""
  90. @objc dynamic var e2eEncrypted: Bool = false
  91. @objc dynamic var etag = ""
  92. @objc dynamic var favorite: Bool = false
  93. @objc dynamic var fileID = ""
  94. @objc dynamic var lock: Bool = false
  95. @objc dynamic var e2eTokenLock = ""
  96. @objc dynamic var permissions = ""
  97. @objc dynamic var serverUrl = ""
  98. override static func primaryKey() -> String {
  99. return "directoryID"
  100. }
  101. }
  102. class tableE2eEncryption: Object {
  103. @objc dynamic var account = ""
  104. @objc dynamic var authenticationTag = ""
  105. @objc dynamic var fileName = ""
  106. @objc dynamic var fileNameIdentifier = ""
  107. @objc dynamic var fileNamePath = ""
  108. @objc dynamic var key = ""
  109. @objc dynamic var initializationVector = ""
  110. @objc dynamic var metadataKey = ""
  111. @objc dynamic var metadataKeyIndex: Int = 0
  112. @objc dynamic var mimeType = ""
  113. @objc dynamic var serverUrl = ""
  114. @objc dynamic var version: Int = 1
  115. override static func primaryKey() -> String {
  116. return "fileNamePath"
  117. }
  118. }
  119. class tableExternalSites: Object {
  120. @objc dynamic var account = ""
  121. @objc dynamic var icon = ""
  122. @objc dynamic var idExternalSite: Int = 0
  123. @objc dynamic var lang = ""
  124. @objc dynamic var name = ""
  125. @objc dynamic var type = ""
  126. @objc dynamic var url = ""
  127. }
  128. class tableGPS: Object {
  129. @objc dynamic var latitude = ""
  130. @objc dynamic var location = ""
  131. @objc dynamic var longitude = ""
  132. @objc dynamic var placemarkAdministrativeArea = ""
  133. @objc dynamic var placemarkCountry = ""
  134. @objc dynamic var placemarkLocality = ""
  135. @objc dynamic var placemarkPostalCode = ""
  136. @objc dynamic var placemarkThoroughfare = ""
  137. }
  138. class tableLocalFile: Object {
  139. @objc dynamic var account = ""
  140. @objc dynamic var date = NSDate()
  141. @objc dynamic var etag = ""
  142. @objc dynamic var exifDate = NSDate()
  143. @objc dynamic var exifLatitude = ""
  144. @objc dynamic var exifLongitude = ""
  145. @objc dynamic var favorite: Bool = false
  146. @objc dynamic var fileID = ""
  147. @objc dynamic var fileName = ""
  148. @objc dynamic var size: Double = 0
  149. override static func primaryKey() -> String {
  150. return "fileID"
  151. }
  152. }
  153. class tableMetadata: Object {
  154. @objc dynamic var account = ""
  155. @objc dynamic var assetLocalIdentifier = ""
  156. @objc dynamic var date = NSDate()
  157. @objc dynamic var directory: Bool = false
  158. @objc dynamic var directoryID = ""
  159. @objc dynamic var e2eEncrypted: Bool = false
  160. @objc dynamic var etag = ""
  161. @objc dynamic var favorite: Bool = false
  162. @objc dynamic var fileID = ""
  163. @objc dynamic var fileName = ""
  164. @objc dynamic var fileNameView = ""
  165. @objc dynamic var iconName = ""
  166. @objc dynamic var permissions = ""
  167. @objc dynamic var session = ""
  168. @objc dynamic var sessionError = ""
  169. @objc dynamic var sessionID = ""
  170. @objc dynamic var sessionSelector = ""
  171. @objc dynamic var sessionSelectorPost = ""
  172. @objc dynamic var sessionTaskIdentifier: Int = -1
  173. @objc dynamic var size: Double = 0
  174. @objc dynamic var status: Double = 0
  175. @objc dynamic var thumbnailExists: Bool = false
  176. @objc dynamic var typeFile = ""
  177. override static func primaryKey() -> String {
  178. return "fileID"
  179. }
  180. override static func indexedProperties() -> [String] {
  181. return ["directoryID"]
  182. }
  183. }
  184. class tablePhotoLibrary: Object {
  185. @objc dynamic var account = ""
  186. @objc dynamic var assetLocalIdentifier = ""
  187. @objc dynamic var creationDate: NSDate? = nil
  188. @objc dynamic var idAsset = ""
  189. @objc dynamic var modificationDate: NSDate? = nil
  190. @objc dynamic var mediaType: Int = 0
  191. override static func primaryKey() -> String {
  192. return "idAsset"
  193. }
  194. }
  195. class tableQueueDownload: Object {
  196. @objc dynamic var account = ""
  197. @objc dynamic var fileID = ""
  198. @objc dynamic var selector = ""
  199. @objc dynamic var selectorPost = ""
  200. @objc dynamic var serverUrl = ""
  201. @objc dynamic var session = ""
  202. override static func primaryKey() -> String {
  203. return "fileID"
  204. }
  205. }
  206. class tableQueueUpload: Object {
  207. @objc dynamic var account = ""
  208. @objc dynamic var assetLocalIdentifier = ""
  209. @objc dynamic var date = NSDate()
  210. @objc dynamic var fileName = ""
  211. @objc dynamic var lock: Bool = false
  212. @objc dynamic var selector = ""
  213. @objc dynamic var selectorPost = ""
  214. @objc dynamic var serverUrl = ""
  215. @objc dynamic var session = ""
  216. }
  217. class tableShare: Object {
  218. @objc dynamic var account = ""
  219. @objc dynamic var fileName = ""
  220. @objc dynamic var serverUrl = ""
  221. @objc dynamic var shareLink = ""
  222. @objc dynamic var shareUserAndGroup = ""
  223. }