diff --git a/bruno/bruno.json b/bruno/bruno.json new file mode 100644 index 0000000..7dd5cbe --- /dev/null +++ b/bruno/bruno.json @@ -0,0 +1,9 @@ +{ + "version": "1", + "name": "pgg-bruno", + "type": "collection", + "ignore": [ + "node_modules", + ".git" + ] +} \ No newline at end of file diff --git a/bruno/environments/local-dev.bru b/bruno/environments/local-dev.bru new file mode 100644 index 0000000..92ab347 --- /dev/null +++ b/bruno/environments/local-dev.bru @@ -0,0 +1,4 @@ +vars { + api_base: http://localhost:8080/api/{{api_version}} + api_version: v1 +} diff --git a/bruno/groups/folder.bru b/bruno/groups/folder.bru new file mode 100644 index 0000000..28b5117 --- /dev/null +++ b/bruno/groups/folder.bru @@ -0,0 +1,3 @@ +meta { + name: groups +} diff --git a/bruno/projects/Create Project.bru b/bruno/projects/Create Project.bru new file mode 100644 index 0000000..7ad2fa6 --- /dev/null +++ b/bruno/projects/Create Project.bru @@ -0,0 +1,11 @@ +meta { + name: Create Project + type: http + seq: 1 +} + +post { + url: {{api_base}}/projects + body: none + auth: inherit +} diff --git a/bruno/projects/folder.bru b/bruno/projects/folder.bru new file mode 100644 index 0000000..9aadbec --- /dev/null +++ b/bruno/projects/folder.bru @@ -0,0 +1,3 @@ +meta { + name: projects +} diff --git a/bruno/users/folder.bru b/bruno/users/folder.bru new file mode 100644 index 0000000..0805f3a --- /dev/null +++ b/bruno/users/folder.bru @@ -0,0 +1,3 @@ +meta { + name: users +} diff --git a/crates/backend/src/controller.rs b/crates/backend/src/controller.rs index 32d5768..c0fd585 100644 --- a/crates/backend/src/controller.rs +++ b/crates/backend/src/controller.rs @@ -1,5 +1,7 @@ use actix_web::web::{self, ServiceConfig}; +mod projects; + pub fn register_controllers(cfg: &mut ServiceConfig) { - cfg.service(web::scope("/users")); + cfg.service(web::scope("/projects").configure(projects::setup)); } diff --git a/crates/backend/src/controller/projects.rs b/crates/backend/src/controller/projects.rs new file mode 100644 index 0000000..b28bf74 --- /dev/null +++ b/crates/backend/src/controller/projects.rs @@ -0,0 +1,10 @@ +use actix_web::Result; + +pub fn setup(cfg: &mut actix_web::web::ServiceConfig) { + cfg.service(create_project); +} + +#[actix_web::post("")] +async fn create_project() -> Result { + Ok(actix_web::HttpResponse::Ok().finish()) +} diff --git a/crates/backend/src/main.rs b/crates/backend/src/main.rs index cefd4d6..2eeea00 100644 --- a/crates/backend/src/main.rs +++ b/crates/backend/src/main.rs @@ -1,6 +1,6 @@ use actix_files::NamedFile; -use actix_session::{storage::RedisSessionStore, SessionMiddleware}; -use actix_web::{cookie::Key, middleware::Logger, web, App, HttpResponse, HttpServer}; +use actix_session::{SessionMiddleware, storage::RedisSessionStore}; +use actix_web::{App, HttpResponse, HttpServer, cookie::Key, middleware::Logger, web}; use argon2::Argon2; use db::Database; use std::env; @@ -32,7 +32,7 @@ async fn main() -> std::io::Result<()> { redis_conn.clone(), secret_key.clone(), )) - .configure(controller::register_controllers); + .service(web::scope("/api/v1").configure(controller::register_controllers)); #[cfg(feature = "serve")] let app = { diff --git a/dev-compose.yml b/dev-compose.yml index cf84951..296bc54 100644 --- a/dev-compose.yml +++ b/dev-compose.yml @@ -1,7 +1,6 @@ services: db: image: postgres:latest - container_name: database restart: unless-stopped env_file: - .env