Skip to content

Commit 49fe018

Browse files
ninom5ToniGrbic
andauthored
Ninom5/234 blacklist (#251)
* Add be and fe to get old intern dat * Add show old intern data and fix * Add application year for old interns * fix and add old intern data to interview page * inline styles to classes * order by applicationYear * resolve comments * fix --------- Co-authored-by: ToniGrbic <tonigrbic.5@gmail.com>
1 parent 352e7b9 commit 49fe018

File tree

18 files changed

+218
-1
lines changed

18 files changed

+218
-1
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
-- CreateTable
2+
CREATE TABLE "OldInternResult" (
3+
"id" TEXT NOT NULL,
4+
"first_name" TEXT NOT NULL,
5+
"last_name" TEXT NOT NULL,
6+
"email" TEXT NOT NULL,
7+
"discipline" TEXT,
8+
"test_score" INTEGER,
9+
"interview_score" INTEGER,
10+
11+
CONSTRAINT "OldInternResult_pkey" PRIMARY KEY ("id")
12+
);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*
2+
Warnings:
3+
4+
- Added the required column `applicationYear` to the `OldInternResult` table without a default value. This is not possible if the table is not empty.
5+
6+
*/
7+
-- AlterTable
8+
ALTER TABLE "OldInternResult" ADD COLUMN "applicationYear" TIMESTAMP(3) NOT NULL;
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
Warnings:
3+
4+
- You are about to drop the column `applicationYear` on the `OldInternResult` table. All the data in the column will be lost.
5+
- You are about to drop the column `first_name` on the `OldInternResult` table. All the data in the column will be lost.
6+
- You are about to drop the column `last_name` on the `OldInternResult` table. All the data in the column will be lost.
7+
- Added the required column `applicationDate` to the `OldInternResult` table without a default value. This is not possible if the table is not empty.
8+
- Added the required column `firstName` to the `OldInternResult` table without a default value. This is not possible if the table is not empty.
9+
- Added the required column `lastName` to the `OldInternResult` table without a default value. This is not possible if the table is not empty.
10+
11+
*/
12+
-- AlterTable
13+
ALTER TABLE "OldInternResult" DROP COLUMN "applicationYear",
14+
DROP COLUMN "first_name",
15+
DROP COLUMN "last_name",
16+
ADD COLUMN "applicationDate" TIMESTAMP(3) NOT NULL,
17+
ADD COLUMN "firstName" TEXT NOT NULL,
18+
ADD COLUMN "lastName" TEXT NOT NULL;

apps/api/prisma/schema.prisma

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,17 @@ model InternshipApplicationStatus {
163163
isOpened Boolean @default(false)
164164
}
165165

166+
model OldInternResult {
167+
id String @id @default(uuid())
168+
firstName String
169+
lastName String
170+
email String
171+
applicationDate DateTime
172+
discipline String?
173+
test_score Int?
174+
interview_score Int?
175+
}
176+
166177
enum QuestionCategory {
167178
General
168179
Personal

apps/api/src/app.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { InterviewerModule } from './interviewer/interviewer.module';
1414
import { LoggerModule } from './logger/logger.module';
1515
import { PrismaService } from './prisma.service';
1616
import { TestSlotModule } from './test-slot/test-slot.module';
17+
import { OldInternResultModule } from './old-intern-result/old-intern-result.module';
1718

1819
@Module({
1920
imports: [
@@ -31,6 +32,7 @@ import { TestSlotModule } from './test-slot/test-slot.module';
3132
InterviewerModule,
3233
QuestionModule,
3334
InternshipApplicationStatusModule,
35+
OldInternResultModule,
3436
],
3537
controllers: [AppController /* , AuthController */],
3638
providers: [AppService, PrismaService],

apps/api/src/logo/dump-logo.png

11.6 KB
Loading
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export class FindDto {
2+
name: string;
3+
surname: string;
4+
email: string;
5+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Controller, Get, Query } from '@nestjs/common';
2+
import { OldInternResultService } from './old-intern-result.service';
3+
import { FindDto } from './dto/find.dto';
4+
import { ApiTags } from '@nestjs/swagger';
5+
6+
@Controller('old-intern-result')
7+
@ApiTags('old-intern-result')
8+
export class OldInternResultController {
9+
constructor(
10+
private readonly oldInternResultService: OldInternResultService,
11+
) {}
12+
13+
@Get()
14+
findOne(@Query() findDto: FindDto) {
15+
return this.oldInternResultService.findOne(findDto);
16+
}
17+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Module } from '@nestjs/common';
2+
import { OldInternResultService } from './old-intern-result.service';
3+
import { OldInternResultController } from './old-intern-result.controller';
4+
import { PrismaService } from 'src/prisma.service';
5+
6+
@Module({
7+
controllers: [OldInternResultController],
8+
providers: [OldInternResultService, PrismaService],
9+
})
10+
export class OldInternResultModule {}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { PrismaService } from 'src/prisma.service';
2+
import { FindDto } from './dto/find.dto';
3+
import { Injectable } from '@nestjs/common';
4+
5+
@Injectable()
6+
export class OldInternResultService {
7+
constructor(private readonly prisma: PrismaService) {}
8+
9+
findOne(findDto: FindDto) {
10+
return this.prisma.oldInternResult.findMany({
11+
where: {
12+
OR: [
13+
{
14+
AND: [
15+
{ firstName: { equals: findDto.name, mode: 'insensitive' } },
16+
{ lastName: { equals: findDto.surname, mode: 'insensitive' } },
17+
],
18+
},
19+
{ email: { equals: findDto.email, mode: 'insensitive' } },
20+
],
21+
},
22+
orderBy: { applicationDate: 'desc' },
23+
});
24+
}
25+
}

0 commit comments

Comments
 (0)