fixes and functions

This commit is contained in:
Mateusz Gruszczyński
2026-08-05 23:52:41 +02:00
parent 4643de4309
commit a7329f5535
13 changed files with 330 additions and 15 deletions
+3
View File
@@ -88,6 +88,7 @@ pub enum Query {
USER_SET_WORKSPACE_PRIVACY,
USER_SET_PAD_PRIVACY,
RESOURCE_ACCESS_TOKENS_DELETE_BY_RESOURCE,
RESOURCE_ACCESS_TOKENS_DELETE_BY_TOKEN_HASH,
RESOURCE_ACCESS_TOKENS_INSERT,
RESOURCE_ACCESS_TOKENS_VALID_COUNT,
RESOURCE_PERMISSION_DELETE_USER,
@@ -253,6 +254,8 @@ pub const USER_SET_WORKSPACE_PRIVACY: Query = Query::USER_SET_WORKSPACE_PRIVACY;
pub const USER_SET_PAD_PRIVACY: Query = Query::USER_SET_PAD_PRIVACY;
pub const RESOURCE_ACCESS_TOKENS_DELETE_BY_RESOURCE: Query =
Query::RESOURCE_ACCESS_TOKENS_DELETE_BY_RESOURCE;
pub const RESOURCE_ACCESS_TOKENS_DELETE_BY_TOKEN_HASH: Query =
Query::RESOURCE_ACCESS_TOKENS_DELETE_BY_TOKEN_HASH;
pub const RESOURCE_ACCESS_TOKENS_INSERT: Query = Query::RESOURCE_ACCESS_TOKENS_INSERT;
pub const RESOURCE_ACCESS_TOKENS_VALID_COUNT: Query = Query::RESOURCE_ACCESS_TOKENS_VALID_COUNT;
pub const RESOURCE_PERMISSION_DELETE_USER: Query = Query::RESOURCE_PERMISSION_DELETE_USER;
+3
View File
@@ -200,6 +200,9 @@ pub fn get(query: Query) -> &'static str {
Query::RESOURCE_ACCESS_TOKENS_DELETE_BY_RESOURCE => {
r#"DELETE FROM resource_access_tokens WHERE resource_kind = ? AND resource_slug = ?"#
}
Query::RESOURCE_ACCESS_TOKENS_DELETE_BY_TOKEN_HASH => {
r#"DELETE FROM resource_access_tokens WHERE token_hash = ?"#
}
Query::RESOURCE_ACCESS_TOKENS_INSERT => {
r#"INSERT INTO resource_access_tokens (token_hash, resource_kind, resource_slug, expires_at) VALUES (?, ?, ?, ?)"#
}
+3
View File
@@ -202,6 +202,9 @@ pub fn get(query: Query) -> &'static str {
Query::RESOURCE_ACCESS_TOKENS_DELETE_BY_RESOURCE => {
r#"DELETE FROM resource_access_tokens WHERE resource_kind = $1 AND resource_slug = $2"#
}
Query::RESOURCE_ACCESS_TOKENS_DELETE_BY_TOKEN_HASH => {
r#"DELETE FROM resource_access_tokens WHERE token_hash = $1"#
}
Query::RESOURCE_ACCESS_TOKENS_INSERT => {
r#"INSERT INTO resource_access_tokens (token_hash, resource_kind, resource_slug, expires_at) VALUES ($1, $2, $3, $4)"#
}
+3
View File
@@ -200,6 +200,9 @@ pub fn get(query: Query) -> &'static str {
Query::RESOURCE_ACCESS_TOKENS_DELETE_BY_RESOURCE => {
r#"DELETE FROM resource_access_tokens WHERE resource_kind = ? AND resource_slug = ?"#
}
Query::RESOURCE_ACCESS_TOKENS_DELETE_BY_TOKEN_HASH => {
r#"DELETE FROM resource_access_tokens WHERE token_hash = ?"#
}
Query::RESOURCE_ACCESS_TOKENS_INSERT => {
r#"INSERT INTO resource_access_tokens (token_hash, resource_kind, resource_slug, expires_at) VALUES (?, ?, ?, ?)"#
}