summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCara Salter <cara@devcara.com>2022-06-10 12:44:46 -0400
committerCara Salter <cara@devcara.com>2022-06-10 12:45:02 -0400
commitb4f44d8fa362ddf3f63ba01f03ea14b072b8e76c (patch)
tree9a3f9d8855e7e2d718805acca5461b7e83e17bd9
parent986931c289f80c4d64ae2380ab40bcf6ba7cc75a (diff)
downloadhomeworld-b4f44d8fa362ddf3f63ba01f03ea14b072b8e76c.tar.gz
homeworld-b4f44d8fa362ddf3f63ba01f03ea14b072b8e76c.zip
Prepare for nix compilation
-rw-r--r--Cargo.lock6
-rw-r--r--Cargo.toml1
-rw-r--r--sqlx-data.json116
-rw-r--r--src/handlers/ships.rs2
4 files changed, 124 insertions, 1 deletions
diff --git a/Cargo.lock b/Cargo.lock
index d43b979..ba9ce1b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -314,6 +314,9 @@ name = "either"
version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
+dependencies = [
+ "serde",
+]
[[package]]
name = "event-listener"
@@ -1311,9 +1314,12 @@ dependencies = [
"dotenv",
"either",
"heck",
+ "hex",
"once_cell",
"proc-macro2",
"quote",
+ "serde",
+ "serde_json",
"sha2",
"sqlx-core",
"sqlx-rt",
diff --git a/Cargo.toml b/Cargo.toml
index afb3d62..33e2464 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -53,5 +53,6 @@ features = [
"runtime-tokio-rustls",
"postgres",
"macros",
+ "offline",
"migrate"
]
diff --git a/sqlx-data.json b/sqlx-data.json
new file mode 100644
index 0000000..3e0bb1e
--- /dev/null
+++ b/sqlx-data.json
@@ -0,0 +1,116 @@
+{
+ "db": "PostgreSQL",
+ "3947077ca2e96d2ba5a6e881c0f5e2c409aaf2cd6dc89b2e1f08e4767d8d368d": {
+ "describe": {
+ "columns": [],
+ "nullable": [],
+ "parameters": {
+ "Left": [
+ "Text"
+ ]
+ }
+ },
+ "query": "DELETE FROM ships WHERE shasum=$1"
+ },
+ "45e5c240bd23bf17c979b8eb0164b4163b9cd746953c52aa1c0f4376386354d8": {
+ "describe": {
+ "columns": [],
+ "nullable": [],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text",
+ "Text",
+ "Text"
+ ]
+ }
+ },
+ "query": "INSERT INTO ships (name, shasum, download_url, version) VALUES ($1, $2, $3, $4)"
+ },
+ "4be4721aaeadb137958918bd3389be9fd3b2dc7e646fb646bcff945fcc43b4af": {
+ "describe": {
+ "columns": [
+ {
+ "name": "id",
+ "ordinal": 0,
+ "type_info": "Int4"
+ },
+ {
+ "name": "name",
+ "ordinal": 1,
+ "type_info": "Text"
+ },
+ {
+ "name": "shasum",
+ "ordinal": 2,
+ "type_info": "Text"
+ },
+ {
+ "name": "download_url",
+ "ordinal": 3,
+ "type_info": "Text"
+ },
+ {
+ "name": "version",
+ "ordinal": 4,
+ "type_info": "Text"
+ }
+ ],
+ "nullable": [
+ false,
+ false,
+ false,
+ false,
+ false
+ ],
+ "parameters": {
+ "Left": [
+ "Text"
+ ]
+ }
+ },
+ "query": "SELECT * FROM ships WHERE shasum=$1"
+ },
+ "9ff792bf0c581c558450ae2da8fe53dcd3e81a9b1539f2598ba9d4c6cdf4122f": {
+ "describe": {
+ "columns": [
+ {
+ "name": "id",
+ "ordinal": 0,
+ "type_info": "Int4"
+ },
+ {
+ "name": "name",
+ "ordinal": 1,
+ "type_info": "Text"
+ },
+ {
+ "name": "shasum",
+ "ordinal": 2,
+ "type_info": "Text"
+ },
+ {
+ "name": "download_url",
+ "ordinal": 3,
+ "type_info": "Text"
+ },
+ {
+ "name": "version",
+ "ordinal": 4,
+ "type_info": "Text"
+ }
+ ],
+ "nullable": [
+ false,
+ false,
+ false,
+ false,
+ false
+ ],
+ "parameters": {
+ "Left": []
+ }
+ },
+ "query": "SELECT * FROM ships"
+ }
+} \ No newline at end of file
diff --git a/src/handlers/ships.rs b/src/handlers/ships.rs
index 42367ea..9d985ea 100644
--- a/src/handlers/ships.rs
+++ b/src/handlers/ships.rs
@@ -29,7 +29,7 @@ pub async fn new(Json(new_ship): Json<Ship>, state: Extension<Arc<State>>, AuthB
Ok("OK")
}
-pub async fn delete(Path(shasum): Path<Sha256>, state: Extension<Arc<State>>) -> StringResult {
+pub async fn delete(Path(shasum): Path<Sha256>, state: Extension<Arc<State>>, AuthBearer(token): AuthBearer) -> StringResult {
check_bearer(token)?;
let mut conn = state.conn.acquire().await?;