From 16ac140f9deb4e44cf3221df1946bf4347f9cc74 Mon Sep 17 00:00:00 2001
From: sergiotarxz
Date: Fri, 1 Apr 2022 03:45:03 +0200
Subject: [PATCH] Adding the first endpoint which allows to interact by http
with the app.
The POST /developer endpoint is created using the openapi definition
to validate the fields. This will allow a way to create endpoints
and their doc automatically.
---
Build.PL | 2 +
MYMETA.json | 7 +-
bin/peace | 2 +-
doc/index.html | 6 +
doc/lib/Peace.pm.html | 7 +
doc/lib/Peace/Controller/Developer.pm.html | 57 +++++
doc/lib/Peace/Model/Developer.pm.html | 7 +
doc/lib/Peace/Swagger.pm.html | 90 +++++++
lib/Peace.pm | 20 +-
lib/Peace/Controller/Developer.pm | 90 +++++++
lib/Peace/DAO/Developer.pm | 19 +-
lib/Peace/DB.pm | 4 +-
lib/Peace/Model/Developer.pm | 34 ++-
lib/Peace/Swagger.pm | 282 +++++++++++++++++++++
14 files changed, 607 insertions(+), 20 deletions(-)
create mode 100644 doc/lib/Peace/Controller/Developer.pm.html
create mode 100644 doc/lib/Peace/Swagger.pm.html
create mode 100644 lib/Peace/Controller/Developer.pm
create mode 100644 lib/Peace/Swagger.pm
diff --git a/Build.PL b/Build.PL
index 5721bf8..6b7645f 100644
--- a/Build.PL
+++ b/Build.PL
@@ -21,6 +21,8 @@ my $build = Module::Build->new(
'JSON' => 0,
'YAML' => 0,
'Capture::Tiny' => 0,
+ 'Email::Valid' => 0,
+ 'Crypt::Bcrypt' => 0,
},
install_path => {
'templates' => "$HOME/.local/share/peace/template",
diff --git a/MYMETA.json b/MYMETA.json
index 4c40b0c..8ccecc7 100644
--- a/MYMETA.json
+++ b/MYMETA.json
@@ -16,16 +16,21 @@
"prereqs" : {
"runtime" : {
"requires" : {
+ "Capture::Tiny" : "0",
+ "Crypt::Bcrypt" : "0",
"DBD::Mock" : "0",
"DBD::Pg" : "0",
"DBI" : "0",
"DateTime" : "0",
"DateTime::Format::Pg" : "0",
+ "Email::Valid" : "0",
+ "JSON" : "0",
"Mojolicious" : "0",
"Test::MockModule" : "0",
"Test::MockObject" : "0",
"Test::Most" : "0",
- "Test::Pod::Coverage" : "0"
+ "Test::Pod::Coverage" : "0",
+ "YAML" : "0"
}
}
},
diff --git a/bin/peace b/bin/peace
index b22c414..9a94ce1 100755
--- a/bin/peace
+++ b/bin/peace
@@ -69,7 +69,7 @@ if ( !-e $config_path) {
path ($config_path)->spew_utf8(encode_json $config);
}
-Peace::DB->dbh( config => Peace->new->config );
+Peace::DB->dbh( config => Peace->new->peace_config );
@ARGV = ('daemon');
# Start command line interface for application
diff --git a/doc/index.html b/doc/index.html
index 03ea7cc..9d9a655 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -8,6 +8,9 @@
Peace
+
+ Peace::Controller::Developer
+
Peace::Controller::User
@@ -44,6 +47,9 @@
Peace::Model::Release
+
+ Peace::Swagger
+
Peace::Test::Mock::Model::Application
diff --git a/doc/lib/Peace.pm.html b/doc/lib/Peace.pm.html
index 5dbaae7..ba6551b 100644
--- a/doc/lib/Peace.pm.html
+++ b/doc/lib/Peace.pm.html
@@ -18,6 +18,7 @@
FUNCTIONS
@@ -42,6 +43,12 @@
For internal usage from Mojolicious.
+peace_config
+
+my $config = Peace->new->peace_config;
+
+Retrieves the config for the peace application.
+
+
+
+
+
+
+NAME
+
+Peace::Controller::Developer - Developer's http endpoint.
+
+SYNOPSIS
+
+# This object is used by mojolicious.
+
+DESCRIPTION
+
+Peace::Controller::Developer allows to interact using a json http api with the Peace::Model::Developer objects in Peace.
+
+METHODS
+
+Peace::Controller::Developer implements the following methods:
+
+post
+
+# To be used by mojolicious.
+
+Creates a Developer in db with the data given by the user.
+
+SEE ALSO
+
+Peace::Model::Developer, Peace::DAO::Developer
+
+
+
diff --git a/doc/lib/Peace/Controller/Developer.pm.html b/doc/lib/Peace/Controller/Developer.pm.html
new file mode 100644
index 0000000..0f6d6b1
--- /dev/null
+++ b/doc/lib/Peace/Controller/Developer.pm.html
@@ -0,0 +1,57 @@
+
+
+
+