/* Options: Date: 2025-12-06 13:06:10 SwiftVersion: 5.0 Version: 6.110 Tip: To override a DTO option, remove "//" prefix before updating BaseUrl: https://etc-api.vsmlab.vn //BaseClass: //AddModelExtensions: True //AddServiceStackTypes: True IncludeTypes: SearchUserRequest.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack /** * Super_admin Tìm kiếm tất cả người dùng */ // @Route("/users/All", "Get") public class SearchUserRequest : PagingRequest, IReturn { public typealias Return = BaseResponse public var userName:String public var departmentId:Int? public var partyGroupId:Int? required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case userName case departmentId case partyGroupId } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) userName = try container.decodeIfPresent(String.self, forKey: .userName) departmentId = try container.decodeIfPresent(Int.self, forKey: .departmentId) partyGroupId = try container.decodeIfPresent(Int.self, forKey: .partyGroupId) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if userName != nil { try container.encode(userName, forKey: .userName) } if departmentId != nil { try container.encode(departmentId, forKey: .departmentId) } if partyGroupId != nil { try container.encode(partyGroupId, forKey: .partyGroupId) } } } public class BaseResponse : IResponseRequest, Codable { public var code:Int public var message:String public var data:AllUserResponse required public init(){} } public class PagingRequest : Codable { public var page:Int public var limit:Int required public init(){} } public class UserProfile : UserLogin { public var id:Int public var fullName:String public var email:String public var departmentId:Int? public var partyGroupId:Int? public var avatar:String public var telephone:String public var birthday:Date? public var createdAt:Date? public var updatedAt:Date? public var failedLoginCount:Int // @Ignore() public var roles:[Int] = [] public var lastLoginDate:Date? required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case id case fullName case email case departmentId case partyGroupId case avatar case telephone case birthday case createdAt case updatedAt case failedLoginCount case roles case lastLoginDate } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) id = try container.decodeIfPresent(Int.self, forKey: .id) fullName = try container.decodeIfPresent(String.self, forKey: .fullName) email = try container.decodeIfPresent(String.self, forKey: .email) departmentId = try container.decodeIfPresent(Int.self, forKey: .departmentId) partyGroupId = try container.decodeIfPresent(Int.self, forKey: .partyGroupId) avatar = try container.decodeIfPresent(String.self, forKey: .avatar) telephone = try container.decodeIfPresent(String.self, forKey: .telephone) birthday = try container.decodeIfPresent(Date.self, forKey: .birthday) createdAt = try container.decodeIfPresent(Date.self, forKey: .createdAt) updatedAt = try container.decodeIfPresent(Date.self, forKey: .updatedAt) failedLoginCount = try container.decodeIfPresent(Int.self, forKey: .failedLoginCount) roles = try container.decodeIfPresent([Int].self, forKey: .roles) ?? [] lastLoginDate = try container.decodeIfPresent(Date.self, forKey: .lastLoginDate) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if id != nil { try container.encode(id, forKey: .id) } if fullName != nil { try container.encode(fullName, forKey: .fullName) } if email != nil { try container.encode(email, forKey: .email) } if departmentId != nil { try container.encode(departmentId, forKey: .departmentId) } if partyGroupId != nil { try container.encode(partyGroupId, forKey: .partyGroupId) } if avatar != nil { try container.encode(avatar, forKey: .avatar) } if telephone != nil { try container.encode(telephone, forKey: .telephone) } if birthday != nil { try container.encode(birthday, forKey: .birthday) } if createdAt != nil { try container.encode(createdAt, forKey: .createdAt) } if updatedAt != nil { try container.encode(updatedAt, forKey: .updatedAt) } if failedLoginCount != nil { try container.encode(failedLoginCount, forKey: .failedLoginCount) } if roles.count > 0 { try container.encode(roles, forKey: .roles) } if lastLoginDate != nil { try container.encode(lastLoginDate, forKey: .lastLoginDate) } } } public class UserLogin : Codable { // @Required() public var name:String? required public init(){} } public class AllUserResponse : Codable { public var users:[UserProfile] = [] public var code:Int public var message:String public var totalCount:Int required public init(){} }