From 51cba34a621e322a33c5a47962a3c47049789eab Mon Sep 17 00:00:00 2001 From: Alexandertp Date: Mon, 9 Sep 2024 17:29:39 +0200 Subject: [PATCH] Create migration for image --- API/Persistence/Services/.R2Service.cs.swp | Bin 0 -> 12288 bytes rust-backend/Cargo.lock | 841 +++++++++++++++++- rust-backend/Cargo.toml | 3 + .../migrations/V4__create_images_table.sql | 5 + rust-backend/src/main.rs | 2 + rust-backend/src/models.rs | 17 + 6 files changed, 859 insertions(+), 9 deletions(-) create mode 100644 API/Persistence/Services/.R2Service.cs.swp create mode 100644 rust-backend/migrations/V4__create_images_table.sql diff --git a/API/Persistence/Services/.R2Service.cs.swp b/API/Persistence/Services/.R2Service.cs.swp new file mode 100644 index 0000000000000000000000000000000000000000..6f73e76de95da7ffd5dbfcd6e9008396a1c4ad4e GIT binary patch literal 12288 zcmeI2&u<$=6vw9^fhd%pLgL2M-N8Gp|Bm@WUoH@Y10Cx(4OOL<_gv58ezp@S`XJA(PW`E3^+4ny0%}Q3@p#IA4 z9&K55g5z;QzI)(%_x(H1kT32hM6$pU`uQnGe_de72W$e@>_>i^=!e-cWl=stx9Lh{q|`)Ss?{d(;NrmDthWXm&9!=S ztGU(UY_slev>F?m4bc$wCbyz>OSgKCniG%f*3d!B4}_}CUC$Rc*jOA@+Jt1U(&xg* z?5P?>;UNvgA?=LW+hJfguD->^M0sIQU8!7+qA;TI#1EO{1w*PArYfX%!=l&v{Vuf? zdQv6b2_12X&LbfwVIYNd4N)XRdgQ2bp&a#`WUtp}&!yFS%%tbHsXas2>e#v=)Y7un z&FdG+;c1%LN}$OOnWyM2+1T+t5h$x0tDA#21Xmq73pn2SW-O$FZzXq*%D!q3U-Tp! z_@c{Z8ief)0}W%Fswftvx!U-;m|-YO!Rm?eD~lxQ^uVmLl)K7F``us?D_f!acbu-9 z+>|ZLND~l?@GwVbH;=uSM4h`;Ohn1~9;Zyhp?xL~UXUt6pqJ_Xq5%3~Z@rp2qQgtw zpovu;@v)qg%Pmht>QYv4Np`9{5)QKDF<-7y9tN&ATq>Kt$;?Y(#E};@vegWwd5@H& zP0sthmtm1_F}6{Ee$5#SM4e%yHMh2y>ozwBEw|~kT)wv0Ufd63$MqSiN`(=2u*Jji z@`hVVT0vBogHA;f&2rd_5c53bwgrZC!WAYx-g(tV19%3g$~fA$B}#3TN&#{Tm&=80 zX9HL#H!2r*CtC(4`I3c65lLDbdB1oyO?o~Fek_Wmc+;^uNN1-Og, path: web: } } + #[actix_web::main] async fn main() -> std::io::Result<()> { let _ = dotenvy::dotenv(); diff --git a/rust-backend/src/models.rs b/rust-backend/src/models.rs index c4933ac..1c1bf3c 100644 --- a/rust-backend/src/models.rs +++ b/rust-backend/src/models.rs @@ -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 { + Ok(Image { + id: row.get("id")?, + user_id: row.get("user_id")?, + image_url: row.get("image_url")?, + }) + } +} +