fix: Ton of updates for users/teams

This commit is contained in:
Andras Bacsai
2022-04-07 23:26:06 +02:00
parent f779b3bb54
commit b96c1a23ec
20 changed files with 383 additions and 228 deletions

View File

@@ -0,0 +1,22 @@
import { getUserDetails } from '$lib/common';
import * as db from '$lib/database';
import { ErrorHandler } from '$lib/database';
import type { RequestHandler } from '@sveltejs/kit';
export const post: RequestHandler = async (event) => {
const { teamId, userId, status, body } = await getUserDetails(event);
if (status === 401) return { status, body };
const { id } = await event.request.json();
try {
await db.prisma.user.update({ where: { id }, data: { password: 'RESETME' } });
return {
status: 201
};
} catch (error) {
console.log(error);
return {
status: 500
};
}
};