| Required role: | super-admin |
| GET | /login-history |
|---|
import Foundation
import ServiceStack
/**
* Lấy lịch sử đăng nhập
*/
public class LoginHistoryRequest : Codable
{
public var userId:Int?
public var userName:String
public var startDate:Date?
public var endDate:Date?
public var page:Int
public var limit:Int
required public init(){}
}
public class LoginHistoryRespnse : IResponseRequest, Codable
{
public var data:[UserLoginHistoryDto] = []
public var totalRecords:Int
public var code:Int
public var message:String
required public init(){}
}
public class UserLoginHistoryDto : UserLoginHistory
{
public var failedLoginCount:Int?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case failedLoginCount
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
failedLoginCount = try container.decodeIfPresent(Int.self, forKey: .failedLoginCount)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if failedLoginCount != nil { try container.encode(failedLoginCount, forKey: .failedLoginCount) }
}
}
public class UserLoginHistory : Codable
{
public var id:Int
public var userId:Int
// @StringLength(150)
public var userName:String
// @StringLength(45)
public var ipAddress:String
// @StringLength(500)
public var deviceInfo:String
// @StringLength(50)
public var loginStatus:String
// @StringLength(500)
public var failReason:String
// @Required()
public var createdAt:Date?
public var provider:String
required public init(){}
}
Swift LoginHistoryRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /login-history HTTP/1.1 Host: etc-api.vsmlab.vn Accept: text/jsonl
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length
{"data":[{"failedLoginCount":0,"id":0,"userId":0,"userName":"String","ipAddress":"String","deviceInfo":"String","loginStatus":"String","failReason":"String","createdAt":"0001-01-01T00:00:00.0000000+07:06","provider":"String"}],"totalRecords":0,"code":0,"message":"String"}