Skip to content

Open source alternatives to paid SaaS apps: Notion, Slack, Auth0, Vercel and more. Curated list with licenses and GitHub stars.

Remove unrelated code files

Anil Chandra Naidu Matcha27e09515ce51
diff --git a/src/lib/services/user.js b/src/lib/services/user.js
deleted file mode 100644
index 1ecfd4d..0000000
--- a/src/lib/services/user.js
+++ /dev/null
@@ -1,42 +0,0 @@
-import { prisma } from "../prisma";
-
-export const UserService = {
- async getCredits(userId) {
- const user = await prisma.user.findUnique({
- where: { id: userId },
- select: { credits: true },
- });
- return user ? user.credits : 0;
- },
-
- async addCredits(userId, amount) {
- if (amount <= 0) return;
- return await prisma.user.update({
- where: { id: userId },
- data: {
- credits: {
- increment: amount,
- },
- },
- });
- },
-
- async deductCredits(userId, amount) {
- if (amount <= 0) return;
-
- // Check if the user has enough credits
- const currentCredits = await this.getCredits(userId);
- if (currentCredits < amount) {
- throw new Error("Insufficient credits available");
- }
-
- return await prisma.user.update({
- where: { id: userId },
- data: {
- credits: {
- decrement: amount,
- },
- },
- });
- },
-};