🏡 index : ~doyle/chartered.git

author Jordan Doyle <jordan@doyle.la> 2021-10-07 0:51:20.0 +01:00:00
committer Jordan Doyle <jordan@doyle.la> 2021-10-07 0:51:20.0 +01:00:00
commit
e60c01fc33eb15184f0ceeb001811272723d3526 [patch]
tree
391e0215131bf7fb426b21422fbddbfbe488e5a8
parent
0a4f4b1b104c2bac8f0354478fa4628401f8f6d0
download
e60c01fc33eb15184f0ceeb001811272723d3526.tar.gz

UNIQUE constraint on ssh keys



Diff

 migrations/2021-08-31-214501_create_crates_table/up.sql | 2 +-
 chartered-frontend/src/pages/Dashboard.tsx              | 2 +-
 chartered-web/src/endpoints/web_api/ssh_key.rs          | 2 +-
 chartered-web/src/endpoints/web_api/users/info.rs       | 2 +-
 chartered-web/src/endpoints/web_api/users/search.rs     | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/migrations/2021-08-31-214501_create_crates_table/up.sql b/migrations/2021-08-31-214501_create_crates_table/up.sql
index 3992d01..3c136d1 100644
--- a/migrations/2021-08-31-214501_create_crates_table/up.sql
+++ a/migrations/2021-08-31-214501_create_crates_table/up.sql
@@ -77,7 +77,7 @@
    uuid BINARY(128) NOT NULL UNIQUE,
    name VARCHAR(255) NOT NULL,
    user_id INTEGER NOT NULL,
    ssh_key BLOB NOT NULL,
    ssh_key BLOB NOT NULL UNIQUE,
    created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    last_used_at DATETIME,
    FOREIGN KEY (user_id) REFERENCES users (id)
diff --git a/chartered-frontend/src/pages/Dashboard.tsx b/chartered-frontend/src/pages/Dashboard.tsx
index bc5deff..0db2797 100644
--- a/chartered-frontend/src/pages/Dashboard.tsx
+++ a/chartered-frontend/src/pages/Dashboard.tsx
@@ -37,7 +37,7 @@
          permissions are granted to others.
        </p>
        <a
          href="https://github.com/w4/chartered"
          href="https://book.chart.rs/"
          target="_blank"
          className="btn btn-outline-light shadow-sm"
        >
diff --git a/chartered-web/src/endpoints/web_api/ssh_key.rs b/chartered-web/src/endpoints/web_api/ssh_key.rs
index d8c7217..b71d96e 100644
--- a/chartered-web/src/endpoints/web_api/ssh_key.rs
+++ a/chartered-web/src/endpoints/web_api/ssh_key.rs
@@ -82,7 +82,7 @@

#[derive(Error, Debug)]
pub enum Error {
    #[error("Failed to query database")]
    #[error("{0}")]
    Database(#[from] chartered_db::Error),
    #[error("Failed to parse SSH key: {0}")]
    KeyParse(chartered_db::Error),
diff --git a/chartered-web/src/endpoints/web_api/users/info.rs b/chartered-web/src/endpoints/web_api/users/info.rs
index 221d581..3349b5f 100644
--- a/chartered-web/src/endpoints/web_api/users/info.rs
+++ a/chartered-web/src/endpoints/web_api/users/info.rs
@@ -39,7 +39,7 @@

#[derive(Error, Debug)]
pub enum Error {
    #[error("Failed to query database")]
    #[error("{0}")]
    Database(#[from] chartered_db::Error),
    #[error("User doesn't exist")]
    NotFound,
diff --git a/chartered-web/src/endpoints/web_api/users/search.rs b/chartered-web/src/endpoints/web_api/users/search.rs
index 9278150..b422beb 100644
--- a/chartered-web/src/endpoints/web_api/users/search.rs
+++ a/chartered-web/src/endpoints/web_api/users/search.rs
@@ -37,7 +37,7 @@

#[derive(Error, Debug)]
pub enum Error {
    #[error("Failed to query database")]
    #[error("{0}")]
    Database(#[from] chartered_db::Error),
}