UserDetailsModel.swift 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. //
  2. // UserDetailsModel.swift
  3. // LMS
  4. //
  5. // Created by Suraj Kumar Mandal on 01/09/22.
  6. //
  7. import Foundation
  8. import RealmSwift
  9. class UserDetailsModel: Object {
  10. @objc dynamic var id = 0
  11. @objc dynamic var name = ""
  12. @objc dynamic var lastName = ""
  13. @objc dynamic var username = ""
  14. @objc dynamic var email = ""
  15. @objc dynamic var mobile = ""
  16. @objc dynamic var keycloakUserId = ""
  17. @objc dynamic var enable = true
  18. //@objc dynamic var intervantions = [0]
  19. var userType = List<UserType>()
  20. override static func primaryKey() -> String? {
  21. return "id"
  22. }
  23. convenience init(id: Int,
  24. name :String,
  25. lastName :String,
  26. username: String,
  27. email: String,
  28. mobile : String,
  29. keycloakUserId : String ,
  30. enable : Bool,
  31. //intervantions : Array<Int>,
  32. userType : List<UserType>
  33. ) {
  34. self.init()
  35. self.id = id
  36. self.name = name
  37. self.lastName = lastName
  38. self.username = username
  39. self.email = email
  40. self.mobile = mobile
  41. self.keycloakUserId = keycloakUserId
  42. self.enable = enable
  43. //self.intervantions = intervantions
  44. self.userType = userType
  45. }
  46. }
  47. class UserType: Object {
  48. @objc dynamic var id = 0
  49. @objc dynamic var actor = ""
  50. @objc dynamic var parentActor = ""
  51. @objc dynamic var discription = ""
  52. @objc dynamic var defaultRealmRole = ""
  53. @objc dynamic var createAccess = ""
  54. @objc dynamic var deleteAccess = ""
  55. @objc dynamic var editAccess = ""
  56. @objc dynamic var viewAccess = ""
  57. @objc dynamic var appUrl = ""
  58. override static func primaryKey() -> String? {
  59. return "id"
  60. }
  61. convenience init(id:Int,
  62. actor:String,
  63. parentActor:String,
  64. discription:String,
  65. defaultRealmRole:String,
  66. createAccess:String,
  67. deleteAccess:String,
  68. editAccess:String,
  69. viewAccess:String,
  70. appUrl:String
  71. ) {
  72. self.init()
  73. self.id = id
  74. self.actor = actor
  75. self.parentActor = parentActor
  76. self.discription = discription
  77. self.defaultRealmRole = defaultRealmRole
  78. self.createAccess = createAccess
  79. self.deleteAccess = deleteAccess
  80. self.editAccess = editAccess
  81. self.viewAccess = viewAccess
  82. self.appUrl = appUrl
  83. }
  84. }