Add multipart

This commit is contained in:
Adrian Wozniak 2020-05-01 21:40:32 +02:00
parent f2cc69bcdd
commit 704cddc6e7
7 changed files with 82 additions and 0 deletions

21
.builds/client.yml Normal file
View File

@ -0,0 +1,21 @@
image: archlinux
packages:
- nodejs
- rustup
sources:
- https://git.sr.ht/~tsumanu/jirs
environment:
deploy: adrian.wozniak@ita-prog.pl
secrets:
- 7ebab768-e5e4-4c9d-ba57-ec41a72c5665
tasks:
- setup: |
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- test: |
cd jirs/jirs-client
wasm-pack test --node
- build: |
cd jirs/jirs-client
wasm-pack build --release
- deploy: |
cd jirs

23
.builds/server.yml Normal file
View File

@ -0,0 +1,23 @@
image: shepmaster/rust-nightly
packages:
- postgresql
sources:
- https://git.sr.ht/~tsumanu/jirs
environment:
deploy: adrian.wozniak@ita-prog.pl
secrets:
- 7ebab768-e5e4-4c9d-ba57-ec41a72c5665
tasks:
- setup: |
sudo systemctl start postgresql
cargo install diesel_cli --no-default-features --features postgres
cd jirs/jirs-server
diesel migration run
- test: |
cd jirs/jirs-server
cargo test --bin jirs_server
- build: |
cd jirs
cargo build --all --release
- deploy: |
cd jirs

20
Cargo.lock generated
View File

@ -128,6 +128,25 @@ dependencies = [
"syn",
]
[[package]]
name = "actix-multipart"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4397935fca2a37a5353f94faa758fb176712806f605466b5a60373b204f0d836"
dependencies = [
"actix-service",
"actix-utils",
"actix-web",
"bytes",
"derive_more",
"futures 0.3.4",
"httparse",
"log 0.4.8",
"mime",
"time",
"twoway",
]
[[package]]
name = "actix-router"
version = "0.2.4"
@ -1424,6 +1443,7 @@ version = "0.1.0"
dependencies = [
"actix",
"actix-cors",
"actix-multipart",
"actix-rt",
"actix-service",
"actix-web",

View File

@ -44,3 +44,7 @@ cd jirs_client
yarn
yarn webpack-dev-server
```
## Issue trackers
https://todo.sr.ht/~tsumanu/JIRS

View File

@ -20,6 +20,7 @@ actix-cors = { version = "*" }
actix-service = { version = "*" }
actix-rt = "1"
actix-web-actors = "*"
actix-multipart = { version = "*" }
dotenv = { version = "*" }
byteorder = "1.0"

View File

@ -0,0 +1,11 @@
use actix_web::{get, post, web, HttpResponse, Responder};
#[post("/")]
async fn upload() -> impl Responder {
HttpResponse::Ok().json("")
}
#[get("/{id}")]
async fn download(id: web::Path<i32>) -> impl Responder {
HttpResponse::Ok().json("")
}

View File

@ -12,6 +12,8 @@ use crate::db::DbExecutor;
use crate::errors::ServiceErrors;
use crate::middleware::authorize::token_from_headers;
pub mod avatar;
pub async fn user_from_request(
req: HttpRequest,
db: &Data<Addr<DbExecutor>>,