Closed drisabelles closed 1 year ago
@GabrielCamargoL protótipo atualizado de acordo com o que conversamos na sexta dia 04/04
NestJS, Prisma, PostgresSQL, Insomnia, VSCODE, beekeeper Studio portable
URL: domain.api.com.br/meetings URL: domain.api.com.br/meetings/partner/:id Method: GET
@Get()
@UseGuards(AuthGuard('jwt'))
async meetings() {
return this.meetingService.findAll();
}
@Get('partner/:partnerId')
@UseGuards(AuthGuard('jwt'))
async meetingsByPartner(@Param('partnerId') partnerId: string) {
return this.meetingService.findByPartnerId(partnerId);
}
async findAll() {
const upcomingMeetings = await this.prismaService.meeting.findMany({
select: {
id: true,
title: true,
description: true,
meetingDateTime: true,
Partner: {
select: {
id: true,
name: true,
}
}
},
where: {
meetingDateTime: {
gt: getCurrentBrDateTimeISO()
}
},
orderBy: { meetingDateTime: 'asc' }
});
const pastMeetings = await this.prismaService.meeting.findMany({
select: {
id: true,
title: true,
description: true,
meetingDateTime: true,
Partner: {
select: {
id: true,
name: true,
}
}
},
where: {
meetingDateTime: {
lt: getCurrentBrDateTimeISO()
}
},
orderBy: { meetingDateTime: 'asc' }
});
return { upcomingMeetings, pastMeetings }
}
função de comparação de datas para separação entre reuniões futuras e passadas:
export function getCurrentBrDateTimeISO(): string {
const now = new Date()
const offset = -180 // offset em minutos (-180 equivale a -3 horas, ou seja, horário de Brasília)
const localTimestamp = now.getTime() + offset * 60 * 1000 // adiciona o offset em milissegundos
const localDate = new Date(localTimestamp)
const formattedDate = localDate.toISOString()
console.log(formattedDate);
return formattedDate
}
@GabrielCamargoL @drisabelles showww
📄 Descrição da atividade
Na aba "Reuniões" da tela de parcerias deve ser exibida a listagem de reuniões da parceria ordenada pela data mais recente para mais antiga.
🛠 Protótipo
🚀 Etapas do desenvolvimento
DoR: Definition of Ready
Critérios de aceite
DoD: Definition of Done