add projects controller and API endpoint for project creation
Some checks failed
ci/woodpecker/push/check_fmt Pipeline failed
Some checks failed
ci/woodpecker/push/check_fmt Pipeline failed
This commit is contained in:
parent
1cba641913
commit
4a550904bf
10 changed files with 49 additions and 5 deletions
9
bruno/bruno.json
Normal file
9
bruno/bruno.json
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"version": "1",
|
||||
"name": "pgg-bruno",
|
||||
"type": "collection",
|
||||
"ignore": [
|
||||
"node_modules",
|
||||
".git"
|
||||
]
|
||||
}
|
4
bruno/environments/local-dev.bru
Normal file
4
bruno/environments/local-dev.bru
Normal file
|
@ -0,0 +1,4 @@
|
|||
vars {
|
||||
api_base: http://localhost:8080/api/{{api_version}}
|
||||
api_version: v1
|
||||
}
|
3
bruno/groups/folder.bru
Normal file
3
bruno/groups/folder.bru
Normal file
|
@ -0,0 +1,3 @@
|
|||
meta {
|
||||
name: groups
|
||||
}
|
11
bruno/projects/Create Project.bru
Normal file
11
bruno/projects/Create Project.bru
Normal file
|
@ -0,0 +1,11 @@
|
|||
meta {
|
||||
name: Create Project
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{api_base}}/projects
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
3
bruno/projects/folder.bru
Normal file
3
bruno/projects/folder.bru
Normal file
|
@ -0,0 +1,3 @@
|
|||
meta {
|
||||
name: projects
|
||||
}
|
3
bruno/users/folder.bru
Normal file
3
bruno/users/folder.bru
Normal file
|
@ -0,0 +1,3 @@
|
|||
meta {
|
||||
name: users
|
||||
}
|
|
@ -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));
|
||||
}
|
||||
|
|
10
crates/backend/src/controller/projects.rs
Normal file
10
crates/backend/src/controller/projects.rs
Normal file
|
@ -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<actix_web::HttpResponse> {
|
||||
Ok(actix_web::HttpResponse::Ok().finish())
|
||||
}
|
|
@ -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 = {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
services:
|
||||
db:
|
||||
image: postgres:latest
|
||||
container_name: database
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
- .env
|
||||
|
|
Loading…
Add table
Reference in a new issue