Track HiveGrid Cloud planning reference

This commit is contained in:
david committed 2026-06-26 20:48:01 +02:00
1 parent b3d5ea6764
commit e341c5938a
5784 files changed
+1104929 -3

No files matched your search

@@ -0,0 +1,40 @@
import { getEntityByIdOrName } from "~/utils/db/entities/entities.db.server";
import { getRowById } from "~/utils/db/entities/rows.db.server";
import { createManualRowLog } from "../../db/logs.db.server";
import { DefaultLogActions } from "~/application/dtos/shared/DefaultLogActions";
import { createRowComment } from "../../db/entities/rowComments.db.server";
export namespace RowCommentsApi {
export async function create(
id: string,
{
comment,
tenantId,
userId,
}: {
comment: string;
tenantId: string | null;
userId: string;
}
) {
const item = await getRowById(id, { tenantId });
const entity = await getEntityByIdOrName({ tenantId, id: item?.entityId });
if (!item || !entity) {
throw new Error("Row not found");
}
const created = await createRowComment({
createdByUserId: userId,
rowId: id,
value: comment,
});
await createManualRowLog({
tenantId: item.tenantId,
createdByUserId: userId,
action: DefaultLogActions.Commented,
entity,
item,
commentId: created.id,
});
return created;
}
}