mlinke-ai / kev_in

kev.in is a self hosted learning platform for programming beginners.
GNU General Public License v3.0
10 stars 0 forks source link

Find a general type for the user_role / access level #130

Closed Pymon closed 1 year ago

Pymon commented 1 year ago

Currently the backend sends a string for user_role for user api requests. To avoid unnecessary switch constructs in the frontend, it would be easier to use integers instead.

Access levels in the frontend are defined as following (sadmin to add):

export const accessLevels = {
    default: 0, // not logged  in
    user: 1,
    admin: 2,
    // (sadmin: 3)
};
mlinke-ai commented 1 year ago

I am currently working on a solution. See #126 for more.

Basically, everything we store as enum in the database, we return as both string (the field name ends with _name) and integer (ending in _value).