Skip to content

Commit

Permalink
Olivier demo prep (#73)
Browse files Browse the repository at this point in the history
* sign in error handling

* error handling for auth/verify endpoint

* adding awaits to asunc functions

* Update UserInterceptor to create new user in database on first sign in

* update default database name

* update app and application table

* include reviews relation in application queries

* Refactor review modal and Application Table

* refactor types

* add Reviews view
  • Loading branch information
ojn03 authored Dec 16, 2024
1 parent 2ef9b2d commit 7ef4fc7
Show file tree
Hide file tree
Showing 8 changed files with 262 additions and 188 deletions.
3 changes: 2 additions & 1 deletion apps/backend/src/applications/application.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
IsPositive,
Min,
} from 'class-validator';
import { Entity, Column, ManyToOne, JoinColumn } from 'typeorm';
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from 'typeorm';
import { User } from '../users/user.entity';
import {
Response,
Expand Down Expand Up @@ -61,6 +61,7 @@ export class Application {
@Column('varchar', { array: true, default: {} })
@IsArray()
@IsObject({ each: true })
@OneToMany(() => Review, (review) => review.application)
reviews: Review[];

toGetAllApplicationResponseDTO(
Expand Down
4 changes: 2 additions & 2 deletions apps/backend/src/applications/applications.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export class ApplicationsService {
async findAll(userId: number): Promise<Application[]> {
const apps = await this.applicationsRepository.find({
where: { user: { id: userId } },
relations: ['user'],
relations: ['user', 'reviews'],
});
return apps;
}
Expand All @@ -140,7 +140,7 @@ export class ApplicationsService {
year: getCurrentYear(),
semester: getCurrentSemester(),
},
relations: ['user'],
relations: ['user', 'reviews'],
});

const allApplicationsDto = applications.map((app) => {
Expand Down
8 changes: 4 additions & 4 deletions apps/frontend/src/api/apiClient.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import axios, { type AxiosInstance, AxiosRequestConfig } from 'axios';
import type {
Application,
applicationRow,
ApplicationRow,
ApplicationStage,
} from '@components/ApplicationTables';
} from '@components/types';

const defaultBaseUrl =
import.meta.env.VITE_API_BASE_URL ?? 'http://localhost:3000';
Expand All @@ -28,12 +28,12 @@ export class ApiClient {

public async getAllApplications(
accessToken: string,
): Promise<applicationRow[]> {
): Promise<ApplicationRow[]> {
return (await this.get('/api/apps', {
headers: {
Authorization: `Bearer ${accessToken}`,
},
})) as Promise<applicationRow[]>;
})) as Promise<ApplicationRow[]>;
}

public async getApplication(
Expand Down
42 changes: 42 additions & 0 deletions apps/frontend/src/components/ApplicationTables/columns.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
export const applicationColumns = [
{
field: 'firstName',
headerName: 'First Name',
width: 150,
},
{
field: 'lastName',
headerName: 'Last Name',
width: 150,
},
{
field: 'stage',
headerName: 'Stage',
width: 125,
},
{
field: 'step',
headerName: 'Status',
width: 125,
},
{
field: 'position',
headerName: 'Position',
width: 150,
},
{
field: 'createdAt',
headerName: 'Date',
width: 150,
},
{
field: 'meanRatingAllStages',
headerName: 'Rating All Stages',
width: 150,
},
{
field: 'meanRatingSingleStages',
headerName: 'Rating Single Stage',
width: 150,
},
];
Loading

0 comments on commit 7ef4fc7

Please sign in to comment.