This commit is contained in:
miah 2025-08-19 23:21:15 +02:00 committed by GitHub
commit ddc3399e2b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 173 additions and 292 deletions

View file

@ -1051,7 +1051,8 @@
"dont-want-to-see-this-anymore-be-sure-to-change-your-email": "Don't want to see this anymore? Be sure to change your email in your user settings!", "dont-want-to-see-this-anymore-be-sure-to-change-your-email": "Don't want to see this anymore? Be sure to change your email in your user settings!",
"forgot-password": "Forgot Password", "forgot-password": "Forgot Password",
"forgot-password-text": "Please enter your email address and we will send you a link to reset your password.", "forgot-password-text": "Please enter your email address and we will send you a link to reset your password.",
"changes-reflected-immediately": "Changes to this user will be reflected immediately." "changes-reflected-immediately": "Changes to this user will be reflected immediately.",
"default-activity": "Default Activity"
}, },
"language-dialog": { "language-dialog": {
"translated": "translated", "translated": "translated",

View file

@ -194,6 +194,7 @@ export interface UserBase {
group?: string | null; group?: string | null;
household?: string | null; household?: string | null;
advanced?: boolean; advanced?: boolean;
defaultActivity?: string;
canInvite?: boolean; canInvite?: boolean;
canManage?: boolean; canManage?: boolean;
canManageHousehold?: boolean; canManageHousehold?: boolean;
@ -209,6 +210,7 @@ export interface UserIn {
group?: string | null; group?: string | null;
household?: string | null; household?: string | null;
advanced?: boolean; advanced?: boolean;
defaultActivity?: string;
canInvite?: boolean; canInvite?: boolean;
canManage?: boolean; canManage?: boolean;
canManageHousehold?: boolean; canManageHousehold?: boolean;
@ -225,6 +227,7 @@ export interface UserOut {
group: string; group: string;
household: string; household: string;
advanced?: boolean; advanced?: boolean;
defaultActivity?: string;
canInvite?: boolean; canInvite?: boolean;
canManage?: boolean; canManage?: boolean;
canManageHousehold?: boolean; canManageHousehold?: boolean;

View file

@ -1,18 +1,8 @@
<template> <template>
<v-container <v-container fluid class="d-flex justify-center align-center flex-column fill-height" :class="{
fluid 'bg-off-white': !$vuetify.theme.current.dark && !isDark,
class="d-flex justify-center align-center flex-column fill-height" }">
:class="{ <v-alert v-if="isFirstLogin" class="my-4" type="info" :icon="$globals.icons.information" :style="{ flex: 'none' }">
'bg-off-white': !$vuetify.theme.current.dark && !isDark,
}"
>
<v-alert
v-if="isFirstLogin"
class="my-4"
type="info"
:icon="$globals.icons.information"
:style="{ flex: 'none' }"
>
<div> <div>
<p class="mb-3"> <p class="mb-3">
{{ $t('user.it-looks-like-this-is-your-first-time-logging-in') }} {{ $t('user.it-looks-like-this-is-your-first-time-logging-in') }}
@ -38,16 +28,8 @@
</p> </p>
</div> </div>
</v-alert> </v-alert>
<v-card <v-card tag="section" class="d-flex flex-column align-center w-100" max-width="600">
tag="section" <v-toolbar color="primary" class="d-flex justify-center mb-4" dark>
class="d-flex flex-column align-center w-100"
max-width="600"
>
<v-toolbar
color="primary"
class="d-flex justify-center mb-4"
dark
>
<v-toolbar-title class="text-h4 text-center"> <v-toolbar-title class="text-h4 text-center">
Mealie Mealie
</v-toolbar-title> </v-toolbar-title>
@ -55,19 +37,10 @@
<div class="icon-container"> <div class="icon-container">
<v-divider class="icon-divider" /> <v-divider class="icon-divider" />
<v-avatar <v-avatar class="pa-2 icon-avatar" color="primary" size="100">
class="pa-2 icon-avatar" <svg class="icon-white" style="width: 100px; height: 100px" viewBox="0 0 24 24">
color="primary"
size="100"
>
<svg
class="icon-white"
style="width: 100px; height: 100px"
viewBox="0 0 24 24"
>
<path <path
d="M8.1,13.34L3.91,9.16C2.35,7.59 2.35,5.06 3.91,3.5L10.93,10.5L8.1,13.34M13.41,13L20.29,19.88L18.88,21.29L12,14.41L5.12,21.29L3.71,19.88L13.36,10.22L13.16,10C12.38,9.23 12.38,7.97 13.16,7.19L17.5,2.82L18.43,3.74L15.19,7L16.15,7.94L19.39,4.69L20.31,5.61L17.06,8.85L18,9.81L21.26,6.56L22.18,7.5L17.81,11.84C17.03,12.62 15.77,12.62 15,11.84L14.78,11.64L13.41,13Z" d="M8.1,13.34L3.91,9.16C2.35,7.59 2.35,5.06 3.91,3.5L10.93,10.5L8.1,13.34M13.41,13L20.29,19.88L18.88,21.29L12,14.41L5.12,21.29L3.71,19.88L13.36,10.22L13.16,10C12.38,9.23 12.38,7.97 13.16,7.19L17.5,2.82L18.43,3.74L15.19,7L16.15,7.94L19.39,4.69L20.31,5.61L17.06,8.85L18,9.81L21.26,6.56L22.18,7.5L17.81,11.84C17.03,12.62 15.77,12.62 15,11.84L14.78,11.64L13.41,13Z" />
/>
</svg> </svg>
</v-avatar> </v-avatar>
</div> </div>
@ -77,88 +50,37 @@
</v-card-title> </v-card-title>
<v-card-text class="w-100"> <v-card-text class="w-100">
<v-form @submit.prevent="authenticate"> <v-form @submit.prevent="authenticate">
<v-text-field <v-text-field v-if="allowPasswordLogin" v-model="form.email" :prepend-inner-icon="$globals.icons.email"
v-if="allowPasswordLogin" variant="solo-filled" flat width="100%" autofocus autocomplete="username" name="login"
v-model="form.email" :label="$t('user.email-or-username')" type="text" />
:prepend-inner-icon="$globals.icons.email" <v-text-field v-if="allowPasswordLogin" id="password" v-model="form.password"
variant="solo-filled" :prepend-inner-icon="$globals.icons.lock" :append-inner-icon="passwordIcon" variant="solo-filled" flat
flat autocomplete="current-password" name="password" :label="$t('user.password')" :type="inputType"
width="100%" @click:append-inner="togglePasswordShow" />
autofocus <v-checkbox v-if="allowPasswordLogin" v-model="form.remember" class="ml-2 mt-n2"
autocomplete="username" :label="$t('user.remember-me')" />
name="login"
:label="$t('user.email-or-username')"
type="text"
/>
<v-text-field
v-if="allowPasswordLogin"
id="password"
v-model="form.password"
:prepend-inner-icon="$globals.icons.lock"
:append-inner-icon="passwordIcon"
variant="solo-filled"
flat
autocomplete="current-password"
name="password"
:label="$t('user.password')"
:type="inputType"
@click:append-inner="togglePasswordShow"
/>
<v-checkbox
v-if="allowPasswordLogin"
v-model="form.remember"
class="ml-2 mt-n2"
:label="$t('user.remember-me')"
/>
<v-card-actions v-if="allowPasswordLogin" class="justify-center pt-0"> <v-card-actions v-if="allowPasswordLogin" class="justify-center pt-0">
<div class="max-button"> <div class="max-button">
<v-btn <v-btn :loading="loggingIn" :disabled="oidcLoggingIn" variant="elevated" color="primary" type="submit"
:loading="loggingIn" size="large" rounded class="rounded-xl" block>
:disabled="oidcLoggingIn"
variant="elevated"
color="primary"
type="submit"
size="large"
rounded
class="rounded-xl"
block
>
{{ $t("user.login") }} {{ $t("user.login") }}
</v-btn> </v-btn>
</div> </div>
</v-card-actions> </v-card-actions>
<div <div v-if="allowOidc && allowPasswordLogin" class="d-flex my-4 justify-center align-center" width="80%">
v-if="allowOidc && allowPasswordLogin"
class="d-flex my-4 justify-center align-center"
width="80%"
>
<v-divider class="div-width" /> <v-divider class="div-width" />
<span <span class="absolute px-2" :class="{
class="absolute px-2" 'bg-white': !$vuetify.theme.current.dark && !isDark,
:class="{ 'bg-grey-darken-4': $vuetify.theme.current.dark || isDark,
'bg-white': !$vuetify.theme.current.dark && !isDark, }">
'bg-grey-darken-4': $vuetify.theme.current.dark || isDark,
}"
>
{{ $t("user.or") }} {{ $t("user.or") }}
</span> </span>
</div> </div>
<v-card-actions <v-card-actions v-if="allowOidc" class="justify-center">
v-if="allowOidc"
class="justify-center"
>
<div class="max-button"> <div class="max-button">
<v-btn <v-btn :loading="oidcLoggingIn" color="primary" size="large" variant="elevated" rounded class="rounded-xl"
:loading="oidcLoggingIn" block @click="() => oidcAuthenticate()">
color="primary"
size="large"
variant="elevated"
rounded
class="rounded-xl"
block
@click="() => oidcAuthenticate()"
>
{{ $t("user.login-oidc") }} {{ oidcProviderName }} {{ $t("user.login-oidc") }} {{ oidcProviderName }}
</v-btn> </v-btn>
</div> </div>
@ -166,57 +88,36 @@
</v-form> </v-form>
</v-card-text> </v-card-text>
<v-card-actions class="d-flex justify-center flex-column flex-sm-row"> <v-card-actions class="d-flex justify-center flex-column flex-sm-row">
<v-btn <v-btn v-if="allowSignup && allowPasswordLogin" variant="text" to="/register">
v-if="allowSignup && allowPasswordLogin"
variant="text"
to="/register"
>
{{ $t("user.register") }} {{ $t("user.register") }}
</v-btn> </v-btn>
<v-btn <v-btn v-else variant="text" disabled>
v-else
variant="text"
disabled
>
{{ $t("user.invite-only") }} {{ $t("user.invite-only") }}
</v-btn> </v-btn>
<v-btn <v-btn v-if="allowPasswordLogin" class="mr-auto" variant="text" to="/forgot-password">
v-if="allowPasswordLogin"
class="mr-auto"
variant="text"
to="/forgot-password"
>
{{ $t("user.reset-password") }} {{ $t("user.reset-password") }}
</v-btn> </v-btn>
</v-card-actions> </v-card-actions>
<v-card-text class="d-flex justify-center flex-column flex-sm-row"> <v-card-text class="d-flex justify-center flex-column flex-sm-row">
<div <div v-for="link in [
v-for="link in [ {
{ text: $t('about.sponsor'),
text: $t('about.sponsor'), icon: $globals.icons.heart,
icon: $globals.icons.heart, href: 'https://github.com/sponsors/hay-kot',
href: 'https://github.com/sponsors/hay-kot', },
}, {
{ text: $t('about.github'),
text: $t('about.github'), icon: $globals.icons.github,
icon: $globals.icons.github, href: 'https://github.com/mealie-recipes/mealie',
href: 'https://github.com/mealie-recipes/mealie', },
}, {
{ text: $t('about.docs'),
text: $t('about.docs'), icon: $globals.icons.folderOutline,
icon: $globals.icons.folderOutline, href: 'https://docs.mealie.io/',
href: 'https://docs.mealie.io/', },
}, ]" :key="link.text" class="text-center">
]" <v-btn variant="text" :href="link.href" target="_blank">
:key="link.text"
class="text-center"
>
<v-btn
variant="text"
:href="link.href"
target="_blank"
>
<v-icon start> <v-icon start>
{{ link.icon }} {{ link.icon }}
</v-icon> </v-icon>
@ -274,8 +175,9 @@ export default defineNuxtComponent({
() => { () => {
if (!isDemo.value && isFirstLogin.value && $auth.user.value?.admin) { if (!isDemo.value && isFirstLogin.value && $auth.user.value?.admin) {
router.push("/admin/setup"); router.push("/admin/setup");
} } else if ($auth.user?.defaultActivity) {
else { router.push($auth.user.defaultActivity)
} else {
router.push(`/g/${groupSlug.value || ""}`); router.push(`/g/${groupSlug.value || ""}`);
} }
}, },

View file

@ -3,18 +3,9 @@
<BasePageTitle divider> <BasePageTitle divider>
<template #header> <template #header>
<div class="d-flex flex-column align-center justify-center"> <div class="d-flex flex-column align-center justify-center">
<UserAvatar <UserAvatar :tooltip="false" size="96" :user-id="userCopy.id!" />
:tooltip="false" <AppButtonUpload class="my-1" file-name="profile" accept="image/*" :url="`/api/users/${userCopy.id}/image`"
size="96" @uploaded="$auth.refresh()" />
:user-id="userCopy.id!"
/>
<AppButtonUpload
class="my-1"
file-name="profile"
accept="image/*"
:url="`/api/users/${userCopy.id}/image`"
@uploaded="$auth.refresh()"
/>
</div> </div>
</template> </template>
<template #title> <template #title>
@ -25,23 +16,13 @@
<section class="mt-5"> <section class="mt-5">
<ToggleState tag="article"> <ToggleState tag="article">
<template #activator="{ toggle, state }"> <template #activator="{ toggle, state }">
<v-btn <v-btn v-if="!state" color="info" class="mt-2 mb-n3" @click="toggle">
v-if="!state"
color="info"
class="mt-2 mb-n3"
@click="toggle"
>
<v-icon start> <v-icon start>
{{ $globals.icons.lock }} {{ $globals.icons.lock }}
</v-icon> </v-icon>
{{ $t("settings.change-password") }} {{ $t("settings.change-password") }}
</v-btn> </v-btn>
<v-btn <v-btn v-else color="info" class="mt-2 mb-n3" @click="toggle">
v-else
color="info"
class="mt-2 mb-n3"
@click="toggle"
>
<v-icon start> <v-icon start>
{{ $globals.icons.user }} {{ $globals.icons.user }}
</v-icon> </v-icon>
@ -49,116 +30,59 @@
</v-btn> </v-btn>
</template> </template>
<template #default="{ state }"> <template #default="{ state }">
<v-slide-x-transition <v-slide-x-transition leave-absolute hide-on-leave>
leave-absolute <div v-if="!state" key="personal-info">
hide-on-leave <BaseCardSectionTitle class="mt-10" :title="$t('profile.personal-information')" />
> <v-card tag="article" variant="outlined" style="border-color: lightgrey;">
<div
v-if="!state"
key="personal-info"
>
<BaseCardSectionTitle
class="mt-10"
:title="$t('profile.personal-information')"
/>
<v-card
tag="article"
variant="outlined"
style="border-color: lightgrey;"
>
<v-card-text class="pb-0"> <v-card-text class="pb-0">
<v-form ref="userUpdate"> <v-form ref="userUpdate">
<v-text-field <v-text-field v-model="userCopy.username" :label="$t('user.username')" required validate-on="blur"
v-model="userCopy.username" density="comfortable" variant="underlined" />
:label="$t('user.username')" <v-text-field v-model="userCopy.fullName" :label="$t('user.full-name')" required validate-on="blur"
required density="comfortable" variant="underlined" />
validate-on="blur" <v-text-field v-model="userCopy.email" :label="$t('user.email')" validate-on="blur" required
density="comfortable" density="comfortable" variant="underlined" />
variant="underlined" <v-text-field v-model="userCopy.defaultActivity" :label="'Default Activity'" validate-on-blur
/> required>
<v-text-field </v-text-field>
v-model="userCopy.fullName" <v-combobox v-model="selectedDefaultActivity" :label="$t('user.default-activity')"
:label="$t('user.full-name')" :items="activityOptions" validate-on-blur />
required
validate-on="blur"
density="comfortable"
variant="underlined"
/>
<v-text-field
v-model="userCopy.email"
:label="$t('user.email')"
validate-on="blur"
required
density="comfortable"
variant="underlined"
/>
</v-form> </v-form>
</v-card-text> </v-card-text>
<v-card-actions> <v-card-actions>
<v-spacer /> <v-spacer />
<BaseButton <BaseButton update @click="updateUser" />
update
@click="updateUser"
/>
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</div> </div>
<div <div v-else key="change-password">
v-else <BaseCardSectionTitle class="mt-10" :title="$t('settings.change-password')" />
key="change-password"
>
<BaseCardSectionTitle
class="mt-10"
:title="$t('settings.change-password')"
/>
<v-card variant="outlined"> <v-card variant="outlined">
<v-card-text class="pb-0"> <v-card-text class="pb-0">
<v-form ref="passChange"> <v-form ref="passChange">
<v-text-field <v-text-field v-model="password.current" :prepend-icon="$globals.icons.lock"
v-model="password.current" :label="$t('user.current-password')" validate-on="blur" :type="showPassword ? 'text' : 'password'"
:prepend-icon="$globals.icons.lock"
:label="$t('user.current-password')"
validate-on="blur"
:type="showPassword ? 'text' : 'password'"
:append-icon="showPassword ? $globals.icons.eye : $globals.icons.eyeOff" :append-icon="showPassword ? $globals.icons.eye : $globals.icons.eyeOff"
:rules="[validators.minLength(1)]" :rules="[validators.minLength(1)]" density="comfortable" variant="underlined"
density="comfortable" @click:append="showPassword = !showPassword" />
variant="underlined" <v-text-field v-model="password.newOne" :prepend-icon="$globals.icons.lock"
@click:append="showPassword = !showPassword" :label="$t('user.new-password')" :type="showPassword ? 'text' : 'password'"
/>
<v-text-field
v-model="password.newOne"
:prepend-icon="$globals.icons.lock"
:label="$t('user.new-password')"
:type="showPassword ? 'text' : 'password'"
:append-icon="showPassword ? $globals.icons.eye : $globals.icons.eyeOff" :append-icon="showPassword ? $globals.icons.eye : $globals.icons.eyeOff"
:rules="[validators.minLength(8)]" :rules="[validators.minLength(8)]" density="comfortable" variant="underlined"
density="comfortable" @click:append="showPassword = !showPassword" />
variant="underlined" <v-text-field v-model="password.newTwo" :prepend-icon="$globals.icons.lock"
@click:append="showPassword = !showPassword"
/>
<v-text-field
v-model="password.newTwo"
:prepend-icon="$globals.icons.lock"
:label="$t('user.confirm-password')" :label="$t('user.confirm-password')"
:rules="[password.newOne === password.newTwo || $t('user.password-must-match')]" :rules="[password.newOne === password.newTwo || $t('user.password-must-match')]"
validate-on="blur" validate-on="blur" :type="showPassword ? 'text' : 'password'"
:type="showPassword ? 'text' : 'password'" :append-icon="showPassword ? $globals.icons.eye : $globals.icons.eyeOff" density="comfortable"
:append-icon="showPassword ? $globals.icons.eye : $globals.icons.eyeOff" variant="underlined" @click:append="showPassword = !showPassword" />
density="comfortable"
variant="underlined"
@click:append="showPassword = !showPassword"
/>
<UserPasswordStrength v-model="password.newOne" /> <UserPasswordStrength v-model="password.newOne" />
</v-form> </v-form>
</v-card-text> </v-card-text>
<v-card-actions> <v-card-actions>
<v-spacer /> <v-spacer />
<BaseButton <BaseButton update :disabled="!passwordsMatch || password.current.length < 0"
update @click="updatePassword" />
:disabled="!passwordsMatch || password.current.length < 0"
@click="updatePassword"
/>
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</div> </div>
@ -167,30 +91,13 @@
</ToggleState> </ToggleState>
</section> </section>
<section> <section>
<BaseCardSectionTitle <BaseCardSectionTitle class="mt-10" :title="$t('profile.preferences')" />
class="mt-10" <v-checkbox v-model="userCopy.advanced" class="mt-n4" :label="$t('profile.show-advanced-description')"
:title="$t('profile.preferences')" color="primary" @change="updateUser" />
/> <nuxt-link class="mt-5 d-flex flex-column justify-center text-center" :to="`/group`"> {{
<v-checkbox
v-model="userCopy.advanced"
class="mt-n4"
:label="$t('profile.show-advanced-description')"
color="primary"
@change="updateUser"
/>
<nuxt-link
class="mt-5 d-flex flex-column justify-center text-center"
:to="`/group`"
> {{
$t('profile.looking-for-privacy-settings') }} </nuxt-link> $t('profile.looking-for-privacy-settings') }} </nuxt-link>
<div class="d-flex flex-wrap justify-center mt-5"> <div class="d-flex flex-wrap justify-center mt-5">
<v-btn <v-btn variant="outlined" class="rounded-xl my-1 mx-1" :to="`/user/profile`" nuxt exact>
variant="outlined"
class="rounded-xl my-1 mx-1"
:to="`/user/profile`"
nuxt
exact
>
<v-icon start> <v-icon start>
{{ $globals.icons.backArrow }} {{ $globals.icons.backArrow }}
</v-icon> </v-icon>
@ -202,12 +109,19 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { ref, reactive, defineComponent, computed, useContext, watch, toRefs } from "@nuxtjs/composition-api";
import { TranslateResult } from "vue-i18n";
import { useUserApi } from "~/composables/api"; import { useUserApi } from "~/composables/api";
import UserAvatar from "~/components/Domain/User/UserAvatar.vue"; import UserAvatar from "~/components/Domain/User/UserAvatar.vue";
import UserPasswordStrength from "~/components/Domain/User/UserPasswordStrength.vue"; import UserPasswordStrength from "~/components/Domain/User/UserPasswordStrength.vue";
import { validators } from "~/composables/use-validators"; import { validators } from "~/composables/use-validators";
import type { VForm } from "~/types/auto-forms"; import type { VForm } from "~/types/auto-forms";
type TRoute = string;
type TActivityLabel = TranslateResult;
const DEFAULT_ACTIVITY = "/g/home"
export default defineNuxtComponent({ export default defineNuxtComponent({
components: { components: {
UserAvatar, UserAvatar,
@ -215,18 +129,43 @@ export default defineNuxtComponent({
}, },
middleware: "sidebase-auth", middleware: "sidebase-auth",
setup() { setup() {
const i18n = useI18n(); const { $auth, i18n } = useContext();
const $auth = useMealieAuth(); const user = computed(() => $auth.user as unknown as UserOut);
const user = computed(() => $auth.user.value); const groupSlug = computed(() => user.value.groupSlug)
useSeoMeta({ const selectableActivities = new Map<TActivityLabel, TRoute>([
title: i18n.t("settings.profile"), [i18n.t("general.recipes"), groupSlug ? `/g/${groupSlug.value}` : DEFAULT_ACTIVITY],
}); [i18n.t("recipe-finder.recipe-finder"), `/g/${groupSlug.value}/recipes/finder`],
[i18n.t("meal-plan.meal-planner"), "/household/mealplan/planner/view"],
[i18n.t("shopping-list.shopping-lists"), "/shopping-lists"],
[i18n.t("recipe.timeline"), `/g/${groupSlug.value}/recipes/timeline`],
[i18n.t("cookbook.cookbooks"), `/g/${groupSlug.value}/cookbooks`],
])
function getActivityRoute(label?: TActivityLabel): TRoute {
return selectableActivities.get(label ?? "") ?? DEFAULT_ACTIVITY
}
function getActivityLabel(route?: TRoute): TActivityLabel {
return selectableActivities
.keys()
.find(label => selectableActivities.get(label as string) === (route ?? DEFAULT_ACTIVITY)) as string
// Safe assertion: DEFAULT_ACTIVITY will always exist in the map
}
const selectedDefaultActivity = ref(getActivityLabel(user.value.defaultActivity))
const activityOptions = [...selectableActivities.keys()]
watch(user, () => { watch(user, () => {
userCopy.value = { ...user.value }; userCopy.value = { ...user.value };
}); });
watch(selectedDefaultActivity, () => {
userCopy.value = {
...userCopy.value,
defaultActivity: getActivityRoute(selectedDefaultActivity.value)
}
})
const userCopy = ref({ ...user.value }); const userCopy = ref({ ...user.value });
const api = useUserApi(); const api = useUserApi();
@ -274,6 +213,8 @@ export default defineNuxtComponent({
updateUser, updateUser,
updatePassword, updatePassword,
userCopy, userCopy,
selectedDefaultActivity,
activityOptions,
password, password,
domUpdatePassword, domUpdatePassword,
passwordsMatch, passwordsMatch,

View file

@ -0,0 +1,32 @@
"""'support default activity'
Revision ID: 766c23cf0a3a
Revises: 7cf3054cbbcc
Create Date: 2025-02-27 21:22:50.172425
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "766c23cf0a3a"
down_revision: str | None = "7cf3054cbbcc"
branch_labels: str | tuple[str, ...] | None = None
depends_on: str | tuple[str, ...] | None = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table("users", schema=None) as batch_op:
batch_op.add_column(sa.Column("default_activity", sa.String(), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table("users", schema=None) as batch_op:
batch_op.drop_column("default_activity")
# ### end Alembic commands ###

View file

@ -58,6 +58,7 @@ class User(SqlAlchemyBase, BaseMixins):
auth_method: Mapped[Enum[AuthMethod]] = mapped_column(Enum(AuthMethod), default=AuthMethod.MEALIE) auth_method: Mapped[Enum[AuthMethod]] = mapped_column(Enum(AuthMethod), default=AuthMethod.MEALIE)
admin: Mapped[bool | None] = mapped_column(Boolean, default=False) admin: Mapped[bool | None] = mapped_column(Boolean, default=False)
advanced: Mapped[bool | None] = mapped_column(Boolean, default=False) advanced: Mapped[bool | None] = mapped_column(Boolean, default=False)
default_activity: Mapped[str | None] = mapped_column(String, default=None)
group_id: Mapped[GUID] = mapped_column(GUID, ForeignKey("groups.id"), nullable=False, index=True) group_id: Mapped[GUID] = mapped_column(GUID, ForeignKey("groups.id"), nullable=False, index=True)
group: Mapped["Group"] = orm.relationship("Group", back_populates="users") group: Mapped["Group"] = orm.relationship("Group", back_populates="users")

View file

@ -115,6 +115,7 @@ class UserBase(MealieModel):
group: str | None = None group: str | None = None
household: str | None = None household: str | None = None
advanced: bool = False advanced: bool = False
default_activity: str | None = None
can_invite: bool = False can_invite: bool = False
can_manage: bool = False can_manage: bool = False