1
0
Fork 0

Add column employees.image

This commit is contained in:
Alex Kotov 2020-10-21 11:38:49 +05:00
parent 80a2f3d70e
commit 35d620f1ab
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
6 changed files with 9 additions and 4 deletions

View file

@ -2,6 +2,7 @@
CREATE TABLE employees (
id SERIAL PRIMARY KEY,
image VARCHAR NOT NULL,
name VARCHAR NOT NULL,
role VARCHAR NOT NULL
);
@ -34,8 +35,8 @@ CREATE UNIQUE INDEX index_employee_contacts_on_employee_id
-- Insert data
WITH employee_ids AS (
INSERT INTO employees (name, role)
VALUES ('Alex Kotov', 'Founder')
INSERT INTO employees (image, name, role)
VALUES ('/kotovalexarian.jpg', 'Alex Kotov', 'Founder')
RETURNING id
AS employee_id
)
@ -51,8 +52,8 @@ WITH employee_ids AS (
'https://fb.com/kotovalexarian');
WITH employee_ids AS (
INSERT INTO employees (name, role)
VALUES ('Kirill Goncharov', 'System administrator')
INSERT INTO employees (image, name, role)
VALUES ('/xuhcc.png', 'Kirill Goncharov', 'System administrator')
RETURNING id
AS employee_id
)

BIN
public/kotovalexarian.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

BIN
public/xuhcc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

View file

@ -9,6 +9,7 @@ use diesel::prelude::*;
#[derive(Debug, Identifiable, Serialize, Queryable)]
pub struct Employee {
pub id: i32,
pub image: String,
pub name: String,
pub role: String,
}

View file

@ -20,6 +20,7 @@ table! {
table! {
employees (id) {
id -> Int4,
image -> Varchar,
name -> Varchar,
role -> Varchar,
}

View file

@ -3,6 +3,8 @@
{{#each employees_with_contacts}}
<div class="col-sm-6 col-lg-4">
<div class="card mt-4">
<img src="{{ this.0.image }}" class="card-img-top"/>
<div class="card-body">
<h5 class="card-title">
{{ this.0.name }}