Implemented the initialisers for the Account and User data models.

This commit is contained in:
Javier Cicchelli 2022-12-11 21:12:25 +01:00
parent 39444cd9ea
commit c00fe919f0
2 changed files with 58 additions and 0 deletions

View File

@ -7,6 +7,20 @@
// //
public struct Account: Codable { public struct Account: Codable {
// MARK: Properties
public let username: String public let username: String
public let password: String public let password: String
// MARK: Initialisers
public init(
username: String,
password: String
) {
self.username = username
self.password = password
}
} }

View File

@ -9,21 +9,65 @@
import Foundation import Foundation
public struct User { public struct User {
// MARK: Properties
public let profile: Profile public let profile: Profile
public let rootFolder: RootFolder public let rootFolder: RootFolder
// MARK: Initialisers
public init(
profile: Profile,
rootFolder: RootFolder
) {
self.profile = profile
self.rootFolder = rootFolder
}
} }
// MARK: - Structs // MARK: - Structs
extension User { extension User {
public struct Profile { public struct Profile {
// MARK: Properties
public let firstName: String public let firstName: String
public let lastName: String public let lastName: String
// MARK: Initialisers
public init(
firstName: String,
lastName: String
) {
self.firstName = firstName
self.lastName = lastName
}
} }
public struct RootFolder { public struct RootFolder {
// MARK: Properties
public let id: String public let id: String
public let name: String public let name: String
public let lastModifiedAt: Date public let lastModifiedAt: Date
// MARK: Initialisers
public init(
id: String,
name: String,
lastModifiedAt: Date
) {
self.id = id
self.name = name
self.lastModifiedAt = lastModifiedAt
}
} }
} }