Adding documentation for all models and a test to check all documentation.

This commit is contained in:
sergiotarxz 2022-03-17 17:32:56 +01:00
parent 0b0a8991c3
commit 57b73c1b14
7 changed files with 307 additions and 19 deletions

View File

@ -3,24 +3,25 @@ use Module::Build;
my $home = $ENV{HOME};
my $build = Module::Build->new(
module_name => 'Peace',
license => 'AGPLv3',
dist_author => 'Sergio Iglesias <sergiotarxz@posteo.net>',
module_name => 'Peace',
license => 'AGPLv3',
dist_author => 'Sergio Iglesias <sergiotarxz@posteo.net>',
dist_abstract => 'Peace application shop.',
requires => {
'Mojolicious' => 0,
'DBI' => 0,
'DBD::Pg' => 0,
'DBD::Mock' => 0,
'DateTime' => 0,
requires => {
'Mojolicious' => 0,
'DBI' => 0,
'DBD::Pg' => 0,
'DBD::Mock' => 0,
'DateTime' => 0,
'DateTime::Format::Pg' => 0,
'Test::Most' => 0,
'Test::MockObject' => 0,
'Test::MockModule' => 0,
'Test::Most' => 0,
'Test::MockObject' => 0,
'Test::MockModule' => 0,
'Test::Pod::Coverage' => 0,
},
install_path => {
'templates' => "$HOME/.local/share/peace/template",
'public' => "$HOME/.local/share/peace/public",
'public' => "$HOME/.local/share/peace/public",
}
);
$build->create_build_script;

View File

@ -24,7 +24,8 @@
"Mojolicious" : "0",
"Test::MockModule" : "0",
"Test::MockObject" : "0",
"Test::Most" : "0"
"Test::Most" : "0",
"Test::Pod::Coverage" : "0"
}
}
},

View File

@ -38,4 +38,12 @@ Peace - Onlie GNU/Linux flatpak apps store.
Peace is the server backend for flatstore a shop
to be able to sell or buy flatpak applications.
=head1 FUNCTIONS
Peace implements the following functions:
=head2 startup
For internal usage from Mojolicious.
=cut

View File

