lintel 0.2.0
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | List of all members
lintel::UserSessionDto Class Reference

#include <UserSessionDto.h>

Inheritance diagram for lintel::UserSessionDto:
lintel::JsonSerializable

Public Member Functions

 UserSessionDto (const UserToken &userToken)
 
 UserSessionDto ()=default
 
const std::string & getId () const
 
const std::string & getIpAddress () const
 
const std::string & getUserName () const
 
const std::chrono::sys_time< std::chrono::microseconds > & getLastAccessTimestamps () const
 
void serialize (rapidjson::Writer< rapidjson::StringBuffer > *writer) const override
 
bool deserialize (const rapidjson::Value &obj) override
 
- Public Member Functions inherited from lintel::JsonSerializable
 JsonSerializable ()=default
 
virtual ~JsonSerializable ()=default
 
virtual std::string serialize () const
 
virtual void deserialize (const std::string &json)
 

Static Public Member Functions

static std::vector< UserSessionDto > listOf (const std::vector< UserToken > &tokens)
 

Detailed Description

DTO representing an active user session.

Constructor & Destructor Documentation

◆ UserSessionDto() [1/2]

lintel::UserSessionDto::UserSessionDto ( const UserToken &  userToken)
explicit

Construct from a UserToken model

Parameters
userTokenthe source session

◆ UserSessionDto() [2/2]

lintel::UserSessionDto::UserSessionDto ( )
default

Default constructor

Member Function Documentation

◆ deserialize()

bool lintel::UserSessionDto::deserialize ( const rapidjson::Value &  obj)
overridevirtual

Deserialize from JSON

Parameters
objthe JSON value
Returns
true on success

Reimplemented from lintel::JsonSerializable.

◆ getId()

const std::string & lintel::UserSessionDto::getId ( ) const

Get the session id

Returns
the session id

◆ getIpAddress()

const std::string & lintel::UserSessionDto::getIpAddress ( ) const

Get the IP address

Returns
the IP address

◆ getLastAccessTimestamps()

const std::chrono::sys_time< std::chrono::microseconds > & lintel::UserSessionDto::getLastAccessTimestamps ( ) const

Get the last access timestamp

Returns
the last access timestamp

◆ getUserName()

const std::string & lintel::UserSessionDto::getUserName ( ) const

Get the user name

Returns
the user name

◆ listOf()

static std::vector< UserSessionDto > lintel::UserSessionDto::listOf ( const std::vector< UserToken > &  tokens)
static

Build session DTOs from a list of user tokens.

Parameters
tokensthe source sessions
Returns
list of session DTOs

◆ serialize()

void lintel::UserSessionDto::serialize ( rapidjson::Writer< rapidjson::StringBuffer > *  writer) const
overridevirtual

Serialize to JSON

Parameters
writerthe rapidjson writer

Implements lintel::JsonSerializable.


The documentation for this class was generated from the following file: