Skip to content

Commit

Permalink
fix:ts error in transpile
Browse files Browse the repository at this point in the history
  • Loading branch information
Rithick574 committed Jul 8, 2024
1 parent 00364cf commit b5f553d
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 23 deletions.
17 changes: 13 additions & 4 deletions auth-service/src/_lib/common/error/errorhandler.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
import { Request, Response, NextFunction } from "express";
import ErrorResponse from "./errorResponse";

const errorHandler = (
err: any,
req: Request,
res: Response,
next: NextFunction
) => {
const statusCode = err.status || 400;
if (err instanceof ErrorResponse) {
return res.status(err.status).json({
success: false,
status: err.status,
message: err.message,
});
}


return res.status(400).json({
success: false,
status: err.statusCode,
message: err.message || "Something went wrong",
status: 400,
message: "Internal Server Error",
});
};

export default errorHandler;
export default errorHandler;
2 changes: 1 addition & 1 deletion auth-service/src/domain/entities/otp.entity.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ObjectId } from "mongoose";
import { Document, ObjectId } from "mongoose";

export interface IOtp extends Document {
_id: ObjectId;
Expand Down
2 changes: 1 addition & 1 deletion auth-service/src/presentation/controllers/googleAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const googleAuthController = (dependencies: IDependencies) => {
});
}

const { email, given_name, family_name } = payload;
const { email, given_name } = payload;

const exist = await findUserByEmailUseCase(dependencies).execute(email);

Expand Down
2 changes: 1 addition & 1 deletion auth-service/src/presentation/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import express, { Application, NextFunction, Request, Response } from "express";
import express, { Application, Request, Response } from "express";
import dotenv from "dotenv";
import cookieParser from "cookie-parser"
dotenv.config();
Expand Down
15 changes: 12 additions & 3 deletions course-service/src/_lib/common/error/errorhandler.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
import { Request, Response, NextFunction } from "express";
import ErrorResponse from "./errorResponse";

const errorHandler = (
err: any,
req: Request,
res: Response,
next: NextFunction
) => {
const statusCode = err.status || 400;
if (err instanceof ErrorResponse) {
return res.status(err.status).json({
success: false,
status: err.status,
message: err.message,
});
}


return res.status(400).json({
success: false,
status: err.statusCode,
message: err.message || "Something went wrong",
status: 400,
message: "Internal Server Error",
});
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
import { EnrollmentEntity } from "@/domain/entities";
import { Schema, model } from "mongoose";

const LessonProgressSchema = new Schema({
lessonId: {
type: Schema.Types.ObjectId,
required: true,
},
totalTimeWatched: {
type: Number,
default: 0,
},
});

const enrollmentSchema = new Schema({
userId: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ErrorResponse } from "@learnwise/common";
import { Enrollment } from "../../models/enrollment";
import { Types } from "mongoose";
import { Document, Types } from "mongoose";


interface User {
Expand Down
2 changes: 1 addition & 1 deletion notification-service/src/_lib/nodemailer/mailFunction.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {generateVerificationMail} from "./index"

export const sendOTPMail = async (email:string, otp:string) => {
const mailResponse = await generateVerificationMail(
await generateVerificationMail(
email,
"Email Verification",
`<!DOCTYPE html>
Expand Down
2 changes: 1 addition & 1 deletion notification-service/src/presentation/server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import express, { Application, Request, Response, NextFunction } from "express";
import express, { Application, Request, Response } from "express";
import dotenv from "dotenv";
import cookieParser from "cookie-parser";
import { notificationRoutes } from "@/infrastructure/routes";
Expand Down

0 comments on commit b5f553d

Please sign in to comment.