Rewrite check if user is a system user or not #60

Open
opened 2025-09-12 21:26:02 +00:00 by Ghost · 2 comments
Ghost commented 2025-09-12 21:26:02 +00:00 (Migrated from code.ole.blue)

I realized that this piece of code found here could be improved.

        for (key, value) in deltas.iter() {
            use crate::backend::db::{DBUSER_AUFLADUNG_ID, DBUSER_SNACKBAR_ID};

            if key.id.0 == DBUSER_AUFLADUNG_ID.0 || key.id.0 == DBUSER_SNACKBAR_ID.0 {
                // don't do tracking on the system users
                continue;
            }

It should be possible to check if the user is a system users instead of hardcoding values, but we currently have a User struct in the key. UserDB would hold the information if it is a system user.

I realized that this piece of code [found here](https://github.com/strichliste-rs/strichliste-rs/blob/ac1df5ecea97b5028ad5f539608eb772b2a8f283/src/models/transaction.rs#L622) could be improved. ```rust for (key, value) in deltas.iter() { use crate::backend::db::{DBUSER_AUFLADUNG_ID, DBUSER_SNACKBAR_ID}; if key.id.0 == DBUSER_AUFLADUNG_ID.0 || key.id.0 == DBUSER_SNACKBAR_ID.0 { // don't do tracking on the system users continue; } ``` It should be possible to check if the user is a system users instead of hardcoding values, but we currently have a `User` struct in the `key`. `UserDB` would hold the information if it is a system user.
Ghost commented 2025-09-13 06:47:39 +00:00 (Migrated from code.ole.blue)

To anyone working on this: please dont pass a DB sturct to the frontend. Add a Field instead

To anyone working on this: please dont pass a DB sturct to the frontend. Add a Field instead
Ghost commented 2025-09-28 00:39:20 +00:00 (Migrated from code.ole.blue)

Something like


#[cfg(feature = "ssr")]
impl User {

pub fn is_system_user(&self, db_conn){
...}

should do the trick

Something like ```rust #[cfg(feature = "ssr")] impl User { pub fn is_system_user(&self, db_conn){ ...} ``` should do the trick
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Strichliste/strichliste#60
No description provided.