36 lines
866 B
Perl
36 lines
866 B
Perl
package Peace::Model::User;
|
|
|
|
use v5.30.0;
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
use Params::ValidationCompiler qw/validation_for/;
|
|
use Types::Standard qw/Str InstanceOf Bool/;
|
|
|
|
use DateTime;
|
|
|
|
{
|
|
my $validator = validation_for(
|
|
params => {
|
|
username => { type => Str },
|
|
firstname => { type => Str },
|
|
lastname => { type => Str },
|
|
email => { type => Str },
|
|
password => { type => Str },
|
|
date_creation => { type => InstanceOf ['DateTime'], optional => 1 },
|
|
last_connection =>
|
|
{ type => InstanceOf ['DateTime'], optional => 1 },
|
|
verified => { type => Bool },
|
|
}
|
|
);
|
|
|
|
sub new {
|
|
my $class = shift;
|
|
my %params = $validator->(@_);
|
|
my $self = bless {%params}, $class;
|
|
return $self;
|
|
}
|
|
}
|
|
1;
|