feat(rack): add shift-click context modal for connections with color and edge type configurability

This commit is contained in:
2026-03-22 21:35:10 -05:00
parent 72918bd87a
commit f1c1efd8d3
10 changed files with 277 additions and 17 deletions

View File

@@ -1,7 +1,7 @@
import { prisma } from '../lib/prisma';
import { AppError } from '../types/index';
export async function createConnection(data: { fromPortId: string; toPortId: string; color?: string; label?: string }) {
export async function createConnection(data: { fromPortId: string; toPortId: string; color?: string; label?: string; edgeType?: string }) {
// Check if both ports exist
const [from, to] = await Promise.all([
prisma.port.findUnique({ where: { id: data.fromPortId } }),
@@ -22,6 +22,13 @@ export async function deleteConnection(id: string) {
return prisma.connection.delete({ where: { id } });
}
export async function updateConnection(id: string, data: Partial<{ color: string; label: string; edgeType: string }>) {
return prisma.connection.update({
where: { id },
data,
});
}
export async function deleteByPorts(portId1: string, portId2: string) {
return prisma.connection.deleteMany({
where: {