fix: update sqlx and fix container build
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
closes: #14
This commit is contained in:
parent
4f224d782a
commit
9e153b22ca
12 changed files with 424 additions and 394 deletions
531
Cargo.lock
generated
531
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -36,7 +36,7 @@ actix-web-codegen-const-routes = { version = "0.1.0", tag = "0.1.0", git = "http
|
||||||
|
|
||||||
futures = "0.3.15"
|
futures = "0.3.15"
|
||||||
|
|
||||||
sqlx = { version = "0.5.9", features = [ "runtime-actix-rustls", "postgres", "time", "offline" ] }
|
sqlx = { version = "0.6.2", features = [ "runtime-actix-rustls", "postgres", "time", "offline" ] }
|
||||||
|
|
||||||
argon2-creds = { branch = "master", git = "https://github.com/realaravinth/argon2-creds"}
|
argon2-creds = { branch = "master", git = "https://github.com/realaravinth/argon2-creds"}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ version = "0.2"
|
||||||
|
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
sqlx = { version = "0.5.9", features = [ "runtime-actix-rustls", "uuid", "postgres", "time", "offline" ] }
|
sqlx = { version = "0.6.2", features = [ "runtime-actix-rustls", "uuid", "postgres", "time", "offline" ] }
|
||||||
#serde_yaml = "0.8.17"
|
#serde_yaml = "0.8.17"
|
||||||
serde_json = "1"
|
serde_json = "1"
|
||||||
#yaml-rust = "0.4.5"
|
#yaml-rust = "0.4.5"
|
||||||
|
|
214
sqlx-data.json
214
sqlx-data.json
|
@ -1,18 +1,5 @@
|
||||||
{
|
{
|
||||||
"db": "PostgreSQL",
|
"db": "PostgreSQL",
|
||||||
"03c9789e83a398bed96354924a0e63ccaa97bec667fda1b8277bb9afda9a6fcd": {
|
|
||||||
"describe": {
|
|
||||||
"columns": [],
|
|
||||||
"nullable": [],
|
|
||||||
"parameters": {
|
|
||||||
"Left": [
|
|
||||||
"Text",
|
|
||||||
"Uuid"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"query": "DELETE \n FROM survey_campaigns \n WHERE \n user_id = (\n SELECT \n ID \n FROM \n survey_admins \n WHERE \n name = $1\n )\n AND\n id = ($2)"
|
|
||||||
},
|
|
||||||
"0d22134cc5076304b7895827f006ee8269cc500f400114a7472b83f0f1c568b5": {
|
"0d22134cc5076304b7895827f006ee8269cc500f400114a7472b83f0f1c568b5": {
|
||||||
"describe": {
|
"describe": {
|
||||||
"columns": [],
|
"columns": [],
|
||||||
|
@ -27,6 +14,32 @@
|
||||||
},
|
},
|
||||||
"query": "INSERT INTO survey_admins \n (name , password, secret) VALUES ($1, $2, $3)"
|
"query": "INSERT INTO survey_admins \n (name , password, secret) VALUES ($1, $2, $3)"
|
||||||
},
|
},
|
||||||
|
"117f1ae18f6a3936f27446b75b555951fe217d3a3cefe40a006fdd3cb31f0ac4": {
|
||||||
|
"describe": {
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"ordinal": 0,
|
||||||
|
"type_info": "Int4"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nullable": [
|
||||||
|
false
|
||||||
|
],
|
||||||
|
"parameters": {
|
||||||
|
"Left": [
|
||||||
|
"Uuid",
|
||||||
|
"Uuid",
|
||||||
|
"Varchar",
|
||||||
|
"Varchar",
|
||||||
|
"Int4",
|
||||||
|
"Timestamptz",
|
||||||
|
"Text"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"query": "INSERT INTO survey_responses (\n user_id,\n campaign_id,\n device_user_provided,\n device_software_recognised,\n threads,\n submitted_at,\n submission_bench_type_id\n ) VALUES (\n $1, $2, $3, $4, $5, $6,\n (SELECT ID FROM survey_bench_type WHERE name = $7)\n )\n RETURNING ID;"
|
||||||
|
},
|
||||||
"1373df097fa0e58b23a374753318ae53a44559aa0e7eb64680185baf1c481723": {
|
"1373df097fa0e58b23a374753318ae53a44559aa0e7eb64680185baf1c481723": {
|
||||||
"describe": {
|
"describe": {
|
||||||
"columns": [
|
"columns": [
|
||||||
|
@ -73,6 +86,19 @@
|
||||||
},
|
},
|
||||||
"query": "SELECT name, password FROM survey_admins WHERE email = ($1)"
|
"query": "SELECT name, password FROM survey_admins WHERE email = ($1)"
|
||||||
},
|
},
|
||||||
|
"1972be28a6bda2c3a3764a836e95c8cb0c5db277fc4c8a9b19951a03166c6492": {
|
||||||
|
"describe": {
|
||||||
|
"columns": [],
|
||||||
|
"nullable": [],
|
||||||
|
"parameters": {
|
||||||
|
"Left": [
|
||||||
|
"Text",
|
||||||
|
"Uuid"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"query": "DELETE \n FROM survey_campaigns \n WHERE \n user_id = (\n SELECT \n ID \n FROM \n survey_admins \n WHERE \n name = $1\n )\n AND\n id = ($2)"
|
||||||
|
},
|
||||||
"1b7e17bfc949fa97e8dec1f95e35a02bcf3aa1aa72a1f6f6c8884e885fc3b953": {
|
"1b7e17bfc949fa97e8dec1f95e35a02bcf3aa1aa72a1f6f6c8884e885fc3b953": {
|
||||||
"describe": {
|
"describe": {
|
||||||
"columns": [],
|
"columns": [],
|
||||||
|
@ -146,6 +172,65 @@
|
||||||
},
|
},
|
||||||
"query": "UPDATE survey_admins set password = $1\n WHERE name = $2"
|
"query": "UPDATE survey_admins set password = $1\n WHERE name = $2"
|
||||||
},
|
},
|
||||||
|
"57c673ad8529371d77aa305917cf680dd2273ead74c3583ef0322f472b1d33fd": {
|
||||||
|
"describe": {
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"ordinal": 0,
|
||||||
|
"type_info": "Int4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "device_software_recognised",
|
||||||
|
"ordinal": 1,
|
||||||
|
"type_info": "Varchar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "threads",
|
||||||
|
"ordinal": 2,
|
||||||
|
"type_info": "Int4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "user_id",
|
||||||
|
"ordinal": 3,
|
||||||
|
"type_info": "Uuid"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "submitted_at",
|
||||||
|
"ordinal": 4,
|
||||||
|
"type_info": "Timestamptz"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "device_user_provided",
|
||||||
|
"ordinal": 5,
|
||||||
|
"type_info": "Varchar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "name",
|
||||||
|
"ordinal": 6,
|
||||||
|
"type_info": "Varchar"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nullable": [
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
],
|
||||||
|
"parameters": {
|
||||||
|
"Left": [
|
||||||
|
"Uuid",
|
||||||
|
"Text",
|
||||||
|
"Int8",
|
||||||
|
"Int8"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"query": "SELECT\n survey_responses.ID,\n survey_responses.device_software_recognised,\n survey_responses.threads,\n survey_responses.user_id,\n survey_responses.submitted_at,\n survey_responses.device_user_provided,\n survey_bench_type.name\n FROM\n survey_responses\n INNER JOIN survey_bench_type ON\n survey_responses.submission_bench_type_id = survey_bench_type.ID\n WHERE\n survey_responses.campaign_id = (\n SELECT ID FROM survey_campaigns\n WHERE\n ID = $1\n AND\n user_id = (SELECT ID FROM survey_admins WHERE name = $2)\n )\n LIMIT $3 OFFSET $4"
|
||||||
|
},
|
||||||
"58ec3b8f98c27e13ec2732f8ee23f6eb9845ac5d9fd97b1e5c9f2eed4b1f5693": {
|
"58ec3b8f98c27e13ec2732f8ee23f6eb9845ac5d9fd97b1e5c9f2eed4b1f5693": {
|
||||||
"describe": {
|
"describe": {
|
||||||
"columns": [
|
"columns": [
|
||||||
|
@ -226,6 +311,66 @@
|
||||||
},
|
},
|
||||||
"query": "SELECT \n name, id\n FROM \n survey_campaigns \n WHERE\n user_id = (\n SELECT \n ID\n FROM \n survey_admins\n WHERE\n name = $1\n )"
|
"query": "SELECT \n name, id\n FROM \n survey_campaigns \n WHERE\n user_id = (\n SELECT \n ID\n FROM \n survey_admins\n WHERE\n name = $1\n )"
|
||||||
},
|
},
|
||||||
|
"74c41e33f91cf31ea13582c8b3ca464544374842450d580517ca2bd01d67402e": {
|
||||||
|
"describe": {
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"ordinal": 0,
|
||||||
|
"type_info": "Int4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "device_software_recognised",
|
||||||
|
"ordinal": 1,
|
||||||
|
"type_info": "Varchar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "threads",
|
||||||
|
"ordinal": 2,
|
||||||
|
"type_info": "Int4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "user_id",
|
||||||
|
"ordinal": 3,
|
||||||
|
"type_info": "Uuid"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "submitted_at",
|
||||||
|
"ordinal": 4,
|
||||||
|
"type_info": "Timestamptz"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "device_user_provided",
|
||||||
|
"ordinal": 5,
|
||||||
|
"type_info": "Varchar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "name",
|
||||||
|
"ordinal": 6,
|
||||||
|
"type_info": "Varchar"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nullable": [
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
],
|
||||||
|
"parameters": {
|
||||||
|
"Left": [
|
||||||
|
"Uuid",
|
||||||
|
"Text",
|
||||||
|
"Text",
|
||||||
|
"Int8",
|
||||||
|
"Int8"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"query": "SELECT\n survey_responses.ID,\n survey_responses.device_software_recognised,\n survey_responses.threads,\n survey_responses.user_id,\n survey_responses.submitted_at,\n survey_responses.device_user_provided,\n survey_bench_type.name\n FROM\n survey_responses\n INNER JOIN survey_bench_type ON\n survey_responses.submission_bench_type_id = survey_bench_type.ID\n WHERE\n survey_bench_type.name = $3\n AND\n survey_responses.campaign_id = (\n SELECT ID FROM survey_campaigns\n WHERE\n ID = $1\n AND\n user_id = (SELECT ID FROM survey_admins WHERE name = $2)\n )\n LIMIT $4 OFFSET $5"
|
||||||
|
},
|
||||||
"82feafc36533144e49ba374c8c47ca4aa0d6558a9803778ad28cfa7b62382c3e": {
|
"82feafc36533144e49ba374c8c47ca4aa0d6558a9803778ad28cfa7b62382c3e": {
|
||||||
"describe": {
|
"describe": {
|
||||||
"columns": [],
|
"columns": [],
|
||||||
|
@ -242,26 +387,31 @@
|
||||||
},
|
},
|
||||||
"query": "\n INSERT INTO survey_campaigns (\n user_id, ID, name, difficulties, created_at\n ) VALUES(\n (SELECT id FROM survey_admins WHERE name = $1),\n $2, $3, $4, $5\n );"
|
"query": "\n INSERT INTO survey_campaigns (\n user_id, ID, name, difficulties, created_at\n ) VALUES(\n (SELECT id FROM survey_admins WHERE name = $1),\n $2, $3, $4, $5\n );"
|
||||||
},
|
},
|
||||||
"8320dda2b3e107d1451fdfb35eb2a4b8e97364e7b1b74ffe4d6913faf132fb61": {
|
"858a4c06a5c1ba7adb79bcac7d42d106d09d0cbff10c197f2242dcb5c437a1df": {
|
||||||
"describe": {
|
"describe": {
|
||||||
"columns": [
|
"columns": [
|
||||||
{
|
{
|
||||||
"name": "id",
|
"name": "created_at",
|
||||||
"ordinal": 0,
|
"ordinal": 0,
|
||||||
"type_info": "Int4"
|
"type_info": "Timestamptz"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"ordinal": 1,
|
||||||
|
"type_info": "Uuid"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"nullable": [
|
"nullable": [
|
||||||
|
false,
|
||||||
false
|
false
|
||||||
],
|
],
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"Left": [
|
"Left": [
|
||||||
"Uuid",
|
"Uuid"
|
||||||
"Text"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"query": "SELECT ID \n FROM survey_responses \n WHERE \n user_id = $1 \n AND \n device_software_recognised = $2;"
|
"query": "SELECT\n created_at,\n ID\n FROM\n survey_users\n WHERE\n ID = $1\n "
|
||||||
},
|
},
|
||||||
"9cdade613ce724631cc3f187510758ee0929e93ff3f8ce81fe35594756644246": {
|
"9cdade613ce724631cc3f187510758ee0929e93ff3f8ce81fe35594756644246": {
|
||||||
"describe": {
|
"describe": {
|
||||||
|
@ -310,21 +460,31 @@
|
||||||
},
|
},
|
||||||
"query": "UPDATE survey_admins set secret = $1\n WHERE name = $2"
|
"query": "UPDATE survey_admins set secret = $1\n WHERE name = $2"
|
||||||
},
|
},
|
||||||
"b4cd1e5240de1968c8b6d56672cec639b22f41ebf2754dadbf00efe0948c7e68": {
|
"b2619292aa6bd1ac38dca152cbe607b795a151ddc212361a3c6d8c70ea1c93eb": {
|
||||||
"describe": {
|
"describe": {
|
||||||
"columns": [],
|
"columns": [
|
||||||
"nullable": [],
|
{
|
||||||
|
"name": "duration",
|
||||||
|
"ordinal": 0,
|
||||||
|
"type_info": "Float4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "difficulty",
|
||||||
|
"ordinal": 1,
|
||||||
|
"type_info": "Int4"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nullable": [
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
],
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"Left": [
|
"Left": [
|
||||||
"Uuid",
|
|
||||||
"Uuid",
|
|
||||||
"Varchar",
|
|
||||||
"Varchar",
|
|
||||||
"Int4"
|
"Int4"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"query": "INSERT INTO survey_responses (\n user_id, \n campaign_id,\n device_user_provided,\n device_software_recognised,\n threads\n ) VALUES ($1, $2, $3, $4, $5);"
|
"query": "SELECT\n duration,\n difficulty\n FROM\n survey_benches\n WHERE\n resp_id = $1\n "
|
||||||
},
|
},
|
||||||
"c757589ef26a005e3285e7ab20d8a44c4f2e1cb125f8db061dd198cc380bf807": {
|
"c757589ef26a005e3285e7ab20d8a44c4f2e1cb125f8db061dd198cc380bf807": {
|
||||||
"describe": {
|
"describe": {
|
||||||
|
|
|
@ -20,7 +20,7 @@ use actix_identity::Identity;
|
||||||
use actix_web::{web, HttpResponse, Responder};
|
use actix_web::{web, HttpResponse, Responder};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use sqlx::types::time::OffsetDateTime;
|
use sqlx::types::time::OffsetDateTime;
|
||||||
use uuid::Uuid;
|
use sqlx::types::Uuid;
|
||||||
|
|
||||||
use super::{get_admin_check_login, get_uuid};
|
use super::{get_admin_check_login, get_uuid};
|
||||||
use crate::api::v1::bench::Bench;
|
use crate::api::v1::bench::Bench;
|
||||||
|
@ -102,7 +102,7 @@ pub mod runners {
|
||||||
username: &str,
|
username: &str,
|
||||||
payload: &mut AddCapmaign,
|
payload: &mut AddCapmaign,
|
||||||
data: &AppData,
|
data: &AppData,
|
||||||
) -> ServiceResult<uuid::Uuid> {
|
) -> ServiceResult<sqlx::types::Uuid> {
|
||||||
let mut uuid;
|
let mut uuid;
|
||||||
let now = OffsetDateTime::now_utc();
|
let now = OffsetDateTime::now_utc();
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ pub mod runners {
|
||||||
impl From<InnerU> for SurveyUser {
|
impl From<InnerU> for SurveyUser {
|
||||||
fn from(u: InnerU) -> Self {
|
fn from(u: InnerU) -> Self {
|
||||||
Self {
|
Self {
|
||||||
id: u.id,
|
id: uuid::Uuid::parse_str(&u.id.to_string()).unwrap(),
|
||||||
created_at: u.created_at.unix_timestamp(),
|
created_at: u.created_at.unix_timestamp(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -254,13 +254,13 @@ pub mod runners {
|
||||||
} else {
|
} else {
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct I {
|
struct I {
|
||||||
id: Option<i32>,
|
id: i32,
|
||||||
submitted_at: Option<OffsetDateTime>,
|
submitted_at: OffsetDateTime,
|
||||||
user_id: Option<Uuid>,
|
user_id: Uuid,
|
||||||
threads: Option<i32>,
|
threads: Option<i32>,
|
||||||
device_user_provided: Option<String>,
|
device_user_provided: String,
|
||||||
device_software_recognised: Option<String>,
|
device_software_recognised: String,
|
||||||
name: Option<String>,
|
name: String,
|
||||||
}
|
}
|
||||||
let mut i = sqlx::query_as!(
|
let mut i = sqlx::query_as!(
|
||||||
I,
|
I,
|
||||||
|
@ -296,13 +296,13 @@ pub mod runners {
|
||||||
let mut res = Vec::with_capacity(i.len());
|
let mut res = Vec::with_capacity(i.len());
|
||||||
i.drain(0..).for_each(|x| {
|
i.drain(0..).for_each(|x| {
|
||||||
res.push(InternalSurveyResp {
|
res.push(InternalSurveyResp {
|
||||||
id: x.id.unwrap(),
|
id: x.id,
|
||||||
submitted_at: x.submitted_at.unwrap(),
|
submitted_at: x.submitted_at,
|
||||||
user_id: x.user_id.unwrap(),
|
user_id: x.user_id,
|
||||||
threads: x.threads,
|
threads: x.threads,
|
||||||
device_user_provided: x.device_user_provided.unwrap(),
|
device_user_provided: x.device_user_provided,
|
||||||
device_software_recognised: x.device_software_recognised.unwrap(),
|
device_software_recognised: x.device_software_recognised,
|
||||||
name: x.name.unwrap(),
|
name: x.name,
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
res
|
res
|
||||||
|
@ -413,7 +413,7 @@ pub struct SurveyResponse {
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
pub struct SurveyUser {
|
pub struct SurveyUser {
|
||||||
pub created_at: i64, // OffsetDateTime,
|
pub created_at: i64, // OffsetDateTime,
|
||||||
pub id: Uuid,
|
pub id: uuid::Uuid,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
|
@ -477,12 +477,13 @@ impl ResultsPage {
|
||||||
pub async fn get_campaign_resutls(
|
pub async fn get_campaign_resutls(
|
||||||
id: Identity,
|
id: Identity,
|
||||||
query: web::Query<ResultsPage>,
|
query: web::Query<ResultsPage>,
|
||||||
path: web::Path<Uuid>,
|
path: web::Path<uuid::Uuid>,
|
||||||
data: AppData,
|
data: AppData,
|
||||||
) -> ServiceResult<impl Responder> {
|
) -> ServiceResult<impl Responder> {
|
||||||
let username = id.identity().unwrap();
|
let username = id.identity().unwrap();
|
||||||
let query = query.into_inner();
|
let query = query.into_inner();
|
||||||
let page = query.page();
|
let page = query.page();
|
||||||
|
let path = Uuid::parse_str(&path.to_string()).unwrap();
|
||||||
|
|
||||||
let results =
|
let results =
|
||||||
runners::get_results(&username, &path, &data, page, 50, query.bench_type)
|
runners::get_results(&username, &path, &data, page, 50, query.bench_type)
|
||||||
|
@ -592,7 +593,7 @@ mod tests {
|
||||||
|
|
||||||
let responses = super::runners::get_results(
|
let responses = super::runners::get_results(
|
||||||
NAME,
|
NAME,
|
||||||
&uuid::Uuid::parse_str(&campaign.campaign_id).unwrap(),
|
&sqlx::types::Uuid::parse_str(&campaign.campaign_id).unwrap(),
|
||||||
&AppData::new(data.clone()),
|
&AppData::new(data.clone()),
|
||||||
0,
|
0,
|
||||||
50,
|
50,
|
||||||
|
@ -610,7 +611,7 @@ mod tests {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
super::runners::get_results(
|
super::runners::get_results(
|
||||||
NAME,
|
NAME,
|
||||||
&uuid::Uuid::parse_str(&campaign.campaign_id).unwrap(),
|
&sqlx::types::Uuid::parse_str(&campaign.campaign_id).unwrap(),
|
||||||
&AppData::new(data.clone()),
|
&AppData::new(data.clone()),
|
||||||
0,
|
0,
|
||||||
50,
|
50,
|
||||||
|
@ -624,7 +625,7 @@ mod tests {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
super::runners::get_results(
|
super::runners::get_results(
|
||||||
NAME,
|
NAME,
|
||||||
&uuid::Uuid::parse_str(&campaign.campaign_id).unwrap(),
|
&sqlx::types::Uuid::parse_str(&campaign.campaign_id).unwrap(),
|
||||||
&AppData::new(data.clone()),
|
&AppData::new(data.clone()),
|
||||||
0,
|
0,
|
||||||
50,
|
50,
|
||||||
|
|
|
@ -24,7 +24,7 @@ use actix_web::{http, web, HttpResponse, Responder};
|
||||||
use futures::future::try_join_all;
|
use futures::future::try_join_all;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use sqlx::types::time::OffsetDateTime;
|
use sqlx::types::time::OffsetDateTime;
|
||||||
use uuid::Uuid;
|
use sqlx::types::Uuid;
|
||||||
|
|
||||||
use super::{get_uuid, RedirectQuery};
|
use super::{get_uuid, RedirectQuery};
|
||||||
use crate::errors::*;
|
use crate::errors::*;
|
||||||
|
@ -95,7 +95,7 @@ pub fn services(cfg: &mut web::ServiceConfig) {
|
||||||
pub mod runners {
|
pub mod runners {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
pub async fn register_runner(data: &AppData) -> ServiceResult<uuid::Uuid> {
|
pub async fn register_runner(data: &AppData) -> ServiceResult<sqlx::types::Uuid> {
|
||||||
let mut uuid;
|
let mut uuid;
|
||||||
let now = OffsetDateTime::now_utc();
|
let now = OffsetDateTime::now_utc();
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
use actix_web::web::ServiceConfig;
|
use actix_web::web::ServiceConfig;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use uuid::Uuid;
|
use sqlx::types::Uuid;
|
||||||
|
|
||||||
pub mod admin;
|
pub mod admin;
|
||||||
pub mod bench;
|
pub mod bench;
|
||||||
|
@ -44,7 +44,7 @@ pub fn get_random(len: usize) -> String {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_uuid() -> Uuid {
|
pub fn get_uuid() -> Uuid {
|
||||||
Uuid::new_v4()
|
Uuid::parse_str(&uuid::Uuid::new_v4().to_string()).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
|
|
|
@ -19,8 +19,8 @@ use std::str::FromStr;
|
||||||
|
|
||||||
use actix_web::http::header::ContentType;
|
use actix_web::http::header::ContentType;
|
||||||
use actix_web::{web, HttpResponse, Responder};
|
use actix_web::{web, HttpResponse, Responder};
|
||||||
|
use sqlx::types::Uuid;
|
||||||
use tera::Context;
|
use tera::Context;
|
||||||
use uuid::Uuid;
|
|
||||||
|
|
||||||
use crate::errors::ServiceError;
|
use crate::errors::ServiceError;
|
||||||
use crate::settings::Settings;
|
use crate::settings::Settings;
|
||||||
|
|
|
@ -19,7 +19,6 @@ use std::cell::RefCell;
|
||||||
use actix_web::http::header::ContentType;
|
use actix_web::http::header::ContentType;
|
||||||
use actix_web::{web, HttpResponse, Responder};
|
use actix_web::{web, HttpResponse, Responder};
|
||||||
use tera::Context;
|
use tera::Context;
|
||||||
use uuid::Uuid;
|
|
||||||
|
|
||||||
use crate::AppData;
|
use crate::AppData;
|
||||||
use crate::PAGES;
|
use crate::PAGES;
|
||||||
|
@ -56,7 +55,7 @@ impl Bench {
|
||||||
)]
|
)]
|
||||||
pub async fn bench(
|
pub async fn bench(
|
||||||
data: AppData,
|
data: AppData,
|
||||||
_path: web::Path<Uuid>,
|
_path: web::Path<uuid::Uuid>,
|
||||||
) -> PageResult<impl Responder, Bench> {
|
) -> PageResult<impl Responder, Bench> {
|
||||||
let bench = Bench::new(&data.settings).render();
|
let bench = Bench::new(&data.settings).render();
|
||||||
let html = ContentType::html();
|
let html = ContentType::html();
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
use actix_identity::Identity;
|
use actix_identity::Identity;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use uuid::Uuid;
|
use sqlx::types::Uuid;
|
||||||
|
|
||||||
use crate::api::v1::admin::auth::runners::{login_runner, Login, Password};
|
use crate::api::v1::admin::auth::runners::{login_runner, Login, Password};
|
||||||
use crate::api::v1::admin::campaigns::runners;
|
use crate::api::v1::admin::campaigns::runners;
|
||||||
|
@ -103,11 +103,11 @@ async fn get_title(
|
||||||
)]
|
)]
|
||||||
pub async fn delete_campaign(
|
pub async fn delete_campaign(
|
||||||
id: Identity,
|
id: Identity,
|
||||||
path: web::Path<Uuid>,
|
path: web::Path<uuid::Uuid>,
|
||||||
data: AppData,
|
data: AppData,
|
||||||
) -> PageResult<impl Responder, SudoDelete> {
|
) -> PageResult<impl Responder, SudoDelete> {
|
||||||
let username = id.identity().unwrap();
|
let username = id.identity().unwrap();
|
||||||
let uuid = path.into_inner();
|
let uuid = Uuid::parse_str(&path.to_string()).unwrap();
|
||||||
|
|
||||||
let title = get_title(&username, &uuid, &data)
|
let title = get_title(&username, &uuid, &data)
|
||||||
.await
|
.await
|
||||||
|
@ -130,12 +130,13 @@ pub async fn delete_campaign(
|
||||||
)]
|
)]
|
||||||
pub async fn delete_campaign_submit(
|
pub async fn delete_campaign_submit(
|
||||||
id: Identity,
|
id: Identity,
|
||||||
uuid: web::Path<Uuid>,
|
uuid: web::Path<uuid::Uuid>,
|
||||||
payload: web::Form<Password>,
|
payload: web::Form<Password>,
|
||||||
data: AppData,
|
data: AppData,
|
||||||
) -> PageResult<impl Responder, SudoDelete> {
|
) -> PageResult<impl Responder, SudoDelete> {
|
||||||
let username = id.identity().unwrap();
|
let username = id.identity().unwrap();
|
||||||
let payload = payload.into_inner();
|
let payload = payload.into_inner();
|
||||||
|
let uuid = Uuid::parse_str(&uuid.to_string()).unwrap();
|
||||||
|
|
||||||
let creds = Login {
|
let creds = Login {
|
||||||
login: username,
|
login: username,
|
||||||
|
|
|
@ -20,8 +20,8 @@ use std::str::FromStr;
|
||||||
use actix_web::http::header::ContentType;
|
use actix_web::http::header::ContentType;
|
||||||
use actix_web::{web, HttpResponse, Responder};
|
use actix_web::{web, HttpResponse, Responder};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
use sqlx::types::Uuid;
|
||||||
use tera::Context;
|
use tera::Context;
|
||||||
use uuid::Uuid;
|
|
||||||
|
|
||||||
use crate::api::v1::admin::campaigns::{runners, ResultsPage, SurveyResponse};
|
use crate::api::v1::admin::campaigns::{runners, ResultsPage, SurveyResponse};
|
||||||
use crate::errors::ServiceError;
|
use crate::errors::ServiceError;
|
||||||
|
|
|
@ -21,8 +21,8 @@ use config::{Config, ConfigError, Environment, File};
|
||||||
use log::{debug, warn};
|
use log::{debug, warn};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
use sqlx::types::Uuid;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
use uuid::Uuid;
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct Server {
|
pub struct Server {
|
||||||
|
|
|
@ -28,7 +28,7 @@ use actix_web::{
|
||||||
|
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use uuid::Uuid;
|
use sqlx::types::Uuid;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::api::v1::admin::{
|
use crate::api::v1::admin::{
|
||||||
|
|
Loading…
Reference in a new issue