Skip to content

Commit

Permalink
fix: replace hardcoded HTTP status with HttpCode enum for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor-Palha committed Oct 29, 2024
1 parent 6fc6c76 commit bf9a9d4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion backend/controllers/quote.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Request, Response, NextFunction } from 'express';

import { getOptions } from './../helpers/config';
import { QuoteModel } from '../models/quote.model';
import { HttpCode } from '../helpers/constants';

export const quoteController = {
getQuotes: async (req: Request, res: Response, next: NextFunction) => {
Expand Down Expand Up @@ -47,7 +48,7 @@ export const quoteController = {
const count = await QuoteModel.estimatedDocumentCount();

if (count === 0) {
return res.status(404).json({ message: "No quotes found" });
return res.status(HttpCode.NOT_FOUND).json({ message: "No quotes found" });
}

const randomIndex = Math.floor(Math.random() * count);
Expand Down

0 comments on commit bf9a9d4

Please sign in to comment.