@@ -73,10 +73,16 @@ export class CashShiftRepository extends EntityRepository<CashShift> {
|
||||
};
|
||||
}
|
||||
|
||||
findOpenShift(restId: string): Promise<CashShift | null> {
|
||||
return this.findOne(
|
||||
{ restaurant: { id: restId }, status: CashShiftStatus.OPEN },
|
||||
{ populate: ['admin'] },
|
||||
);
|
||||
findOpenShift(restId: string, adminId?: string): Promise<CashShift | null> {
|
||||
const where: FilterQuery<CashShift> = {
|
||||
restaurant: { id: restId },
|
||||
status: CashShiftStatus.OPEN,
|
||||
};
|
||||
|
||||
if (adminId) {
|
||||
where.admin = { id: adminId };
|
||||
}
|
||||
|
||||
return this.findOne(where, { populate: ['admin'] });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user