Create migration for image
This commit is contained in:
parent
c2df5ec80e
commit
51cba34a62
BIN
API/Persistence/Services/.R2Service.cs.swp
Normal file
BIN
API/Persistence/Services/.R2Service.cs.swp
Normal file
Binary file not shown.
841
rust-backend/Cargo.lock
generated
841
rust-backend/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -12,6 +12,9 @@ serde_json = "1.0.124"
|
|||||||
actix-web = "4"
|
actix-web = "4"
|
||||||
actix-utils = "3.0.1"
|
actix-utils = "3.0.1"
|
||||||
dotenvy = "0.15.7"
|
dotenvy = "0.15.7"
|
||||||
|
aws-config = { version = "1.1.7", features = ["behavior-version-latest"] }
|
||||||
|
aws-sdk-s3 = "1.48.0"
|
||||||
|
tokio = { version = "1", features = ["full"] }
|
||||||
refinery = { version = "0.8.14", features = ["rusqlite"] }
|
refinery = { version = "0.8.14", features = ["rusqlite"] }
|
||||||
rusqlite = { version = "0.31", features = ["bundled"] }
|
rusqlite = { version = "0.31", features = ["bundled"] }
|
||||||
reqwest = { version = "0.11.16", features = ["blocking", "json"] }
|
reqwest = { version = "0.11.16", features = ["blocking", "json"] }
|
||||||
|
5
rust-backend/migrations/V4__create_images_table.sql
Normal file
5
rust-backend/migrations/V4__create_images_table.sql
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
CREATE TABLE images (
|
||||||
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
user_id TEXT NOT NULL,
|
||||||
|
image_url TEXT NOT NULL
|
||||||
|
);
|
@ -6,6 +6,7 @@ use std::sync::{Mutex, MutexGuard, Arc};
|
|||||||
use auth::AuthorizedUser;
|
use auth::AuthorizedUser;
|
||||||
use models::{Favorite, Review};
|
use models::{Favorite, Review};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
use aws_sdk_s3 as s3;
|
||||||
|
|
||||||
mod embedded {
|
mod embedded {
|
||||||
use refinery::embed_migrations;
|
use refinery::embed_migrations;
|
||||||
@ -198,6 +199,7 @@ async fn delete_review(auth: AuthorizedUser, data:web::Data<AppData>, path: web:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
async fn main() -> std::io::Result<()> {
|
async fn main() -> std::io::Result<()> {
|
||||||
let _ = dotenvy::dotenv();
|
let _ = dotenvy::dotenv();
|
||||||
|
@ -54,3 +54,20 @@ impl Review {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize)]
|
||||||
|
pub struct Image {
|
||||||
|
pub id: i64,
|
||||||
|
pub user_id: String,
|
||||||
|
pub image_url: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Image {
|
||||||
|
pub fn from_row(row: &Row) -> Resul<Self, Error> {
|
||||||
|
Ok(Image {
|
||||||
|
id: row.get("id")?,
|
||||||
|
user_id: row.get("user_id")?,
|
||||||
|
image_url: row.get("image_url")?,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user