Skip to content

Commit 8788976

Browse files
committed
feat: include wbsElement in getCurrentCar middleware for carNumber access
1 parent 1cf7b35 commit 8788976

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/backend/custom.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { Car, Organization } from '@prisma/client';
1+
import { Organization, Prisma } from '@prisma/client';
22
import { User as SharedUser } from 'shared';
33

44
declare global {
55
namespace Express {
66
export interface Request {
77
currentUser: SharedUser;
88
organization: Organization;
9-
currentCar?: Car;
9+
currentCar?: Prisma.CarGetPayload<{ include: { wbsElement: true } }>;
1010
}
1111
}
1212
}

src/backend/src/utils/car.utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ export const getCurrentCar = async (req: Request, _res: Response, next: NextFunc
1111

1212
try {
1313
const car = await prisma.car.findUnique({
14-
where: { carId }
14+
where: { carId },
15+
include: { wbsElement: true }
1516
});
1617

1718
if (!car) {

0 commit comments

Comments
 (0)