mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-23 01:35:26 +00:00
27 lines
619 B
TypeScript
27 lines
619 B
TypeScript
|
|
import { prisma } from '@/prisma';
|
||
|
|
import 'server-only';
|
||
|
|
|
||
|
|
export const getConnection = async (connectionId: number, orgId: number) => {
|
||
|
|
const connection = await prisma.connection.findUnique({
|
||
|
|
where: {
|
||
|
|
id: connectionId,
|
||
|
|
orgId: orgId,
|
||
|
|
},
|
||
|
|
});
|
||
|
|
|
||
|
|
return connection;
|
||
|
|
}
|
||
|
|
|
||
|
|
export const getConnectionByDomain = async (connectionId: number, domain: string) => {
|
||
|
|
const connection = await prisma.connection.findUnique({
|
||
|
|
where: {
|
||
|
|
id: connectionId,
|
||
|
|
org: {
|
||
|
|
domain: domain,
|
||
|
|
}
|
||
|
|
},
|
||
|
|
});
|
||
|
|
|
||
|
|
return connection;
|
||
|
|
}
|