Skip to content
Snippets Groups Projects
Commit f598bbb1 authored by jm's avatar jm Committed by Éloïs
Browse files

[ref] gva: corrections following review

parent e81ad4c0
No related branches found
No related tags found
1 merge request!226Resolve "GVA: create skeleton & implement current Block request"
......@@ -51,9 +51,14 @@ use dubp_currency_params::CurrencyName;
use durs_common_tools::fatal_error;
use durs_common_tools::traits::merge::Merge;
use durs_conf::DuRsConf;
use durs_message::events::*;
use durs_message::*;
use durs_module::*;
use durs_message::events::{BlockchainEvent, DursEvent};
use durs_message::DursMsg;
use durs_module::{
DursConfTrait, DursModule, ModuleConfError, ModuleEvent, ModulePriority, ModuleRole,
ModuleStaticName, RequiredKeys, RequiredKeysContent, RouterThreadMessage, SoftwareMetaDatas,
};
//use durs_module::*;
use durs_network::events::NetworkEvent;
use std::ops::Deref;
......@@ -257,13 +262,10 @@ impl DursModule<DuRsConf, DursMsg> for GvaModule {
let smd: SoftwareMetaDatas<DuRsConf> = soft_meta_datas.clone();
let router_sender_clone = router_sender.clone();
thread::spawn(move || {
match webserver::start_web_server(&smd) {
Ok(_) => {
info!("GVA http web server stop.");
}
Err(e) => {
if let Err(e) = webserver::start_web_server(&smd) {
error!("GVA http web server error : {} ", e);
}
} else {
info!("GVA http web server stop.")
}
let _result =
router_sender_clone.send(RouterThreadMessage::ModuleMessage(DursMsg::Stop));
......
......@@ -12,6 +12,8 @@
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//
// model and resolvers implementation
use crate::context::Context;
use dubp_block_doc::block::BlockDocumentTrait;
......@@ -21,6 +23,7 @@ use juniper::Executor;
use juniper::FieldResult;
use juniper_from_schema::graphql_schema_from_file;
// generate schema from schema file
graphql_schema_from_file!("resources/schema.gql");
pub struct Query;
......
......@@ -12,13 +12,14 @@
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// web server implementaion based on actix-web
use crate::context;
use crate::schema::*;
use crate::schema::{create_schema, Schema};
use actix_web::{middleware, web, App, Error, HttpResponse, HttpServer};
use durs_common_tools::fatal_error;
use durs_conf::DuRsConf;
use durs_module::*;
use durs_module::SoftwareMetaDatas;
use futures::future::Future;
use juniper::http::graphiql::graphiql_source;
use juniper::http::GraphQLRequest;
......@@ -39,7 +40,7 @@ fn graphql(
let context = crate::context::get_context();
web::block(move || {
let result = data.execute(&schema, context);
Ok::<_, serde_json::error::Error>(serde_json::to_string(&result)?)
serde_json::to_string(&result)
})
.map_err(Error::from)
.and_then(|user| {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment