first commit

This commit is contained in:
Mathieu BOURBON
2026-04-18 16:24:44 +02:00
commit fbb6138c28
72 changed files with 3509 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
import { prisma } from '@/lib/db/prisma';
import {
createPortSchema,
updatePortSchema,
type CreatePortInput,
type UpdatePortInput,
} from './ports.schema';
export const portsService = {
listByHost: (hostId: string) =>
prisma.port.findMany({
where: { hostId },
include: { application: true },
orderBy: [{ protocol: 'asc' }, { number: 'asc' }],
}),
create: (input: CreatePortInput) =>
prisma.port.create({ data: createPortSchema.parse(input) }),
update: (id: string, input: UpdatePortInput) =>
prisma.port.update({ where: { id }, data: updatePortSchema.parse(input) }),
delete: (id: string) => prisma.port.delete({ where: { id } }),
};