add projects controller and API endpoint for project creation
Some checks failed
ci/woodpecker/push/check_fmt Pipeline failed

This commit is contained in:
Mika 2025-04-02 10:29:51 +02:00
parent 1cba641913
commit 4a550904bf
10 changed files with 49 additions and 5 deletions

9
bruno/bruno.json Normal file
View file

@ -0,0 +1,9 @@
{
"version": "1",
"name": "pgg-bruno",
"type": "collection",
"ignore": [
"node_modules",
".git"
]
}

View file

@ -0,0 +1,4 @@
vars {
api_base: http://localhost:8080/api/{{api_version}}
api_version: v1
}

3
bruno/groups/folder.bru Normal file
View file

@ -0,0 +1,3 @@
meta {
name: groups
}

View file

@ -0,0 +1,11 @@
meta {
name: Create Project
type: http
seq: 1
}
post {
url: {{api_base}}/projects
body: none
auth: inherit
}

View file

@ -0,0 +1,3 @@
meta {
name: projects
}

3
bruno/users/folder.bru Normal file
View file

@ -0,0 +1,3 @@
meta {
name: users
}

View file

@ -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));
}

View 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())
}

View file

@ -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 = {

View file

@ -1,7 +1,6 @@
services:
db:
image: postgres:latest
container_name: database
restart: unless-stopped
env_file:
- .env