Berian Chaiwa
05/19/2022, 2:45 PMJames L
05/19/2022, 3:01 PMJames L
05/19/2022, 3:05 PMasync editReport(user, reportId, data) {
    let report = await prisma.report.findOne({ where: { id: reportId } });
    if (report.approved) {
      if (!['admin', 'manager'].includes(user.role)) {
        throw new Error(`User ${user.id} can't edit approved reports due to lack of permissions`);
      }
    }
    return prisma.report.update({
      where: { id: reportId },
      data,
    });
  }James L
05/19/2022, 3:06 PMBerian Chaiwa
05/19/2022, 3:11 PMJason Kleinberg
05/19/2022, 8:04 PMNurul
05/24/2022, 2:38 PMBerian Chaiwa
05/24/2022, 2:42 PM