Working on notifier system.

This commit is contained in:
charlesgauthereau
2025-11-09 16:47:58 +01:00
parent 411e09f452
commit 7dfd9f02e8
27 changed files with 2755 additions and 81 deletions
+28
View File
@@ -0,0 +1,28 @@
import {desc, eq} from "drizzle-orm";
import {db} from "@/db";
import {
NotificationChannel,
notificationChannel,
organizationNotificationChannel
} from "@/db/schema/09_notification-channel";
export async function getOrganizationChannels(organizationId: string) {
return await db
.select({
id: notificationChannel.id,
name: notificationChannel.name,
provider: notificationChannel.provider,
config: notificationChannel.config,
enabled: notificationChannel.enabled,
updatedAt: notificationChannel.updatedAt,
createdAt: notificationChannel.createdAt,
deletedAt: notificationChannel.deletedAt,
})
.from(organizationNotificationChannel)
.innerJoin(
notificationChannel,
eq(organizationNotificationChannel.notificationChannelId, notificationChannel.id)
)
.orderBy(desc(notificationChannel.createdAt))
.where(eq(organizationNotificationChannel.organizationId, organizationId)) as unknown as NotificationChannel[];
}