@ -178,7 +178,7 @@ use DateTime;
}
{
my $validator =
my $validator =
validation_for( params => [ { type => Str, optional => 1 } ] );
sub git_repo {
@ -196,3 +196,138 @@ sub _dbh {
return $self->{dbh};
}
1;
=encoding utf8
=head1 NAME
Peace::Model::Application - The application object representation.
=head1 SYNOPSIS
my $application = Peace::Model::Application->new(
name => $name,
description => $description,
url => $url,
developer => $developer,
price => $price,
git_repo => $git_repo,
flatpak_builder_file => $flatpak_builder_file,
verified => $verified,
);
=head1 DESCRIPTION
Describes a application from Peace for sale.
=head1 INSTANCE METHODS
Peace::Model::Application implements the following instance methods:
=head2 new
my $application = Peace::Model::Application->new(
uuid => $uuid, # optional
date_creation => $date_creation, # optional
name => $name,
description => $description,
url => $url,
developer => $developer, # required or developer_uuid should be passed.
developer_uuid => $developer_uuid, # required or developer should be passed.
dbh => $dbh, # needed if developer_uuid is passed.
price => $price,
git_repo => $git_repo,
flatpak_builder_file => $flatpak_builder_file,
verified => $verified,
);
=head1 METHODS
Peace::Model::Application implements the following methods:
=head2 uuid
my $uuid = $application->uuid;
$application->uuid($uuid);
Allows to retrieve and set the application's uuid.
=head2 date_creation
my $date_creation = $application->date_creation;
$application->date_creation($date_creation);
Allows to retrieve and set the application's date_creation.
=head2 name
my $name = $application->name;
$application->name($name);
Allows to retrieve and set the application's name.
=head2 description
my $description = $application->description;
$application->description($description);
Allows to retrieve and set the application's description.
=head2 url
my $url = $application->url;
$application->url($url);
Allows to retrieve and set the application's url.
=head2 developer
my $developer = $application->developer;
$application->developer($developer);
Allows to retrieve and set the application's developer which
is a L<Peace::Model::Developer>.
=head2 price
my $price = $application->price;
$application->price($price);
Allows to retrieve and set the application's price.
=head2 git_repo
my $git_repo = $application->git_repo;
$application->git_repo($git_repo);
Allows to retrieve and set the application's git_repo.
=head2 flatpak_builder_file
my $flatpak_builder_file = $application->flatpak_builder_file;
$application->flatpak_builder_file($flatpak_builder_file);
Allows to retrieve and set the application's flatpak_builder_file.
=head2 verified
my $verified = $application->verified;
$application->verified($verified);
Allows to retrieve and set the application's verified status.
=head1 SEE ALSO
L<Peace::Model::Developer>, L<Peace::DAO::Application>
=cut

View File

@ -88,7 +88,7 @@ use DateTime;
=head1 NAME
Peace::Model::Customer - The customer object representation
Peace::Model::Customer - The customer object representation.
=head1 SYNOPSIS
@ -125,7 +125,7 @@ Peace::Model::Customer implements the following methods:
$customer->uuid($uuid);
Allows to retrive and set the customer uuid.
Allows to retrieve and set the customer uuid.
=head2 date_creation
@ -133,7 +133,7 @@ Allows to retrive and set the customer uuid.
$customer->date_creation($date_creation);
Allows to retrive and set the customer date_creation.
Allows to retrieve and set the customer date_creation.
=head2 secret_bcrypt
@ -141,7 +141,7 @@ Allows to retrive and set the customer date_creation.
$customer->secret_bcrypt($secret_bcrypt);
Allows to retrive and set the customer secret_bcrypt.
Allows to retrieve and set the customer secret_bcrypt.
=head2 stripe_id

View File

@ -181,3 +181,130 @@ sub _dbh {
return $self->{dbh};
}
1;
=encoding utf8
=head1 NAME
Peace::Model::Developer - The developer object representation.
=head1 SYNOPSIS
my $developer = Peace::Model::Developer->new(
secret_bcrypt => $secret_bcrypt,
name => $name,
surname => $surname,
email => $email,
country => $country,
verified => $verified,
);
=head1 DESCRIPTION
Describes a developer capable of submit Applications to Peace
and get money.
=head1 INSTANCE METHODS
Peace::Model::Developer implements the following instance methods:
=head2 new
my $developer = Peace::Model::Developer->new(
uuid => $uuid, # optional
date_creation => $date_creation, # optional
secret_bcrypt => $secret_bcrypt,
name => $name,
surname => $surname,
email => $email,
stripe_id => $stripe_id, # optional
country => $country,
verified => $verified,
dbh => $dbh, # optional, allows to retrieve applications
);
=head1 METHODS
Peace::Model::Developer implements the following methods:
=head2 applications
my $applications = $developer->applications;
Allows to retrieve the developer's applications which is a arrayref of
L<Peace::Model::Application>.
=head2 uuid
my $uuid = $developer->uuid;
$developer->uuid($uuid);
Allows to retrieve and set the developer uuid.
=head2 date_creation
my $date_creation = $developer->date_creation;
$developer->date_creation($date_creation);
Allows to retrieve and set the developer date_creation.
=head2 secret_bcrypt
my $secret_bcrypt = $developer->secret_bcrypt;
$developer->secret_bcrypt($secret_bcrypt);
Allows to retrieve and set the developer secret_bcrypt.
=head2 name
my $name = $developer->name;
$developer->name($name);
Allows to retrieve and set the developer name.
=head2 surname
my $surname = $developer->surname;
$developer->surname($surname);
=head2 email
my $email = $developer->email;
$developer->email($email);
Allows to retrieve and set the developer email.
=head2 stripe_id
my $stripe_id = $developer->stripe_id;
$developer->stripe_id($stripe_id);
Allows to retrieve and set the developer stripe_id.
=head2 country
my $country = $developer->country;
$developer->country($country);
Allows to retrieve and set the developer country.
=head2 verified
my $verified = $developer->verified
$developer->verified($verified);
Allows to retrieve and set the developer verified.
=head1 SEE ALSO
L<Peace::DAO::Developer>, L<Peace::Model::Application>
=cut

16
t/00009-pod-coverage.t Normal file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env perl
use v5.30.0;
use strict;
use warnings;
use Test::Most tests => 1;
use Test::Pod::Coverage;
{
my @modules = Test::Pod::Coverage::all_modules;
for my $module (@modules) {
pod_coverage_ok($module);
}
}