Backend: Added 'profile_pic' in info database. Frontend: Changed the way the profile picture is loaded.

This commit is contained in:
Yohan Boujon 2024-01-30 21:46:57 +01:00
parent cb4cfe26cb
commit 06188f1faa
5 changed files with 4 additions and 3 deletions

View file

@ -12,5 +12,6 @@ CREATE TABLE public.info (
email varchar NULL, email varchar NULL,
softskills text NULL, softskills text NULL,
interests text NULL, interests text NULL,
profile_pic text NULL,
CONSTRAINT info_pkey PRIMARY KEY (id) CONSTRAINT info_pkey PRIMARY KEY (id)
); );

View file

@ -10,6 +10,7 @@ pub struct Info {
pub softskills: Option<String>, pub softskills: Option<String>,
pub interests: Option<String>, pub interests: Option<String>,
pub birth_year: Option<NaiveDate>, pub birth_year: Option<NaiveDate>,
pub profile_pic: Option<String>
} }
#[derive(Deserialize, Serialize)] #[derive(Deserialize, Serialize)]

View file

@ -60,7 +60,7 @@ macro_rules! _gather_data {
async fn info(State(pool): State<PgPool>) -> Json<Vec<Info>> { async fn info(State(pool): State<PgPool>) -> Json<Vec<Info>> {
let datas = sqlx::query_as!( let datas = sqlx::query_as!(
Info, Info,
"SELECT id, full_name, phone_number, email, softskills, interests, birth_year FROM public.info" "SELECT id, full_name, phone_number, email, softskills, interests, birth_year, profile_pic FROM public.info"
) )
.fetch_all(&pool) .fetch_all(&pool)
.await.unwrap_or(vec![]); .await.unwrap_or(vec![]);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 517 KiB

View file

@ -6,7 +6,6 @@
import "$lib/css/cv.css"; import "$lib/css/cv.css";
// Sidebar // Sidebar
import profile_pic from "$lib/img/cvnQU1-W_nowhite_carre.jpg";
import SidebarComponent from "$lib/components/sidebar-component.svelte"; import SidebarComponent from "$lib/components/sidebar-component.svelte";
import { import {
mdiAccount, mdiAccount,
@ -83,7 +82,7 @@
<div class="profile-picture-container"> <div class="profile-picture-container">
<img <img
class="profile-picture" class="profile-picture"
src={profile_pic} src={cv.info.profile_pic}
alt={cv.info.full_name} alt={cv.info.full_name}
/> />
</div> </div>