move time

This commit is contained in:
2026-07-07 23:08:55 +03:30
parent 23cca5a201
commit 3250a6456b
2 changed files with 40 additions and 0 deletions
@@ -21,4 +21,16 @@ export class FindReservesQueryDto {
@IsOptional()
@IsDateString()
appointmentDate?: string;
@IsOptional()
@IsDateString()
appointmentDateFrom?: string;
@IsOptional()
@IsDateString()
appointmentDateTo?: string;
@IsOptional()
@IsUUID()
serviceId?: string;
}
+28
View File
@@ -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) {