diff --git a/src/orientation/dto/findOrientation.dto.ts b/src/orientation/dto/findOrientation.dto.ts new file mode 100644 index 0000000000000000000000000000000000000000..476ef01c6458d0864012f4d796575683e7a82200 --- /dev/null +++ b/src/orientation/dto/findOrientation.dto.ts @@ -0,0 +1,6 @@ +import { IOrientation } from '../interfaces/orientation.interface'; + +export class FindOrientationDto { + myOrientations: { inProgress: IOrientation[]; history: IOrientation[] }; + todoOrientations: { inProgress: IOrientation[]; history: IOrientation[] }; +} diff --git a/src/orientation/dto/orientation.dto.ts b/src/orientation/dto/orientation.dto.ts index 9b4a2446ea3f0d7178d3500178621fec9b485d0e..4d2bbd27a269c4fefa6bf9cd05b854cd6993e7fb 100644 --- a/src/orientation/dto/orientation.dto.ts +++ b/src/orientation/dto/orientation.dto.ts @@ -56,7 +56,7 @@ class DateSlotDto { hours: string; } -export class customStructureDto { +export class CustomStructureDto { @ApiProperty() @IsString() @IsNotEmpty() @@ -132,9 +132,9 @@ export class OrientationDto { @IsString() orientator?: string; - @ApiPropertyOptional({ type: () => customStructureDto }) - @Type(() => customStructureDto) - structureOrientator: string | customStructureDto; + @ApiPropertyOptional({ type: () => CustomStructureDto }) + @Type(() => CustomStructureDto) + structureOrientator: string | CustomStructureDto; @ApiProperty({ enum: ['pending', 'acknowledged', 'completed', 'uncompleted', 'expired'] }) @IsNotEmpty() diff --git a/src/orientation/orientation.service.ts b/src/orientation/orientation.service.ts index e44b745145852e8d805444af975b7c92b8297a65..2d4ca714d1531977d775733049aede08708554d4 100644 --- a/src/orientation/orientation.service.ts +++ b/src/orientation/orientation.service.ts @@ -1,11 +1,12 @@ import { HttpException, HttpStatus, Injectable, Logger } from '@nestjs/common'; import { InjectModel } from '@nestjs/mongoose'; import mongoose, { Model } from 'mongoose'; -import { customStructureDto, OrientationDto } from './dto/orientation.dto'; +import { CustomStructureDto, OrientationDto } from './dto/orientation.dto'; import { IOrientation } from './interfaces/orientation.interface'; import { Orientation, OrientationDocument } from './orientation.schema'; import { CategoriesService } from '../categories/services/categories.service'; import { UsersService } from '../users/services/users.service'; +import { FindOrientationDto } from './dto/findOrientation.dto'; @Injectable() export class OrientationService { @@ -37,7 +38,7 @@ export class OrientationService { } } - public async find(userId: string, structureId: string = null): Promise<any> { + public async find(userId: string, structureId: string = null): Promise<FindOrientationDto> { try { const historyStatus = ['completed', 'uncompleted', 'expired']; let myOrientationsFilters; @@ -110,7 +111,7 @@ export class OrientationService { /** * Helper method to populate structure by ID */ - private async populateStructureById(structureId: string): Promise<string | customStructureDto | null> { + private async populateStructureById(structureId: string): Promise<string | CustomStructureDto | null> { try { const structure = await this.OrientationModel.db .collection('structures')