From d34898e1e9d21a8e1da57629c9b7700aba706047 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Tue, 8 Oct 2024 14:05:01 +0200 Subject: [PATCH] [feat] save display name mode --- api/src/stores/user.ts | 31 +++++++++++++++++++++++++++++++ plugin.config.js | 2 +- quasar.conf.js | 17 +++++++++++++---- 3 files changed, 45 insertions(+), 5 deletions(-) diff --git a/api/src/stores/user.ts b/api/src/stores/user.ts index c0e06c3..2709950 100644 --- a/api/src/stores/user.ts +++ b/api/src/stores/user.ts @@ -22,6 +22,7 @@ export const useUserStore = defineStore({ state: () => ({ roles: [] as FG.Role[], permissions: [] as FG.Permission[], + userSettings: {} as FG.UserSettings, // list of all users, include deleted ones, use `users` getter for list of active ones _users: [] as FG.User[], // Internal flags for deciding if lists need to force-loaded @@ -218,5 +219,35 @@ export const useUserStore = defineStore({ await api.delete(`/roles/${role}`); this.roles = this.roles.filter((r) => r.id !== role); }, + + /** Get Settings for display name mode + * @param force If set to true a fresh list is loaded from backend even when a local copy is available + * @throws Probably an AxiosError if request failed + * @returns Settings for display name mode + */ + async getDisplayNameModeSetting(force = false): Promise { + const mainStore = useMainStore(); + if (force) { + const { data } = await api.get<{ data: string }>( + `users/${mainStore.currentUser.userid}/setting/display_name_mode` + ); + this.userSettings['display_name'] = data.data; + } + return this.userSettings['display_name']; + }, + + /** Set Settings for display name mode + * @param mode New display name mode + * @throws Probably an AxiosError if request failed + * @returns Settings for display name mode + */ + async setDisplayNameModeSetting(mode: string): Promise { + const mainStore = useMainStore(); + await api.put(`users/${mainStore.currentUser.userid}/setting/display_name_mode`, { + data: mode, + }); + this.userSettings['display_name'] = mode; + return mode; + }, }, }); diff --git a/plugin.config.js b/plugin.config.js index 91d11af..30437ac 100644 --- a/plugin.config.js +++ b/plugin.config.js @@ -3,4 +3,4 @@ module.exports = [ // '@flaschengeist/balance', // '@flaschengeist/schedule', // '@flaschengeist/pricelist', -] + '@flaschengeist/schedule', diff --git a/quasar.conf.js b/quasar.conf.js index a65befa..2cf98d6 100644 --- a/quasar.conf.js +++ b/quasar.conf.js @@ -15,12 +15,18 @@ const { configure } = require('quasar/wrappers'); const operation = () => { const custom_plgns = require('./plugin.config.js'); const required_plgns = require('./src/vendor-plugin.config.js'); - const plugins = [...custom_plgns, ...required_plgns].map((v) => `import("${v}").catch(() => "${v}")`); - const replace = new ReplaceOperation('all', `\\/\\* *INSERT_PLUGIN_LIST *\\*\\/`, `${plugins.join(', ')}`); + const plugins = [...custom_plgns, ...required_plgns].map( + (v) => `import("${v}").catch(() => "${v}")` + ); + const replace = new ReplaceOperation( + 'all', + `\\/\\* *INSERT_PLUGIN_LIST *\\*\\/`, + `${plugins.join(', ')}` + ); return replace; }; -module.exports = configure(function(/* ctx */) { +module.exports = configure(function (/* ctx */) { return { // https://quasar.dev/quasar-cli/supporting-ts supportTS: { @@ -60,7 +66,7 @@ module.exports = configure(function(/* ctx */) { // Full list of options: https://quasar.dev/quasar-cli/quasar-conf-js#Property%3A-build build: { vueRouterMode: 'history', // available values: 'hash', 'history' - + //publicPath: 'flaschengeist2', // transpile: false, // Add dependencies for transpiling with Babel (Array of string/regex) @@ -214,5 +220,8 @@ module.exports = configure(function(/* ctx */) { // chainWebpack also available besides this extendWebpack }, }, + bin: { + linuxAndroidStudio: '/home/crimsen/.local/share/JetBrains/Toolbox/scripts/studio', + }, }; });