Aktualisiere Benachrichtigungsabfragen: Ersetze user_id durch character_id und optimiere die Abfragen zur Auswahl des Charakters.
This commit is contained in:
@@ -38,7 +38,14 @@ ON CONFLICT (region_id) DO UPDATE SET weather_type_id = EXCLUDED.weather_type_id
|
|||||||
"#;
|
"#;
|
||||||
|
|
||||||
pub const QUERY_INSERT_NOTIFICATION: &str = r#"
|
pub const QUERY_INSERT_NOTIFICATION: &str = r#"
|
||||||
INSERT INTO falukant_log.notification (user_id, tr, shown, created_at, updated_at) VALUES ($1, $2, FALSE, NOW(), NOW());
|
INSERT INTO falukant_log.notification (character_id, tr, shown, created_at, updated_at)
|
||||||
|
VALUES (
|
||||||
|
(SELECT c.id FROM falukant_data.character c WHERE c.user_id = $1 ORDER BY c.id LIMIT 1),
|
||||||
|
$2,
|
||||||
|
FALSE,
|
||||||
|
NOW(),
|
||||||
|
NOW()
|
||||||
|
);
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
// Product pricing
|
// Product pricing
|
||||||
@@ -242,7 +249,8 @@ DELETE FROM falukant_data.transport WHERE id = $1;
|
|||||||
"#;
|
"#;
|
||||||
|
|
||||||
pub const QUERY_ADD_TRANSPORT_WAITING_NOTIFICATION: &str = r#"
|
pub const QUERY_ADD_TRANSPORT_WAITING_NOTIFICATION: &str = r#"
|
||||||
INSERT INTO falukant_log.notification (user_id, tr, shown, created_at, updated_at) VALUES ($1, $2, FALSE, NOW(), NOW());
|
INSERT INTO falukant_log.notification (user_id, tr, shown, created_at, updated_at)
|
||||||
|
VALUES ((SELECT c.user_id FROM falukant_data.character c WHERE c.user_id = $1 LIMIT 1), $2, FALSE, NOW(), NOW());
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
pub const QUERY_UPDATE_TRANSPORT_SIZE: &str = r#"
|
pub const QUERY_UPDATE_TRANSPORT_SIZE: &str = r#"
|
||||||
@@ -912,7 +920,7 @@ pub const QUERY_USERS_IN_CITIES_OF_REGIONS: &str = r#"
|
|||||||
|
|
||||||
pub const QUERY_NOTIFY_OFFICE_EXPIRATION: &str = r#"
|
pub const QUERY_NOTIFY_OFFICE_EXPIRATION: &str = r#"
|
||||||
INSERT INTO falukant_log.notification
|
INSERT INTO falukant_log.notification
|
||||||
(user_id, tr, created_at, updated_at)
|
(character_id, tr, created_at, updated_at)
|
||||||
SELECT
|
SELECT
|
||||||
po.character_id,
|
po.character_id,
|
||||||
'notify_office_expiring',
|
'notify_office_expiring',
|
||||||
@@ -928,14 +936,14 @@ pub const QUERY_NOTIFY_OFFICE_EXPIRATION: &str = r#"
|
|||||||
|
|
||||||
pub const QUERY_NOTIFY_ELECTION_CREATED: &str = r#"
|
pub const QUERY_NOTIFY_ELECTION_CREATED: &str = r#"
|
||||||
INSERT INTO falukant_log.notification
|
INSERT INTO falukant_log.notification
|
||||||
(user_id, tr, created_at, updated_at)
|
(character_id, tr, created_at, updated_at)
|
||||||
VALUES
|
VALUES
|
||||||
($1, 'notify_election_created', NOW(), NOW());
|
((SELECT c.id FROM falukant_data.character c WHERE c.user_id = $1 ORDER BY c.id LIMIT 1), 'notify_election_created', NOW(), NOW());
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
pub const QUERY_NOTIFY_OFFICE_FILLED: &str = r#"
|
pub const QUERY_NOTIFY_OFFICE_FILLED: &str = r#"
|
||||||
INSERT INTO falukant_log.notification
|
INSERT INTO falukant_log.notification
|
||||||
(user_id, tr, created_at, updated_at)
|
(character_id, tr, created_at, updated_at)
|
||||||
VALUES
|
VALUES
|
||||||
($1, 'notify_office_filled', NOW(), NOW());
|
($1, 'notify_office_filled', NOW(), NOW());
|
||||||
"#;
|
"#;
|
||||||
|
|||||||
Reference in New Issue
Block a user