a bunch of bug fixes and improvements
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<div
|
||||
v-if="opened"
|
||||
class="absolute z-10 top-0 bottom-0 left-0 right-0"
|
||||
>
|
||||
<slot />
|
||||
<div
|
||||
class="bg-black/70 w-screen h-screen"
|
||||
@click="$emit('close')"
|
||||
/>
|
||||
</div>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
defineEmits(['close']);
|
||||
|
||||
defineProps({
|
||||
opened: {
|
||||
type: Boolean,
|
||||
required: true
|
||||
}
|
||||
});
|
||||
</script>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 216 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.3 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.8 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 156 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.4 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.2 MiB |
@@ -0,0 +1,47 @@
|
||||
import { IServer } from '~/types';
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
if (!event.context.user.authenticated) {
|
||||
throw createError({
|
||||
statusCode: 401,
|
||||
statusMessage: 'You must be logged in to view a user in a guild.',
|
||||
});
|
||||
}
|
||||
|
||||
if (!event.context.params?.id || !event.context.params?.guildId) {
|
||||
throw createError({
|
||||
statusCode: 400,
|
||||
statusMessage: 'A userId or guildId is required',
|
||||
});
|
||||
}
|
||||
|
||||
const { id: userId, guildId } = event.context.params;
|
||||
|
||||
if (!userId || !guildId) throw new Error('id or guild id missing on a dynamic route?');
|
||||
|
||||
const user = await prisma.user.findFirst({
|
||||
where: {
|
||||
id: userId,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
roles: {
|
||||
where: {
|
||||
serverId: guildId,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
administrator: true,
|
||||
owner: true,
|
||||
},
|
||||
},
|
||||
createdAt: true,
|
||||
},
|
||||
});
|
||||
|
||||
return user;
|
||||
});
|
||||
@@ -0,0 +1,35 @@
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
if (!event.context.user.authenticated) {
|
||||
throw createError({
|
||||
statusCode: 401,
|
||||
statusMessage: 'You must be logged in to view a user in a guild.',
|
||||
});
|
||||
}
|
||||
|
||||
if (!event.context.params?.id) {
|
||||
throw createError({
|
||||
statusCode: 400,
|
||||
statusMessage: 'A userId is required',
|
||||
});
|
||||
}
|
||||
|
||||
const { id: userId } = event.context.params;
|
||||
|
||||
if (!userId) throw new Error('id missing on a dynamic route?');
|
||||
|
||||
const user = await prisma.user.findFirst({
|
||||
where: {
|
||||
id: userId,
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
createdAt: true,
|
||||
},
|
||||
});
|
||||
|
||||
return user;
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
{"version":"5.0.2"}
|
||||
Reference in New Issue
Block a user