1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-08-05 13:35:23 +02:00

feat(backend): start multi-tenant support (WIP) (#680)

* fix ts types

* feat(code-generation): ♻️ update code-generation formats

* new scope

* add step button

* fix linter error

* update code-generation tags

* feat(backend):  start multi-tenant support

* feat(backend):  group invitation token generation and signup

* refactor(backend): ♻️ move group admin actions to admin router

* set url base to include `/admin`

* feat(frontend):  generate user sign-up links

* test(backend):  refactor test-suite to further decouple tests (WIP)

* feat(backend): 🐛 assign owner on backup import for recipes

* fix(backend): 🐛 assign recipe owner on migration from other service

Co-authored-by: hay-kot <hay-kot@pm.me>
This commit is contained in:
Hayden 2021-09-09 08:51:29 -08:00 committed by GitHub
parent 3c504e7048
commit bdaf758712
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
90 changed files with 1793 additions and 949 deletions

View file

@ -5,8 +5,10 @@
<v-img max-height="200" max-width="200" class="mb-2" :src="require('~/static/svgs/manage-profile.svg')"></v-img>
</template>
<template #title> Your Profile Settings </template>
Some text here...
</BasePageTitle>
<section>
<ToggleState tag="article">
<template #activator="{ toggle, state }">
@ -19,9 +21,8 @@
{{ $t("settings.profile") }}
</v-btn>
</template>
<template #default="{ state }">
<v-slide-x-transition group mode="in" hide-on-leave>
<v-slide-x-transition>
<div v-if="!state" key="personal-info">
<BaseCardSectionTitle class="mt-10" title="Personal Information"> </BaseCardSectionTitle>
<v-card tag="article" outlined>
@ -90,8 +91,14 @@
label="Show advanced features (API Keys, Webhooks, and Data Management)"
@change="updateUser"
></v-checkbox>
<div class="d-flex justify-center mt-5">
<v-btn outlined class="rounded-xl" to="/user/group"> Looking for Privacy Settings? </v-btn>
<div class="d-flex flex-wrap justify-center mt-5">
<v-btn outlined class="rounded-xl my-1 mx-1" to="/user/profile" nuxt exact>
<v-icon left>
{{ $globals.icons.backArrow }}
</v-icon>
Back to Profile
</v-btn>
<v-btn outlined class="rounded-xl my-1 mx-1" to="/user/group"> Looking for Privacy Settings? </v-btn>
</div>
</section>
</v-container>

View file

@ -9,6 +9,23 @@
Manage your profile, recipes, and group settings.
<a href="https://hay-kot.github.io/mealie/" target="_blank"> Learn More </a>
</p>
<v-card flat width="100%" max-width="600px">
<v-card-actions class="d-flex justify-center">
<v-btn outlined rounded @click="getSignupLink()">
<v-icon left>
{{ $globals.icons.createAlt }}
</v-icon>
Get Invite Link
</v-btn>
</v-card-actions>
<v-card-text v-if="generatedLink !== ''" class="d-flex">
<v-text-field v-model="generatedLink" solo readonly>
<template #append>
<AppButtonCopy :copy-text="generatedLink" />
</template>
</v-text-field>
</v-card-text>
</v-card>
</section>
<section>
<div>
@ -21,7 +38,7 @@
:link="{ text: 'Manage User Profile', to: '/user/profile/edit' }"
:image="require('~/static/svgs/manage-profile.svg')"
>
<template #title> User Profile </template>
<template #title> User Settings </template>
Manage your preferences, change your password, and update your email
</UserProfileLinkCard>
</v-col>
@ -78,8 +95,9 @@
</template>
<script lang="ts">
import { computed, defineComponent, useContext } from "@nuxtjs/composition-api";
import { computed, defineComponent, useContext, ref } from "@nuxtjs/composition-api";
import UserProfileLinkCard from "@/components/Domain/User/UserProfileLinkCard.vue";
import { useApiSingleton } from "~/composables/use-api";
export default defineComponent({
components: {
@ -88,7 +106,23 @@ export default defineComponent({
setup() {
const user = computed(() => useContext().$auth.user);
return { user };
const generatedLink = ref("");
const api = useApiSingleton();
async function getSignupLink() {
const { data } = await api.groups.createInvitation({ uses: 1 });
if (data) {
generatedLink.value = constructLink(data.token);
}
}
function constructLink(token: string) {
return `${window.location.origin}/register?token=${token}`;
}
return { user, constructLink, generatedLink, getSignupLink };
},
});
</script>