Commit bb2ec7b9 authored by Diego Iván's avatar Diego Iván
Browse files

agregando funcion para validar si un Place está abierto

parent 170db9f4
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
import { Available, availableToDays } from 'src/pointOfInterest/enum/available.enum';

export const isPlaceOpen = (available: Available, startDate?: Date, endDate?: Date): boolean => {
  const curDayName: string = new Date().toLocaleDateString('en-US', { weekday: 'long' });
  if (available !== Available.CUSTOM) {
    return availableToDays[available].includes(curDayName);
  }
  const curDate: Date = new Date();
  return curDate >= startDate && curDate <= endDate;
};
+3 −2
Original line number Diff line number Diff line
@@ -17,8 +17,9 @@ export class UserService {
    private categoryService: CategoryService,
  ) {}

  async findOne(email: string) {
    return await this.userRepository.findOneBy({ email });
  async findOne(email: string): Promise<User> {
    const user = await this.userRepository.findOneBy({ email });
    return user;
  }

  async create(createUserDto: CreateUserDto) {