Skip to content

Commit 184a915

Browse files
authored
Chore/data transformation layer (#153)
* chore: adding encoding and decoding layers for frontend and backend * fixing linting issues * formatting and adding face_expression_model-weights_manifest to the git ignore * adding test cases and ensuring that the feature works * updating test scripts with "jest --detectOpenHandles --forceExit " to avoid hanging workflows * bug fixes * updating learner side and tests * bug fixes * updates
1 parent 2f57609 commit 184a915

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+5191
-863
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ dev.op.env
7070
*/mock.jwt.cookie.auth.guard.ts
7171

7272
# manifest files
73-
face_expresstion_model-weights_manifest.json
73+
face_expression_model-weights_manifest.json
7474
tiny_face_detector_model-weights_manifest.json
7575

7676
*.env

apps/api-gateway/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"start:debug": "yarn start --debug --watch",
1818
"start:dev": "yarn start --watch",
1919
"start:prod": "node dist/main",
20-
"test": "jest",
20+
"test": "jest --detectOpenHandles --forceExit",
2121
"test:cov": "jest --coverage",
2222
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
2323
"test:e2e": "jest --config ./test/jest-e2e.json",

apps/api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"start:debug": "yarn start --debug --watch",
1818
"start:dev": "yarn start --watch",
1919
"start:prod": "node dist/main",
20-
"test": "jest",
20+
"test": "jest --detectOpenHandles --forceExit",
2121
"test:cov": "jest --coverage",
2222
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
2323
"test:e2e": "jest --config ./test/jest-e2e.json",

apps/api/src/api/assignment/attempt/dto/assignment-attempt/get.assignment.attempt.response.dto.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ export class AssignmentAttemptResponseDto {
5151
required: false,
5252
})
5353
expiresAt: Date | null;
54+
55+
@ApiProperty({
56+
description: "The DateTime at which the attempt was created",
57+
type: Date,
58+
example: "2023-12-31T10:00:00Z",
59+
required: true,
60+
})
61+
createdAt: Date;
5462
}
5563

5664
export class GetAssignmentAttemptResponseDto extends AssignmentAttemptResponseDto {

apps/api/src/api/assignment/v2/controllers/version-management.controller.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,6 @@ export class VersionManagementController {
8989
@Param("assignmentId", ParseIntPipe) assignmentId: number,
9090
@Req() request: UserSessionRequest,
9191
): Promise<VersionSummary[]> {
92-
console.log(
93-
"Received assignmentId:",
94-
assignmentId,
95-
"type:",
96-
typeof assignmentId,
97-
);
98-
9992
if (!request?.userSession) {
10093
throw new Error("User session is required");
10194
}
@@ -274,12 +267,6 @@ export class VersionManagementController {
274267
@Param("assignmentId", ParseIntPipe) assignmentId: number,
275268
@Req() request: UserSessionRequest,
276269
) {
277-
console.log(
278-
"getVersionHistory called with assignmentId:",
279-
assignmentId,
280-
"type:",
281-
typeof assignmentId,
282-
);
283270
return await this.versionService.getVersionHistory(
284271
assignmentId,
285272
request.userSession,

apps/api/src/api/llm/features/grading/services/presentation-grading.service.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ export class PresentationGradingService implements IPresentationGradingService {
161161
try {
162162
// Parse the LLM output to get points & feedback
163163
const parsedResponse = await parser.parse(response);
164-
console.log("Parsed Response:", parsedResponse);
165164

166165
// Combine the AEEG components into comprehensive feedback
167166
const aeegFeedback = `

apps/api/src/api/user/controllers/chat.controller.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,17 @@ export class ChatController {
3030

3131
@Post("today")
3232
@UseGuards(ChatAccessControlGuard)
33-
async getTodayChat(@Body() body: { userId: string; assignmentId?: number }) {
33+
async getTodayChat(@Body() body: { header: string; body: string }) {
34+
let newBody: { userId: string; assignmentId?: number };
35+
if (typeof body.body === "string") {
36+
newBody = JSON.parse(body.body) as {
37+
userId: string;
38+
assignmentId?: number;
39+
};
40+
}
3441
return this.chatService.getOrCreateTodayChat(
35-
body.userId,
36-
body.assignmentId,
42+
newBody.userId,
43+
newBody.assignmentId,
3744
);
3845
}
3946

apps/api/src/app.module.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { HealthModule } from "./health/health.module";
1818
import { winstonOptions } from "./logger/config";
1919
import { LoggerMiddleware } from "./logger/logger.middleware";
2020
import { MessagingModule } from "./messaging/messaging.module";
21+
import { DataTransformMiddleware } from "./middleware/data-transform.middleware";
2122
import { routes } from "./routes";
2223

2324
@Module({
@@ -38,7 +39,7 @@ import { routes } from "./routes";
3839
export class AppModule implements NestModule {
3940
configure(consumer: MiddlewareConsumer) {
4041
consumer
41-
.apply(LoggerMiddleware)
42+
.apply(DataTransformMiddleware, LoggerMiddleware)
4243
.forRoutes({ path: "*", method: RequestMethod.ALL })
4344
.apply(UserSessionMiddleware)
4445
.forRoutes(
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Module, Global } from "@nestjs/common";
2+
import { APP_INTERCEPTOR } from "@nestjs/core";
3+
import { DataTransformInterceptor } from "./interceptors/data-transform.interceptor";
4+
5+
/**
6+
* Global module for common functionality including data transformation
7+
*/
8+
@Global()
9+
@Module({
10+
providers: [
11+
{
12+
provide: APP_INTERCEPTOR,
13+
useClass: DataTransformInterceptor,
14+
},
15+
],
16+
exports: [DataTransformInterceptor],
17+
})
18+
export class CommonModule {}

0 commit comments

Comments
 (0)