chore: add helper function

This commit is contained in:
Methapon Metanipat 2024-09-10 15:42:56 +07:00
parent 8e1a32dcf3
commit b4f07c2137

9
src/utils/relation.ts Normal file
View file

@ -0,0 +1,9 @@
export function connectOrNot(id?: string | null) {
return { connect: id ? { id } : undefined };
}
export function connectOrDisconnect(id?: string | null) {
return {
connect: id ? { id } : undefined,
disconnect: id === null || undefined,
};
}