tvpl.api

<back to all web services

LoginHistoryRequest

Lấy lịch sử đăng nhập

Requires Authentication
Required role:super-admin
The following routes are available for this service:
GET/login-history
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class UserLoginHistory:
    id: int = 0
    user_id: int = 0
    # @StringLength(150)
    user_name: Optional[str] = None

    # @StringLength(45)
    ip_address: Optional[str] = None

    # @StringLength(500)
    device_info: Optional[str] = None

    # @StringLength(50)
    login_status: Optional[str] = None

    # @StringLength(500)
    fail_reason: Optional[str] = None

    # @Required()
    created_at: datetime.datetime = datetime.datetime(1, 1, 1)

    provider: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class UserLoginHistoryDto(UserLoginHistory):
    failed_login_count: Optional[int] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class LoginHistoryRespnse(IResponseRequest):
    data: Optional[List[UserLoginHistoryDto]] = None
    total_records: int = 0
    code: int = 0
    message: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class LoginHistoryRequest:
    """
    Lấy lịch sử đăng nhập
    """

    user_id: Optional[int] = None
    user_name: Optional[str] = None
    start_date: Optional[datetime.datetime] = None
    end_date: Optional[datetime.datetime] = None
    page: int = 0
    limit: int = 0

Python LoginHistoryRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

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/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	data: 
	[
		{
			failedLoginCount: 0,
			id: 0,
			userId: 0,
			userName: String,
			ipAddress: String,
			deviceInfo: String,
			loginStatus: String,
			failReason: String,
			provider: String
		}
	],
	totalRecords: 0,
	code: 0,
	message: String
}