This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use crate::{ | |
config::mongo::DBMongo, | |
schemas::project_schema::{ | |
CreateOwner, CreateProject, FetchOwner, FetchProject, Owner, Project, | |
}, | |
}; | |
use async_graphql::{Context, EmptySubscription, FieldResult, Object, Schema}; | |
pub struct Query; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//imports goes here | |
pub struct DBMongo { | |
db: Database, | |
} | |
impl DBMongo { | |
pub fn init() -> Self { | |
//init code goes here | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use dotenv::dotenv; | |
use std::{env, io::Error}; | |
use mongodb::{ | |
bson::{doc, oid::ObjectId}, | |
sync::{Client, Collection, Database}, | |
}; | |
use crate::schemas::project_schema::{Owner, Project}; | |
pub struct DBMongo { | |
db: Database, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//other code section goes here | |
[dependencies] | |
rocket = {version = "0.5.0-rc.2", features = ["json"]} | |
async-graphql = { version = "4.0", features = ["bson", "chrono"] } | |
async-graphql-rocket = "4.0.0" | |
serde = "1.0.136" | |
dotenv = "0.15.0" | |
[dependencies.mongodb] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mod config; | |
mod handler; | |
mod schemas; | |
//add | |
use actix_web::{ | |
guard, | |
web::{self, Data}, | |
App, HttpResponse, HttpServer, | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use crate::{ | |
config::mongo::DBMongo, | |
schemas::project_schema::{ | |
CreateOwner, CreateProject, FetchOwner, FetchProject, Owner, Project, | |
}, | |
}; | |
use async_graphql::{Context, EmptySubscription, FieldResult, Object, Schema}; | |
pub struct Query; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub mod mongo; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//imports goes here | |
pub struct DBMongo { | |
db: Database, | |
} | |
impl DBMongo { | |
pub async fn init() -> Self { | |
//init code goes here | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use dotenv::dotenv; | |
use futures::TryStreamExt; | |
use std::{env, io::Error}; | |
use mongodb::{ | |
bson::{doc, oid::ObjectId}, | |
Client, Collection, Database, | |
}; | |
use crate::schemas::project_schema::{Owner, Project}; | |
pub struct DBMongo { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub mod project_schema; |