style: clean up code formatting and remove trailing whitespace

refactor: reorganize imports and fix type imports
This commit is contained in:
Evandro Fonseca Junior committed 2025-11-11 03:08:36 -03:00
1 parent d3704602fd
commit 47c04de6fe
232 files changed
+7140 -4798

No files matched your search

+19 -8
View File
@@ -5,7 +5,13 @@
import { prisma } from "../app";
export type NotificationType = "bid" | "sale" | "purchase" | "escrow" | "dispute" | "system";
export type NotificationType =
| "bid"
| "sale"
| "purchase"
| "escrow"
| "dispute"
| "system";
export interface Notification {
notification_id: number;
@@ -33,7 +39,7 @@ export interface CreateNotificationData {
* Cria uma nova notificação
*/
export async function createNotification(
data: CreateNotificationData
data: CreateNotificationData,
): Promise<Notification> {
const notification = await prisma.notification.create({
data: {
@@ -56,7 +62,7 @@ export async function createNotification(
*/
export async function getUserNotifications(
userId: number,
filters: { is_read?: boolean; type?: NotificationType; limit?: number } = {}
filters: { is_read?: boolean; type?: NotificationType; limit?: number } = {},
): Promise<Notification[]> {
const { is_read, type, limit = 50 } = filters;
@@ -75,7 +81,7 @@ export async function getUserNotifications(
orderBy: { created_at: "desc" },
take: limit,
});
return notifications.map(notification => ({
return notifications.map((notification) => ({
...notification,
notification_type: notification.notification_type as NotificationType,
}));
@@ -96,7 +102,10 @@ export async function getUnreadCount(userId: number): Promise<number> {
/**
* Marca notificação como lida
*/
export async function markAsRead(notificationId: number, userId: number): Promise<boolean> {
export async function markAsRead(
notificationId: number,
userId: number,
): Promise<boolean> {
const result = await prisma.notification.updateMany({
where: {
notification_id: notificationId,
@@ -130,7 +139,10 @@ export async function markAllAsRead(userId: number): Promise<number> {
/**
* Remove notificação
*/
export async function deleteNotification(notificationId: number, userId: number): Promise<boolean> {
export async function deleteNotification(
notificationId: number,
userId: number,
): Promise<boolean> {
try {
await prisma.notification.delete({
where: {
@@ -139,8 +151,7 @@ export async function deleteNotification(notificationId: number, userId: number)
},
});
return true;
} catch (error) {
} catch (_error) {
return false;
}
}