Compare commits

...

2 Commits

Author SHA1 Message Date
12579fcd6e fix nodemailer import (#473) 2025-07-15 16:46:50 +03:00
036c8bea17 task: add space filter to bookings (#471) 2025-07-15 13:31:56 +03:00
3 changed files with 16 additions and 4 deletions

View File

@ -1,7 +1,7 @@
import { HttpException, HttpStatus, Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import axios from 'axios';
import nodemailer from 'nodemailer';
import * as nodemailer from 'nodemailer';
import Mail from 'nodemailer/lib/mailer';
import { BatchEmailData } from './batch-email.interface';
import { SingleEmailData } from './single-email.interface';

View File

@ -1,5 +1,5 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsNotEmpty, Matches } from 'class-validator';
import { IsNotEmpty, IsOptional, IsUUID, Matches } from 'class-validator';
export class BookingRequestDto {
@ApiProperty({
@ -11,4 +11,13 @@ export class BookingRequestDto {
message: 'Date must be in MM/YYYY format',
})
month: string;
@ApiProperty({
description: 'Space UUID',
example: '550e8400-e29b-41d4-a716-446655440000',
required: false,
})
@IsOptional()
@IsUUID('4')
space?: string;
}

View File

@ -50,13 +50,16 @@ export class BookingService {
return this.createBookings(space, userUuid, dto);
}
async findAll({ month }: BookingRequestDto, project: string) {
async findAll({ month, space }: BookingRequestDto, project: string) {
const [monthNumber, year] = month.split('/').map(Number);
const fromDate = new Date(year, monthNumber - 1, 1);
const toDate = new Date(year, monthNumber, 0, 23, 59, 59);
return this.bookingEntityRepository.find({
where: {
space: { community: { project: { uuid: project } } },
space: {
community: { project: { uuid: project } },
uuid: space ? space : undefined,
},
date: Between(fromDate, toDate),
},
relations: ['space', 'user', 'user.inviteUser'],