Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,29 @@
|
||||
import { RowCommentReaction } from "@toolctrl/db/prisma-browser";
|
||||
import { db } from "~/utils/db.server";
|
||||
import { UserSimple } from "../users.db.server";
|
||||
|
||||
export type RowCommentReactionWithDetails = RowCommentReaction & {
|
||||
createdByUser: UserSimple;
|
||||
};
|
||||
export async function setRowCommentReaction(data: { createdByUserId: string; rowCommentId: string; reaction: string }) {
|
||||
const existing = await db.rowCommentReaction.findFirst({
|
||||
where: {
|
||||
createdByUserId: data.createdByUserId,
|
||||
rowCommentId: data.rowCommentId,
|
||||
reaction: data.reaction,
|
||||
},
|
||||
});
|
||||
if (!existing) {
|
||||
await db.rowCommentReaction.create({
|
||||
data,
|
||||
});
|
||||
return true;
|
||||
} else {
|
||||
await db.rowCommentReaction.deleteMany({
|
||||
where: {
|
||||
...data,
|
||||
},
|
||||
});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user