Skip to content

Commit

Permalink
chore: less dependencies (-1)
Browse files Browse the repository at this point in the history
  • Loading branch information
chikof committed Jun 22, 2024
1 parent b812b3f commit 79f189b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 16 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"@nestjs/terminus": "^10.2.3",
"@nestjs/throttler": "^5.1.2",
"@sapphire/bitfield": "^1.2.2",
"@sapphire/utilities": "^3.16.2",
"argon2": "^0.40.1",
"axios": "^1.6.8",
"class-transformer": "^0.5.1",
Expand Down
9 changes: 0 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 3 additions & 6 deletions src/modules/bot/services/vote.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
} from '@nestjs/common';
import { ModuleRef } from '@nestjs/core';
import { hours } from '@nestjs/throttler';
import { isNullishOrEmpty, isNullishOrZero } from '@sapphire/utilities';
import { and, eq, gt } from 'drizzle-orm';
import type { BotCanVoteObject } from '../objects/vote/can-vote.object';
import { BotService } from './bot.service';
Expand Down Expand Up @@ -110,7 +109,7 @@ export class BotVoteService implements OnModuleInit {
botId: string,
userId: string
): Promise<BotCanVoteObject> {
const userVotes = await this._drizzleService
const [userVotes] = await this._drizzleService
.select()
.from(schema.votes)
.where(
Expand All @@ -123,10 +122,8 @@ export class BotVoteService implements OnModuleInit {
.limit(1)
.execute();

const canVote = isNullishOrEmpty(userVotes) ? true : !userVotes.length;
const expires = isNullishOrZero(userVotes[0]?.expires)
? null
: Number(userVotes[0].expires);
const canVote = Boolean(userVotes);
const expires = canVote ? userVotes.expires : null;

return {
canVote,
Expand Down

0 comments on commit 79f189b

Please sign in to comment.