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

#include <UserDto.h>

Inheritance diagram for lintel::UserDto:
lintel::JsonSerializable

Public Member Functions

const std::string & getFirstName () const
 
const std::string & getLastName () const
 
const std::string & getEMail () const
 
const std::string & getUserName () const
 
const std::string & getId () const
 
User::Sex getSex () const
 
std::vector< GroupDto > getGroups () const
 
const std::chrono::sys_time< std::chrono::microseconds > & getCreatedTimestamp () const
 
const std::optional< std::string > & getPassword () const
 
void setPassword (const std::string &password)
 
 UserDto (const User &user, std::string id="")
 
 UserDto ()=default
 
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)
 

Detailed Description

DTO representing a user

Constructor & Destructor Documentation

◆ UserDto() [1/2]

lintel::UserDto::UserDto ( const User &  user,
std::string  id = "" 
)
explicit

Construct from a User model

Parameters
userThe source user
idOptional user ID

◆ UserDto() [2/2]

lintel::UserDto::UserDto ( )
default

Default constructor

Member Function Documentation

◆ deserialize()

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

Deserialize from JSON

Parameters
objThe JSON value
Returns
True on success

Reimplemented from lintel::JsonSerializable.

◆ getCreatedTimestamp()

const std::chrono::sys_time< std::chrono::microseconds > & lintel::UserDto::getCreatedTimestamp ( ) const

Get the account creation timestamp

Returns
The timestamp

◆ getEMail()

const std::string & lintel::UserDto::getEMail ( ) const

Get the email address

Returns
The email

◆ getFirstName()

const std::string & lintel::UserDto::getFirstName ( ) const

Get the first name

Returns
The first name

◆ getGroups()

std::vector< GroupDto > lintel::UserDto::getGroups ( ) const

Get the groups this user belongs to

Returns
Vector of group DTOs

◆ getId()

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

Get the user ID

Returns
The ID

◆ getLastName()

const std::string & lintel::UserDto::getLastName ( ) const

Get the last name

Returns
The last name

◆ getPassword()

const std::optional< std::string > & lintel::UserDto::getPassword ( ) const

Get the password (only used for creating a user)

Returns
Optional password string

◆ getSex()

User::Sex lintel::UserDto::getSex ( ) const

Get the sex

Returns
The sex

◆ getUserName()

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

Get the user name

Returns
The user name

◆ serialize()

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

Serialize to JSON

Parameters
writerThe rapidjson writer

Implements lintel::JsonSerializable.

◆ setPassword()

void lintel::UserDto::setPassword ( const std::string &  password)

Set the password

Parameters
passwordThe password to set

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