mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
fix(auth): correct postgres api key create field ordering
This commit is contained in:
@@ -375,9 +375,9 @@ INSERT INTO api_keys (
|
|||||||
feature_settings,
|
feature_settings,
|
||||||
is_active,
|
is_active,
|
||||||
expires_at,
|
expires_at,
|
||||||
|
auto_delete_on_expiry,
|
||||||
is_locked,
|
is_locked,
|
||||||
is_standalone,
|
is_standalone,
|
||||||
auto_delete_on_expiry,
|
|
||||||
total_requests,
|
total_requests,
|
||||||
total_tokens,
|
total_tokens,
|
||||||
total_cost_usd,
|
total_cost_usd,
|
||||||
@@ -398,10 +398,10 @@ VALUES (
|
|||||||
$11,
|
$11,
|
||||||
NULL,
|
NULL,
|
||||||
$12,
|
$12,
|
||||||
FALSE,
|
|
||||||
FALSE,
|
|
||||||
$13,
|
$13,
|
||||||
$14,
|
$14,
|
||||||
|
FALSE,
|
||||||
|
FALSE,
|
||||||
$15,
|
$15,
|
||||||
$16,
|
$16,
|
||||||
$17,
|
$17,
|
||||||
@@ -449,9 +449,9 @@ INSERT INTO api_keys (
|
|||||||
feature_settings,
|
feature_settings,
|
||||||
is_active,
|
is_active,
|
||||||
expires_at,
|
expires_at,
|
||||||
|
auto_delete_on_expiry,
|
||||||
is_locked,
|
is_locked,
|
||||||
is_standalone,
|
is_standalone,
|
||||||
auto_delete_on_expiry,
|
|
||||||
total_requests,
|
total_requests,
|
||||||
total_tokens,
|
total_tokens,
|
||||||
total_cost_usd,
|
total_cost_usd,
|
||||||
@@ -472,10 +472,10 @@ VALUES (
|
|||||||
$11,
|
$11,
|
||||||
NULL,
|
NULL,
|
||||||
$12,
|
$12,
|
||||||
FALSE,
|
|
||||||
TRUE,
|
|
||||||
$13,
|
$13,
|
||||||
$14,
|
$14,
|
||||||
|
FALSE,
|
||||||
|
TRUE,
|
||||||
$15,
|
$15,
|
||||||
$16,
|
$16,
|
||||||
$17,
|
$17,
|
||||||
@@ -1535,9 +1535,28 @@ fn map_auth_api_key_export_row(
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{SqlxAuthApiKeySnapshotReadRepository, UPDATE_STANDALONE_API_KEY_BASIC_SQL};
|
use super::{
|
||||||
|
CREATE_STANDALONE_API_KEY_SQL, CREATE_USER_API_KEY_SQL,
|
||||||
|
SqlxAuthApiKeySnapshotReadRepository, UPDATE_STANDALONE_API_KEY_BASIC_SQL,
|
||||||
|
};
|
||||||
use crate::driver::postgres::{PostgresPoolConfig, PostgresPoolFactory};
|
use crate::driver::postgres::{PostgresPoolConfig, PostgresPoolFactory};
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn create_api_key_sql_orders_expiry_before_standalone_flags() {
|
||||||
|
assert!(CREATE_USER_API_KEY_SQL.contains(
|
||||||
|
"expires_at,\n auto_delete_on_expiry,\n is_locked,\n is_standalone,"
|
||||||
|
));
|
||||||
|
assert!(CREATE_USER_API_KEY_SQL.contains(
|
||||||
|
"$12,\n $13,\n FALSE,\n FALSE,\n $14,"
|
||||||
|
));
|
||||||
|
assert!(CREATE_STANDALONE_API_KEY_SQL.contains(
|
||||||
|
"expires_at,\n auto_delete_on_expiry,\n is_locked,\n is_standalone,"
|
||||||
|
));
|
||||||
|
assert!(CREATE_STANDALONE_API_KEY_SQL.contains(
|
||||||
|
"$12,\n $13,\n FALSE,\n TRUE,\n $14,"
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn update_standalone_api_key_basic_sql_casts_json_case_values() {
|
fn update_standalone_api_key_basic_sql_casts_json_case_values() {
|
||||||
assert!(UPDATE_STANDALONE_API_KEY_BASIC_SQL
|
assert!(UPDATE_STANDALONE_API_KEY_BASIC_SQL
|
||||||
|
|||||||
Reference in New Issue
Block a user