feat: filter responsible only
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 4s

This commit is contained in:
Methapon2001 2025-04-24 14:53:04 +07:00
parent 4dbe89f290
commit 92104c05cb

View file

@ -32,6 +32,7 @@ import { notFoundError } from "../utils/error";
import { deleteFile, fileLocation, getFile, getPresigned, listFile, setFile } from "../utils/minio";
import HttpError from "../interfaces/http-error";
import HttpStatus from "../interfaces/http-status";
import { getGroupUser } from "../services/keycloak";
// User in company can edit.
const permissionCheck = createPermCheck((_) => true);
@ -136,9 +137,24 @@ export class RequestDataController extends Controller {
workflow: {
step: {
some: {
responsiblePerson: {
some: { userId: req.user.sub },
},
OR: [
{
responsiblePerson: {
some: { userId: req.user.sub },
},
},
{
responsibleGroup: {
some: {
group: {
in: await getGroupUser(req.user.sub).then((r) =>
r.map(({ name }: { name: string }) => name),
),
},
},
},
},
],
},
},
},