NCDatabase.swift 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  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 autoUploadFormatCompatibility: Bool = false
  39. @objc dynamic var displayName = ""
  40. @objc dynamic var email = ""
  41. @objc dynamic var enabled: Bool = false
  42. @objc dynamic var optimization = NSDate()
  43. @objc dynamic var password = ""
  44. @objc dynamic var phone = ""
  45. @objc dynamic var quota: Double = 0
  46. @objc dynamic var quotaFree: Double = 0
  47. @objc dynamic var quotaRelative: Double = 0
  48. @objc dynamic var quotaTotal: Double = 0
  49. @objc dynamic var quotaUsed: Double = 0
  50. @objc dynamic var twitter = ""
  51. @objc dynamic var url = ""
  52. @objc dynamic var user = ""
  53. @objc dynamic var userID = ""
  54. @objc dynamic var webpage = ""
  55. }
  56. class tableActivity: Object {
  57. @objc dynamic var account = ""
  58. @objc dynamic var action = "Activity"
  59. @objc dynamic var date = NSDate()
  60. @objc dynamic var file = ""
  61. @objc dynamic var fileID = ""
  62. @objc dynamic var idActivity: Double = 0
  63. @objc dynamic var link = ""
  64. @objc dynamic var note = ""
  65. @objc dynamic var selector = ""
  66. @objc dynamic var type = ""
  67. @objc dynamic var verbose: Bool = false
  68. }
  69. class tableCapabilities: Object {
  70. @objc dynamic var account = ""
  71. @objc dynamic var themingBackground = ""
  72. @objc dynamic var themingColor = ""
  73. @objc dynamic var themingLogo = ""
  74. @objc dynamic var themingName = ""
  75. @objc dynamic var themingSlogan = ""
  76. @objc dynamic var themingUrl = ""
  77. @objc dynamic var versionMajor: Int = 0
  78. @objc dynamic var versionMicro: Int = 0
  79. @objc dynamic var versionMinor: Int = 0
  80. @objc dynamic var versionString = ""
  81. @objc dynamic var endToEndEncryption: Bool = false
  82. @objc dynamic var endToEndEncryptionVersion = ""
  83. }
  84. class tableCertificates: Object {
  85. @objc dynamic var certificateLocation = ""
  86. }
  87. class tableDirectory: Object {
  88. @objc dynamic var account = ""
  89. @objc dynamic var dateReadDirectory: NSDate? = nil
  90. @objc dynamic var directoryID = ""
  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 permissions = ""
  96. @objc dynamic var serverUrl = ""
  97. override static func primaryKey() -> String {
  98. return "directoryID"
  99. }
  100. }
  101. class tableExternalSites: Object {
  102. @objc dynamic var account = ""
  103. @objc dynamic var icon = ""
  104. @objc dynamic var idExternalSite: Int = 0
  105. @objc dynamic var lang = ""
  106. @objc dynamic var name = ""
  107. @objc dynamic var type = ""
  108. @objc dynamic var url = ""
  109. }
  110. class tableGPS: Object {
  111. @objc dynamic var latitude = ""
  112. @objc dynamic var location = ""
  113. @objc dynamic var longitude = ""
  114. @objc dynamic var placemarkAdministrativeArea = ""
  115. @objc dynamic var placemarkCountry = ""
  116. @objc dynamic var placemarkLocality = ""
  117. @objc dynamic var placemarkPostalCode = ""
  118. @objc dynamic var placemarkThoroughfare = ""
  119. }
  120. class tableLocalFile: Object {
  121. @objc dynamic var account = ""
  122. @objc dynamic var date = NSDate()
  123. @objc dynamic var etag = ""
  124. @objc dynamic var exifDate = NSDate()
  125. @objc dynamic var exifLatitude = ""
  126. @objc dynamic var exifLongitude = ""
  127. @objc dynamic var favorite: Bool = false
  128. @objc dynamic var fileID = ""
  129. @objc dynamic var fileName = ""
  130. @objc dynamic var size: Double = 0
  131. override static func primaryKey() -> String {
  132. return "fileID"
  133. }
  134. }
  135. class tableMetadata: Object {
  136. @objc dynamic var account = ""
  137. @objc dynamic var assetLocalIdentifier = ""
  138. @objc dynamic var date = NSDate()
  139. @objc dynamic var directory: Bool = false
  140. @objc dynamic var directoryID = ""
  141. @objc dynamic var etag = ""
  142. @objc dynamic var favorite: Bool = false
  143. @objc dynamic var fileID = ""
  144. @objc dynamic var fileName = ""
  145. @objc dynamic var iconName = ""
  146. @objc dynamic var permissions = ""
  147. @objc dynamic var session = ""
  148. @objc dynamic var sessionError = ""
  149. @objc dynamic var sessionID = ""
  150. @objc dynamic var sessionSelector = ""
  151. @objc dynamic var sessionSelectorPost = ""
  152. @objc dynamic var sessionTaskIdentifier: Int = -1
  153. @objc dynamic var size: Double = 0
  154. @objc dynamic var status: Double = 0
  155. @objc dynamic var thumbnailExists: Bool = false
  156. @objc dynamic var typeFile = ""
  157. override static func primaryKey() -> String {
  158. return "fileID"
  159. }
  160. override static func indexedProperties() -> [String] {
  161. return ["directoryID"]
  162. }
  163. }
  164. class tablePhotoLibrary: Object {
  165. @objc dynamic var account = ""
  166. @objc dynamic var assetLocalIdentifier = ""
  167. @objc dynamic var creationDate: NSDate? = nil
  168. @objc dynamic var idAsset = ""
  169. @objc dynamic var modificationDate: NSDate? = nil
  170. @objc dynamic var mediaType: Int = 0
  171. override static func primaryKey() -> String {
  172. return "idAsset"
  173. }
  174. }
  175. class tableQueueDownload: Object {
  176. @objc dynamic var account = ""
  177. @objc dynamic var fileID = ""
  178. @objc dynamic var selector = ""
  179. @objc dynamic var selectorPost = ""
  180. @objc dynamic var serverUrl = ""
  181. @objc dynamic var session = ""
  182. override static func primaryKey() -> String {
  183. return "fileID"
  184. }
  185. }
  186. class tableQueueUpload: Object {
  187. @objc dynamic var account = ""
  188. @objc dynamic var assetLocalIdentifier = ""
  189. @objc dynamic var date = NSDate()
  190. @objc dynamic var fileName = ""
  191. @objc dynamic var lock: Bool = false
  192. @objc dynamic var priority: Int = 0
  193. @objc dynamic var selector = ""
  194. @objc dynamic var selectorPost = ""
  195. @objc dynamic var serverUrl = ""
  196. @objc dynamic var session = ""
  197. }
  198. class tableShare: Object {
  199. @objc dynamic var account = ""
  200. @objc dynamic var fileName = ""
  201. @objc dynamic var serverUrl = ""
  202. @objc dynamic var shareLink = ""
  203. @objc dynamic var shareUserAndGroup = ""
  204. }