Fix all biome linter errors (#541)

This commit is contained in:
Jared Palmer 2024-11-15 12:18:17 -05:00 committed by GitHub
parent f23c73f6a5
commit e5d654bf41
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
46 changed files with 317 additions and 275 deletions

View file

@ -8,11 +8,11 @@ import postgres from 'postgres';
import {
user,
chat,
User,
type User,
document,
Suggestion,
type Suggestion,
suggestion,
Message,
type Message,
message,
vote,
} from './schema';
@ -20,8 +20,8 @@ import {
// Optionally, if not using email/pass login, you can
// use the Drizzle adapter for Auth.js / NextAuth
// https://authjs.dev/reference/adapter/drizzle
let client = postgres(`${process.env.POSTGRES_URL!}?sslmode=require`);
let db = drizzle(client);
const client = postgres(`${process.env.POSTGRES_URL!}?sslmode=require`);
const db = drizzle(client);
export async function getUser(email: string): Promise<Array<User>> {
try {
@ -33,8 +33,8 @@ export async function getUser(email: string): Promise<Array<User>> {
}
export async function createUser(email: string, password: string) {
let salt = genSaltSync(10);
let hash = hashSync(password, salt);
const salt = genSaltSync(10);
const hash = hashSync(password, salt);
try {
return await db.insert(user).values({ email, password: hash });
@ -141,15 +141,14 @@ export async function voteMessage({
if (existingVote) {
return await db
.update(vote)
.set({ isUpvoted: type === 'up' ? true : false })
.set({ isUpvoted: type === 'up' })
.where(and(eq(vote.messageId, messageId), eq(vote.chatId, chatId)));
} else {
return await db.insert(vote).values({
chatId,
messageId,
isUpvoted: type === 'up' ? true : false,
});
}
return await db.insert(vote).values({
chatId,
messageId,
isUpvoted: type === 'up',
});
} catch (error) {
console.error('Failed to upvote message in database', error);
throw error;

View file

@ -1,4 +1,4 @@
import { InferSelectModel } from 'drizzle-orm';
import type { InferSelectModel } from 'drizzle-orm';
import {
pgTable,
varchar,