Skip to content

Instantly share code, notes, and snippets.

View Mr-Malomz's full-sized avatar

Demola Malomo Mr-Malomz

  • Lagos, Nigeria
View GitHub Profile
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;
//imports goes here
pub struct DBMongo {
db: Database,
}
impl DBMongo {
pub fn init() -> Self {
//init code goes here
}
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,
//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]
mod config;
mod handler;
mod schemas;
//add
use actix_web::{
guard,
web::{self, Data},
App, HttpResponse, HttpServer,
};
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;
pub mod mongo;
//imports goes here
pub struct DBMongo {
db: Database,
}
impl DBMongo {
pub async fn init() -> Self {
//init code goes here
}
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 {
pub mod project_schema;