chore: add helper function
This commit is contained in:
parent
8e1a32dcf3
commit
b4f07c2137
1 changed files with 9 additions and 0 deletions
9
src/utils/relation.ts
Normal file
9
src/utils/relation.ts
Normal 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,
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue