a bunch of bug fixes and improvements
This commit is contained in:
25
components/Modal.vue
Normal file
25
components/Modal.vue
Normal 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>
|
||||
BIN
public/annie-spratt-8mqOw4DBBSg-unsplash.jpg
Normal file
BIN
public/annie-spratt-8mqOw4DBBSg-unsplash.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 216 KiB |
BIN
public/daiga-ellaby-snUtnGUp2zU-unsplash.jpg
Normal file
BIN
public/daiga-ellaby-snUtnGUp2zU-unsplash.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.3 MiB |
BIN
public/eberhard-grossgasteiger-eBXIZe1DU7Y-unsplash.jpg
Normal file
BIN
public/eberhard-grossgasteiger-eBXIZe1DU7Y-unsplash.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.8 MiB |
BIN
public/nahil-naseer-xljtGZ2-P3Y-unsplash.jpg
Normal file
BIN
public/nahil-naseer-xljtGZ2-P3Y-unsplash.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 156 KiB |
BIN
public/ryan-klaus-5CkzYaubjkk-unsplash.jpg
Normal file
BIN
public/ryan-klaus-5CkzYaubjkk-unsplash.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.4 MiB |
BIN
public/tansu-topuzoglu-v2mlqhy5dLU-unsplash.jpg
Normal file
BIN
public/tansu-topuzoglu-v2mlqhy5dLU-unsplash.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 MiB |
47
server/api/user/[id]/[guildId]/profile.get.ts
Normal file
47
server/api/user/[id]/[guildId]/profile.get.ts
Normal 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;
|
||||
});
|
||||
35
server/api/user/[id]/profile.get.ts
Normal file
35
server/api/user/[id]/profile.get.ts
Normal 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
1
tsconfig.tsbuildinfo
Normal file
@@ -0,0 +1 @@
|
||||
{"version":"5.0.2"}
|
||||
Reference in New Issue
Block a user