a bunch of bug fixes and improvements

This commit is contained in:
Zoe
2023-04-28 00:29:06 -05:00
parent b88b3207b3
commit cb6bfd8880
10 changed files with 108 additions and 0 deletions

25
components/Modal.vue Normal file
View File

@@ -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

View File

@@ -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;
});

View File

@@ -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;
});

1
tsconfig.tsbuildinfo Normal file
View File

@@ -0,0 +1 @@
{"version":"5.0.2"}