Skip to content

Commit

Permalink
chore(db): update select
Browse files Browse the repository at this point in the history
  • Loading branch information
fisenkodv committed Jan 1, 2025
1 parent 065a8cc commit d01e2a4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/services/jokes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { logger } from '../utils';
export class JokesService {
async getJoke(): Promise<Nullable<Joke>> {
try {
const result = await query('SELECT id, joke, answer FROM jokes ORDER BY random() LIMIT 1');
const result = await query('SELECT id, setup, punchline FROM jokes ORDER BY random() LIMIT 1');
return result.rows.at(0) as Joke;
} catch (error) {
logger.error("An error '%s' occurred getting a random joke", error);
Expand All @@ -16,7 +16,7 @@ export class JokesService {

async getJokeById(id: number): Promise<Nullable<Joke>> {
try {
const result = await query('SELECT id, joke, answer FROM jokes WHERE id = $1', id);
const result = await query('SELECT id, setup, punchline FROM jokes WHERE id = $1', id);
const joke = result.rows.at(0) as Joke;

if (!joke) {
Expand Down

0 comments on commit d01e2a4

Please sign in to comment.