move time
This commit is contained in:
@@ -21,4 +21,16 @@ export class FindReservesQueryDto {
|
||||
@IsOptional()
|
||||
@IsDateString()
|
||||
appointmentDate?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsDateString()
|
||||
appointmentDateFrom?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsDateString()
|
||||
appointmentDateTo?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsUUID()
|
||||
serviceId?: string;
|
||||
}
|
||||
|
||||
@@ -132,6 +132,34 @@ export class ReservesService {
|
||||
appointmentDate: query.appointmentDate,
|
||||
});
|
||||
}
|
||||
if (query.appointmentDateFrom && query.appointmentDateTo) {
|
||||
qb.andWhere(
|
||||
'reserve.appointmentDate BETWEEN :appointmentDateFrom AND :appointmentDateTo',
|
||||
{
|
||||
appointmentDateFrom: query.appointmentDateFrom,
|
||||
appointmentDateTo: query.appointmentDateTo,
|
||||
},
|
||||
);
|
||||
} else if (query.appointmentDateFrom) {
|
||||
qb.andWhere('reserve.appointmentDate >= :appointmentDateFrom', {
|
||||
appointmentDateFrom: query.appointmentDateFrom,
|
||||
});
|
||||
} else if (query.appointmentDateTo) {
|
||||
qb.andWhere('reserve.appointmentDate <= :appointmentDateTo', {
|
||||
appointmentDateTo: query.appointmentDateTo,
|
||||
});
|
||||
}
|
||||
if (query.serviceId) {
|
||||
qb.andWhere(
|
||||
`EXISTS (
|
||||
SELECT 1
|
||||
FROM reserve_items serviceFilterItem
|
||||
WHERE serviceFilterItem."reserveId" = reserve.id
|
||||
AND serviceFilterItem."serviceId" = :serviceId
|
||||
)`,
|
||||
{ serviceId: query.serviceId },
|
||||
);
|
||||
}
|
||||
|
||||
if (!this.authorizationService.isAdmin(user)) {
|
||||
if (user.role === UserRole.SALON) {
|
||||
|
||||
Reference in New Issue
Block a user