Commit 7fe4d144 by Augusto

MVP

parent 65bf6dc7
......@@ -107,6 +107,7 @@ export class CandidatesService {
}
},
comments: {
take: 1,
include: {
createdBy: {
select: {
......@@ -139,7 +140,13 @@ export class CandidatesService {
const candidate = await this.prisma.candidate.findUnique({
where: { id },
include: {
sites: {
include: {
site: true
}
},
comments: {
take: 1,
include: {
createdBy: {
select: {
......
import { ApiProperty } from '@nestjs/swagger';
import { CandidateType, CandidateStatus } from './create-candidate.dto';
import { CommentResponseDto } from '../../comments/dto/comment-response.dto';
import { SiteResponseDto } from '../../sites/dto/site-response.dto';
export class CandidateSiteDto {
@ApiProperty({ description: 'CandidateSite ID' })
id: number;
@ApiProperty({ description: 'Site associated with this candidate' })
site: SiteResponseDto;
@ApiProperty({ description: 'Creation timestamp' })
createdAt: Date;
@ApiProperty({ description: 'Last update timestamp' })
updatedAt: Date;
}
export class CandidateResponseDto {
@ApiProperty({ description: 'Candidate ID' })
......@@ -27,8 +42,8 @@ export class CandidateResponseDto {
@ApiProperty({ description: 'Whether the candidate is ongoing' })
onGoing: boolean;
@ApiProperty({ description: 'ID of the site this candidate belongs to' })
siteId: number;
@ApiProperty({ description: 'Sites associated with this candidate', type: [CandidateSiteDto] })
sites: CandidateSiteDto[];
@ApiProperty({ description: 'Creation timestamp' })
createdAt: Date;
......
......@@ -195,19 +195,24 @@ export class SitesService {
email: true,
},
},
comments: {
take: 1,
include: {
createdBy: {
select: {
id: true,
name: true,
email: true,
},
},
},
orderBy: {
createdAt: 'desc',
},
},
},
},
},
orderBy: {
candidate: {
candidateCode: 'asc',
},
},
},
_count: {
select: {
candidates: true,
},
},
},
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment